This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
new 211b1b8dcb Fix numerous problems identified while testing SIS 1.5-RC3:
* `sis-embedded-data` does not work because of database located in the wrong
folder. * `AuthorityFactoryIdentifier` checks the wrong interfaces when
searching EPSG code. * Incomplete path to EPSG data when using
`org.apache.sis.epsg.downloadURL` property. * JavaFX installation wizard
impossible to read because too small on HiDPI screen. * Wrong JavaFX version,
wrong expected size of EPSG database after installation.
211b1b8dcb is described below
commit 211b1b8dcb77903b05285c9ba22a11374aec8777
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Tue Sep 30 19:04:48 2025 +0200
Fix numerous problems identified while testing SIS 1.5-RC3:
* `sis-embedded-data` does not work because of database located in the
wrong folder.
* `AuthorityFactoryIdentifier` checks the wrong interfaces when searching
EPSG code.
* Incomplete path to EPSG data when using `org.apache.sis.epsg.downloadURL`
property.
* JavaFX installation wizard impossible to read because too small on HiDPI
screen.
* Wrong JavaFX version, wrong expected size of EPSG database after
installation.
---
.../org/apache/sis/console/IdentifierCommand.java | 7 +-
.../sql/internal/shared/LocalDataSource.java | 2 +-
.../sis/referencing/crs/AbstractDerivedCRS.java | 13 ++-
.../factory/AuthorityFactoryIdentifier.java | 37 ++++++--
.../factory/IdentifiedObjectFinder.java | 2 +-
.../factory/MultiAuthoritiesFactory.java | 2 +-
.../referencing/factory/sql/EPSGCodeFinder.java | 6 +-
.../report/CoordinateReferenceSystems.java | 13 +--
.../apache/sis/setup/OptionalInstallations.java | 18 ++--
.../main/org/apache/sis/gui/setup/FXFinder.java | 6 +-
.../main/org/apache/sis/gui/setup/Wizard.java | 99 +++++++++++++++-------
.../main/org/apache/sis/gui/setup/WizardPage.java | 4 +-
.../sis/resources/embedded/EmbeddedResources.java | 6 +-
.../resources/embedded/EmbeddedResourcesTest.java | 6 +-
.../apache/sis/resources/embedded/Generator.java | 6 +-
.../factory/sql/epsg/DataScriptUpdater.java | 3 +
parent/sis.css | 6 --
17 files changed, 151 insertions(+), 85 deletions(-)
diff --git
a/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/IdentifierCommand.java
b/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/IdentifierCommand.java
index 9095f0937d..32be57adc0 100644
---
a/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/IdentifierCommand.java
+++
b/endorsed/src/org.apache.sis.console/main/org/apache/sis/console/IdentifierCommand.java
@@ -19,7 +19,6 @@ package org.apache.sis.console;
import java.io.IOException;
import java.util.List;
import java.util.ArrayList;
-import java.util.Set;
import java.util.EnumSet;
import java.util.Collections;
import java.util.ResourceBundle;
@@ -179,8 +178,8 @@ final class IdentifierCommand extends
FormattedOutputCommand {
}
}
/*
- * The CRS provided by the user contains identifier, but the
'lookupURN' operation above failed to
- * find it. The most likely cause is that the user-provided CRS does
not use the same axis order.
+ * The CRS provided by the user contains identifier, but the
`lookupURN(…)` operation above failed
+ * to find it. The most likely cause is that the user-provided CRS
does not use the same axis order.
*/
State state;
try {
@@ -221,7 +220,7 @@ final class IdentifierCommand extends
FormattedOutputCommand {
}
}
width += 4;
- final Set<State> states = EnumSet.noneOf(State.class);
+ final var states = EnumSet.noneOf(State.class);
for (final Row row : rows) {
if (row != null) {
states.add(row.state);
diff --git
a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/LocalDataSource.java
b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/LocalDataSource.java
index a50e523e98..c9af2161c6 100644
---
a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/LocalDataSource.java
+++
b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/sql/internal/shared/LocalDataSource.java
@@ -137,7 +137,7 @@ public final class LocalDataSource implements DataSource,
Comparable<LocalDataSo
case HSQL: path = Path.of(path.toString() + ".data");
break;
// More cases may be added in the future.
}
- create = !Files.exists(path);
+ create = Files.notExists(path);
} else if (home != null) {
/*
* SIS_DATA not defined, but we may be able to fallback on
"derby.system.home" property.
diff --git
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/AbstractDerivedCRS.java
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/AbstractDerivedCRS.java
index 87a2411190..414b1f751c 100644
---
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/AbstractDerivedCRS.java
+++
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/AbstractDerivedCRS.java
@@ -230,10 +230,15 @@ abstract class AbstractDerivedCRS extends AbstractCRS
implements DerivedCRS {
if (Semaphores.queryAndSet(Semaphores.CONVERSION_AND_CRS)) {
return true;
} else try {
- return Utilities.deepEquals(
- strict ? conversionFromBase : getConversionFromBase(),
- strict ? ((AbstractDerivedCRS)
object).conversionFromBase
- : ((DerivedCRS)
object).getConversionFromBase(), mode);
+ final Conversion op1, op2;
+ if (strict) {
+ op1 = conversionFromBase;
+ op2 = ((AbstractDerivedCRS) object).conversionFromBase;
+ } else {
+ op1 = getConversionFromBase();
+ op2 = ((DerivedCRS) object).getConversionFromBase();
+ }
+ return Utilities.deepEquals(op1, op2, mode);
} finally {
Semaphores.clear(Semaphores.CONVERSION_AND_CRS);
}
diff --git
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/AuthorityFactoryIdentifier.java
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/AuthorityFactoryIdentifier.java
index b94b41faa1..c47ac734d7 100644
---
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/AuthorityFactoryIdentifier.java
+++
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/AuthorityFactoryIdentifier.java
@@ -20,11 +20,21 @@ import java.util.Locale;
import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.LogRecord;
+import javax.measure.Unit;
import org.opengis.metadata.citation.Citation;
import org.opengis.referencing.AuthorityFactory;
+import org.opengis.referencing.cs.CoordinateSystem;
+import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.opengis.referencing.cs.CSAuthorityFactory;
import org.opengis.referencing.crs.CRSAuthorityFactory;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.opengis.referencing.datum.Datum;
+import org.opengis.referencing.datum.DatumEnsemble;
+import org.opengis.referencing.datum.Ellipsoid;
+import org.opengis.referencing.datum.PrimeMeridian;
import org.opengis.referencing.datum.DatumAuthorityFactory;
+import org.opengis.referencing.operation.OperationMethod;
+import org.opengis.referencing.operation.CoordinateOperation;
import org.opengis.referencing.operation.CoordinateOperationAuthorityFactory;
import org.apache.sis.util.Classes;
import org.apache.sis.util.resources.Vocabulary;
@@ -32,6 +42,7 @@ import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.internal.shared.Constants;
import org.apache.sis.metadata.internal.shared.NameMeaning;
import org.apache.sis.referencing.internal.Resources;
+import org.opengis.referencing.IdentifiedObject;
/**
@@ -56,22 +67,22 @@ final class AuthorityFactoryIdentifier {
/**
* Factory needed is {@link CRSAuthorityFactory}.
*/
- CRS(CRSAuthorityFactory.class),
+ CRS(CRSAuthorityFactory.class, CoordinateReferenceSystem.class),
/**
* Factory needed is {@link CSAuthorityFactory}.
*/
- CS(CSAuthorityFactory.class),
+ CS(CSAuthorityFactory.class, CoordinateSystem.class,
CoordinateSystemAxis.class, Unit.class),
/**
* Factory needed is {@link DatumAuthorityFactory}.
*/
- DATUM(DatumAuthorityFactory.class),
+ DATUM(DatumAuthorityFactory.class, Datum.class, DatumEnsemble.class,
Ellipsoid.class, PrimeMeridian.class),
/**
* Factory needed is {@link CoordinateOperationAuthorityFactory}.
*/
- OPERATION(CoordinateOperationAuthorityFactory.class),
+ OPERATION(CoordinateOperationAuthorityFactory.class,
CoordinateOperation.class, OperationMethod.class),
/**
* Factory needed is the Apache-SIS specific {@link
GeodeticAuthorityFactory}.
@@ -88,13 +99,19 @@ final class AuthorityFactoryIdentifier {
*/
final Class<? extends AuthorityFactory> api;
+ /**
+ * Types of objects created by the factory.
+ */
+ private final Class<?>[] objects;
+
/**
* Creates a new enumeration value.
*
* @param base the interface of the authority factory.
*/
- private Type(final Class<? extends AuthorityFactory> api) {
+ private Type(final Class<? extends AuthorityFactory> api, final
Class<?>... objects) {
this.api = api;
+ this.objects = objects;
}
/**
@@ -103,6 +120,16 @@ final class AuthorityFactoryIdentifier {
final boolean isGeneric() {
return ordinal() >= GEODETIC.ordinal();
}
+
+ /**
+ * Returns whether the given object may have been created by a factory
of this type.
+ *
+ * @param object the object to test.
+ * @return whether the given object may have been created by a factory
of this type.
+ */
+ final boolean isFactoryOf(final IdentifiedObject object) {
+ return Classes.isAssignableToAny(object.getClass(), objects);
+ }
}
/**
diff --git
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java
index 65dcc6a229..2eabbcdb41 100644
---
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java
+++
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/IdentifiedObjectFinder.java
@@ -501,7 +501,7 @@ public class IdentifiedObjectFinder {
public IdentifiedObject apply(final String code) {
final boolean finer =
Semaphores.queryAndSet(Semaphores.FINER_OBJECT_CREATION_LOGS);
try {
- IdentifiedObject candidate = (IdentifiedObject)
proxy.createFromAPI(factory, code);
+ final var candidate = (IdentifiedObject)
proxy.createFromAPI(factory, code);
if (match(candidate, object, mode, proxy) &&
existing.add(candidate)) {
if (!hasMatches) {
hasMatches = true;
diff --git
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java
index 8f65cc7fc5..493b8141a9 100644
---
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java
+++
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/MultiAuthoritiesFactory.java
@@ -1837,7 +1837,7 @@ public class MultiAuthoritiesFactory extends
GeodeticAuthorityFactory implements
final Set<IdentifiedObject> createFromCodes(final IdentifiedObject
object) throws FactoryException {
if (getSearchDomain() != Domain.EXHAUSTIVE_VALID_DATASET) {
for (AuthorityFactoryIdentifier.Type type :
AuthorityFactoryIdentifier.Type.values()) {
- if (type.api.isInstance(object)) {
+ if (type.isFactoryOf(object)) {
final var result = new
LinkedHashSet<IdentifiedObject>();
createFromIdentifiers(type, object,
object.getIdentifiers(), result);
if (result.isEmpty()) {
diff --git
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGCodeFinder.java
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGCodeFinder.java
index ff205517c6..cde2d6b370 100644
---
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGCodeFinder.java
+++
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGCodeFinder.java
@@ -790,7 +790,11 @@ crs: if (isInstance(CoordinateReferenceSystem.class,
object)) {
*/
@Override
public String toString() {
- return Strings.toString(getClass(), "object", getName(object),
"source", source, "domain", domain, "size", codes.size());
+ return Strings.toString(getClass(),
+ "object", getName(object),
+ "source", source,
+ "domain", domain,
+ "size", codes.size());
}
}
}
diff --git
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
index 23b2c3c33d..da051cb7de 100644
---
a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
+++
b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
@@ -55,14 +55,12 @@ import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.Deprecable;
import org.apache.sis.util.Utilities;
import org.apache.sis.util.Version;
-import org.apache.sis.util.internal.shared.Constants;
import org.apache.sis.referencing.crs.AbstractCRS;
import org.apache.sis.referencing.cs.AxesConvention;
import org.apache.sis.referencing.factory.CommonAuthorityFactory;
import org.apache.sis.referencing.factory.MultiAuthoritiesFactory;
import org.apache.sis.referencing.factory.sql.EPSGFactory;
import org.apache.sis.util.internal.shared.URLs;
-import org.apache.sis.util.iso.DefaultNameSpace;
import org.apache.sis.util.logging.Logging;
@@ -193,9 +191,7 @@ public final class CoordinateReferenceSystems extends
HTMLGenerator {
try {
row.setValues(factory,
factory.createCoordinateReferenceSystem(code));
} catch (FactoryException exception) {
- if (row.setValues(factory, exception, code)) {
- continue;
- }
+ row.setValues(factory, exception, code);
}
rows.add(row);
if (!row.hasError) numSupportedCRS++;
@@ -442,12 +438,8 @@ public final class CoordinateReferenceSystems extends
HTMLGenerator {
* @param factory the factory which created the <abbr>CRS</abbr>.
* @param cause the reason why the <abbr>CRS</abbr> cannot be
constructed.
* @param code the authority code without <abbr>HTML</abbr>
escapes.
- * @return whether to ignore this row.
*/
- final boolean setValues(final CRSAuthorityFactory factory, final
FactoryException cause, final String code) {
- if (code.startsWith(Constants.PROJ4 +
DefaultNameSpace.DEFAULT_SEPARATOR)) {
- return true;
- }
+ final void setValues(final CRSAuthorityFactory factory, final
FactoryException cause, final String code) {
String message = cause.getMessage();
if (message == null) {
message = cause.toString();
@@ -473,7 +465,6 @@ public final class CoordinateReferenceSystems extends
HTMLGenerator {
}
setSection(null);
}
- return false;
}
/**
diff --git
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/setup/OptionalInstallations.java
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/setup/OptionalInstallations.java
index 3d08b303b8..923886c020 100644
---
a/endorsed/src/org.apache.sis.util/main/org/apache/sis/setup/OptionalInstallations.java
+++
b/endorsed/src/org.apache.sis.util/main/org/apache/sis/setup/OptionalInstallations.java
@@ -57,16 +57,22 @@ import static
org.apache.sis.util.internal.shared.Constants.EPSG;
*/
public abstract class OptionalInstallations extends InstallationResources
implements Localized {
/**
- * Where to download the EPSG scripts after user has approved the terms of
use.
+ * The Maven repository from where to download artifacts.
+ * This repository can be overridden by setting the {@code
"org.apache.sis.epsg.downloadURL"} property.
*/
- private static final String EPSG_DOWNLOAD_URL =
-
"https://repo1.maven.org/maven2/org/apache/sis/non-free/sis-epsg/1.5/sis-epsg-1.5.jar";
+ private static final String REPOSITORY = "https://repo1.maven.org/maven2";
+
+ /**
+ * Path to the <abbr>EPSG</abbr> scripts relative to the selected
repository.
+ * This is where to download the database after user has approved the
terms of use.
+ */
+ private static final String EPSG_DOWNLOAD_PATH =
"/org/apache/sis/non-free/sis-epsg/1.5/sis-epsg-1.5.jar";
/**
* Estimation of the EPSG database size after installation, in megabytes.
* This is for information purpose only.
*/
- private static final int DATABASE_SIZE = 26;
+ private static final int DATABASE_SIZE = 24;
/**
* The MIME type to use for fetching license texts.
@@ -183,10 +189,12 @@ public abstract class OptionalInstallations extends
InstallationResources implem
* except as a workaround if a hard-coded URL is no longer accessible.
*/
private String getDownloadURL(final String authority) {
+ final String base;
switch (authority) {
- case EPSG: return
System.getProperty("org.apache.sis.epsg.downloadURL", EPSG_DOWNLOAD_URL);
+ case EPSG: base =
System.getProperty("org.apache.sis.epsg.downloadURL", REPOSITORY); break;
default: throw unsupported(authority); // More authorities
may be added in the future.
}
+ return base + EPSG_DOWNLOAD_PATH;
}
/**
diff --git
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/setup/FXFinder.java
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/setup/FXFinder.java
index 8c17e50bf7..e8fef1c853 100644
---
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/setup/FXFinder.java
+++
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/setup/FXFinder.java
@@ -38,7 +38,7 @@ public final class FXFinder {
/**
* Minimal version of JavaFX required by Apache SIS.
*/
- static final int JAVAFX_VERSION = 13;
+ static final int JAVAFX_VERSION = 20;
/**
* The URL where to download JavaFX.
@@ -382,7 +382,7 @@ public final class FXFinder {
* We remember the position where we found `command` in order to
insert replacement at
* the same line.
*/
- final ArrayList<String> content = new ArrayList<>();
+ final var content = new ArrayList<String>();
int insertAt = -1;
for (String line : Files.readAllLines(setenv)) {
line = line.trim();
@@ -400,7 +400,7 @@ public final class FXFinder {
* It will be either an absolute path, or a path relative to
* the SIS installation directory.
*/
- final StringBuilder value = new
StringBuilder(100).append(command).append('=');
+ final var value = new StringBuilder(100).append(command).append('=');
if (useRelativePath) {
final File relative = relativeToBase(validated);
if (relative != null) {
diff --git
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/setup/Wizard.java
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/setup/Wizard.java
index fce91995f6..604a766565 100644
--- a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/setup/Wizard.java
+++ b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/setup/Wizard.java
@@ -88,10 +88,17 @@ final class Wizard extends FileFilter implements
ActionListener, PropertyChangeL
UIManager.put("FileChooser.readOnly", Boolean.TRUE);
}
+ /**
+ * Scale factor to apply on all sizes expressed in pixels.
+ * This is a value greater than 1 on screens with a high resolution.
+ */
+ private final float scaleFactoryForHiDPI;
+
/**
* The window width, in pixels.
+ * Needs to be multiplied by {@link #scaleFactoryForHiDPI} after that
value become known.
*/
- private static final int WIDTH = 700;
+ private static final int WIDTH = 700, HEIGHT = 500;
/**
* Label of button to show in the wizard, also used as action identifier.
@@ -232,19 +239,20 @@ final class Wizard extends FileFilter implements
ActionListener, PropertyChangeL
this.javafxFinder = javafxFinder;
wizard = new JFrame("Apache SIS setup");
final Container content = wizard.getContentPane();
+ scaleFactoryForHiDPI = content.getFont().getSize() / 14f;
content.setLayout(new BorderLayout());
/*
* Back, Next, Cancel button.
*/
{ // For keeping variables in a local scope.
final Box buttons = Box.createHorizontalBox();
- buttons.setBorder(new EmptyBorder(9, 12, 9, 15)); // Top,
left, bottom, right.
- backButton = createButton(buttons, BACK);
buttons.add(Box.createHorizontalStrut(10));
- nextButton = createButton(buttons, NEXT);
buttons.add(Box.createHorizontalStrut(30));
+ buttons.setBorder(newEmptyBorder(9, 12, 9, 15)); // Top,
left, bottom, right.
+ backButton = createButton(buttons, BACK);
buttons.add(Box.createHorizontalStrut(scaledSize(10)));
+ nextButton = createButton(buttons, NEXT);
buttons.add(Box.createHorizontalStrut(scaledSize(30)));
cancelButton = createButton(buttons, CANCEL);
backButton.setEnabled(false);
- final JPanel bottom = new JPanel(new BorderLayout());
+ final var bottom = new JPanel(new BorderLayout());
bottom.add(new JSeparator(), BorderLayout.NORTH);
bottom.add(buttons, java.awt.BorderLayout.EAST);
content.add(bottom, BorderLayout.SOUTH);
@@ -261,7 +269,7 @@ final class Wizard extends FileFilter implements
ActionListener, PropertyChangeL
final WizardPage[] pages = WizardPage.values();
{
titles = new JLabel[pages.length];
- final EmptyBorder padding = new EmptyBorder(3, 0, 3, 0);
+ final var padding = newEmptyBorder(3, 0, 3, 0);
final Box summary = Box.createVerticalBox();
for (int i=0; i<pages.length; i++) {
final String title = (i == 0 ? SELECTED_TITLE_BULLET :
TITLE_BULLET) + pages[i].title;
@@ -270,11 +278,11 @@ final class Wizard extends FileFilter implements
ActionListener, PropertyChangeL
label.setBorder(padding);
summary.add(titles[i] = label);
}
- final JPanel pane = new JPanel();
+ final var pane = new JPanel();
pane.setBackground(new Color(169, 204, 227));
- pane.setBorder(new EmptyBorder(40, 15, 9, 24)); // Top,
left, bottom, right.
+ pane.setBorder(newEmptyBorder(40, 15, 9, 24)); // Top,
left, bottom, right.
pane.add(summary);
- content.add(pane, BorderLayout.WEST);
+ content.add(pane, BorderLayout.WEST);
}
/*
* The main content where text is shown, together with download
button, directory chooser, etc.
@@ -282,7 +290,7 @@ final class Wizard extends FileFilter implements
ActionListener, PropertyChangeL
* a description text formatted in HTML.
*/
{
- final Font font = new Font(Font.SERIF, Font.PLAIN, 14);
+ final var font = new Font(Font.SERIF, Font.PLAIN, scaledSize(14));
javafxPath = new JLabel();
javafxPath.setBorder(JAVAFX_PATH_BORDER);
javafxPathError = new JLabel();
@@ -290,7 +298,7 @@ final class Wizard extends FileFilter implements
ActionListener, PropertyChangeL
javafxPathError.setFont(font);
inflateProgress = new JProgressBar();
cardPanel = new JPanel(new CardLayout());
- cardPanel.setBorder(new EmptyBorder(30, 30, 9, 30)); // Top,
left, bottom, right.
+ cardPanel.setBorder(newEmptyBorder(30, 30, 9, 30)); // Top,
left, bottom, right.
cardPanel.setBackground(Color.WHITE);
for (final WizardPage page : pages) {
cardPanel.add(createPage(page, font), page.name());
@@ -299,8 +307,7 @@ final class Wizard extends FileFilter implements
ActionListener, PropertyChangeL
currentPage = pages[0];
content.add(cardPanel, BorderLayout.CENTER);
}
- wizard.setSize(WIDTH, 500); // Must be before
`setLocationRelativeTo(…)`.
- wizard.setResizable(false);
+ wizard.setSize(scaledSize(WIDTH), scaledSize(HEIGHT)); // Must be
before `setLocationRelativeTo(…)`.
wizard.setLocationRelativeTo(null);
wizard.addWindowListener(new WindowAdapter() {
@Override public void windowClosing(WindowEvent event) {
@@ -309,6 +316,35 @@ final class Wizard extends FileFilter implements
ActionListener, PropertyChangeL
});
}
+ /**
+ * Returns the given size scaled for HiDPI screens.
+ */
+ private int scaledSize(final int size) {
+ return (int) (scaleFactoryForHiDPI * size);
+ }
+
+ /**
+ * Creates an empty border scaled for HiDPI screens.
+ */
+ @SuppressWarnings("lossy-conversions")
+ private EmptyBorder newEmptyBorder(int top, int left, int bottom, int
right) {
+ top *= scaleFactoryForHiDPI;
+ left *= scaleFactoryForHiDPI;
+ bottom *= scaleFactoryForHiDPI;
+ right *= scaleFactoryForHiDPI;
+ return new EmptyBorder(top, left, bottom, right);
+ }
+
+ /**
+ * Creates a dimension scaled for HiDPI screens.
+ */
+ @SuppressWarnings("lossy-conversions")
+ private Dimension newDimension(int width, int height) {
+ width *= scaleFactoryForHiDPI;
+ height *= scaleFactoryForHiDPI;
+ return new Dimension(width, height);
+ }
+
/**
* Invoked by the constructor for preparing in advance each page in a
{@link CardLayout}.
* Each page starts with a text formatted in HTML using a Serif font (such
as Times),
@@ -319,45 +355,45 @@ final class Wizard extends FileFilter implements
ActionListener, PropertyChangeL
*/
private Box createPage(final WizardPage page, final Font font) {
final Box content = Box.createVerticalBox();
- final JLabel text = new JLabel(page.text, JLabel.LEFT);
+ final var text = new JLabel(page.text, JLabel.LEFT);
text.setFont(font);
content.add(text);
- content.add(Box.createVerticalStrut(30));
+ content.add(Box.createVerticalStrut(scaledSize(30)));
switch (page) {
case DOWNLOAD_JAVAFX: {
final JButton button = createButton(content, JAVAFX_HOME);
button.setToolTipText(FXFinder.JAVAFX_HOME);
button.setEnabled(Desktop.isDesktopSupported() &&
Desktop.getDesktop().isSupported(Desktop.Action.BROWSE));
- final JLabel instruction = new
JLabel(WizardPage.downloadSteps());
- instruction.setFont(font.deriveFont(12f));
+ final var instruction = new JLabel(WizardPage.downloadSteps());
+ instruction.setFont(font.deriveFont(scaledSize(12)));
content.add(instruction);
break;
}
case JAVAFX_LOCATION: {
- javafxPath.setMinimumSize(new Dimension( 100, 30));
- javafxPath.setMaximumSize(new Dimension(WIDTH, 30));
+ javafxPath.setMinimumSize(newDimension( 100, 30));
+ javafxPath.setMaximumSize(newDimension(WIDTH, 30));
content.add(javafxPath);
- content.add(Box.createVerticalStrut(12));
+ content.add(Box.createVerticalStrut(scaledSize(12)));
createButton(content, BROWSE);
- content.add(Box.createVerticalStrut(24));
+ content.add(Box.createVerticalStrut(scaledSize(24)));
content.add(javafxPathError);
content.setDropTarget(new DropTarget(content, this));
break;
}
case DECOMPRESS: {
- inflateProgress.setMinimumSize(new Dimension( 100, 21));
- inflateProgress.setMaximumSize(new Dimension(WIDTH, 21));
+ inflateProgress.setMinimumSize(newDimension( 100, 21));
+ inflateProgress.setMaximumSize(newDimension(WIDTH, 21));
content.add(inflateProgress);
break;
}
case COMPLETED: {
finalMessage = text;
- final Border vb = new EmptyBorder(0, 15, 9, 0);
- final Font fn = new Font(Font.MONOSPACED, Font.BOLD, 13);
- final Font fv = new Font(Font.SANS_SERIF, Font.PLAIN, 13);
+ final var vb = newEmptyBorder(0, 15, 9, 0);
+ final var fn = new Font(Font.MONOSPACED, Font.BOLD,
scaledSize(13));
+ final var fv = new Font(Font.SANS_SERIF, Font.PLAIN,
scaledSize(13));
for (final String[] variable :
javafxFinder.getEnvironmentVariables()) {
- final JLabel name = new JLabel(variable[0] + ':');
- final JLabel value = new JLabel(variable[1]);
+ final var name = new JLabel(variable[0] + ':');
+ final var value = new JLabel(variable[1]);
name .setForeground(Color.DARK_GRAY);
value.setForeground(Color.DARK_GRAY);
name .setFont(fn);
@@ -505,7 +541,7 @@ final class Wizard extends FileFilter implements
ActionListener, PropertyChangeL
* Returns a non-null message for given exception with HTML characters
escaped.
*/
private static String getHtmlMessage(final String header, final Exception
e) {
- final StringBuilder buffer = new
StringBuilder(100).append("<html>").append(header)
+ final var buffer = new
StringBuilder(100).append("<html>").append(header)
.append("<br><b>").append(e.getClass().getSimpleName()).append("</b>");
String message = e.getLocalizedMessage();
if (message != null) {
@@ -545,6 +581,7 @@ final class Wizard extends FileFilter implements
ActionListener, PropertyChangeL
selectButton.setEnabled(false);
fd.addPropertyChangeListener(this);
}
+ fd.setPreferredSize(newDimension(WIDTH + 100, HEIGHT + 100));
if (fd.showOpenDialog(wizard) == JFileChooser.APPROVE_OPTION) {
setJavafxPath(fd.getSelectedFile());
}
@@ -564,7 +601,7 @@ final class Wizard extends FileFilter implements
ActionListener, PropertyChangeL
for (int i=0; i<n; i++) {
final Component child = c.getComponent(i);
if (child instanceof JButton) {
- final JButton button = (JButton) child;
+ final var button = (JButton) child;
if (SELECT.equals(button.getText())) {
return button;
}
@@ -746,7 +783,7 @@ final class Wizard extends FileFilter implements
ActionListener, PropertyChangeL
JOptionPane.showMessageDialog(null, diagnostic, "Configuration
error", JOptionPane.ERROR_MESSAGE);
return false;
} else {
- final Wizard wizard = new Wizard(javafxFinder);
+ final var wizard = new Wizard(javafxFinder);
wizard.wizard.setVisible(true);
return true;
}
diff --git
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/setup/WizardPage.java
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/setup/WizardPage.java
index 5034e959e2..3ecb22a640 100644
---
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/setup/WizardPage.java
+++
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/setup/WizardPage.java
@@ -28,13 +28,13 @@ enum WizardPage {
* Plain text saying what this wizard will do.
*/
INTRODUCTION("Introduction",
- "<html><h1>Welcome to Apache SIS™</h1>"
+ "<html><h1 style=\"font-size:1.2em;\">Welcome to Apache SIS™</h1>"
+ "<p>"
+ "This wizard will configure Apache Spatial Information System
(SIS) "
+ "JavaFX application on your computer. "
+ "This configuration needs to be done only once. "
+ "Click <u>Next</u> to continue, or <u>Cancel</u> to exit setup."
- + "</p><p style=\"padding-top:20px; font-size:10px;
color:#909090;\">"
+ + "</p><br><p style=\"font-size:0.9em; color:#909090;\">"
+ "Apache SIS is licensed under the Apache License, version 2.0."
+ "</p></html>"),
diff --git
a/optional/src/org.apache.sis.referencing.database/main/org/apache/sis/resources/embedded/EmbeddedResources.java
b/optional/src/org.apache.sis.referencing.database/main/org/apache/sis/resources/embedded/EmbeddedResources.java
index d3eea06d33..ba8b15e26b 100644
---
a/optional/src/org.apache.sis.referencing.database/main/org/apache/sis/resources/embedded/EmbeddedResources.java
+++
b/optional/src/org.apache.sis.referencing.database/main/org/apache/sis/resources/embedded/EmbeddedResources.java
@@ -43,12 +43,12 @@ import org.apache.sis.util.resources.Errors;
*/
public class EmbeddedResources extends InstallationResources {
/**
- * The name of the database embedded in the JAR file.
+ * The root directory of data embedded in the <abbr>JAR</abbr> file.
* It must be an invalid package name, because otherwise the Java Platform
Module System (JPMS) enforces
* encapsulation in the same way as non-exported packages, which makes the
database inaccessible to Derby.
* This naming trick is part of <abbr>JPMS</abbr> specification, so it
should be reliable.
*/
- static final String EMBEDDED_DATABASE = "spatial-metadata";
+ static final String DIRECTORY = "SIS-DATA";
/**
* Creates a new provider for connections to the embedded database.
@@ -132,7 +132,7 @@ public class EmbeddedResources extends
InstallationResources {
verifyAuthority(authority);
final var ds = new EmbeddedDataSource();
ds.setDataSourceName(Initializer.DATABASE);
- ds.setDatabaseName("classpath:SIS_DATA/Databases/" +
EMBEDDED_DATABASE);
+ ds.setDatabaseName("classpath:" + DIRECTORY + "/Databases/" +
Initializer.DATABASE);
return ds;
}
diff --git
a/optional/src/org.apache.sis.referencing.database/test/org/apache/sis/resources/embedded/EmbeddedResourcesTest.java
b/optional/src/org.apache.sis.referencing.database/test/org/apache/sis/resources/embedded/EmbeddedResourcesTest.java
index 49df55c576..3c648a004f 100644
---
a/optional/src/org.apache.sis.referencing.database/test/org/apache/sis/resources/embedded/EmbeddedResourcesTest.java
+++
b/optional/src/org.apache.sis.referencing.database/test/org/apache/sis/resources/embedded/EmbeddedResourcesTest.java
@@ -24,6 +24,7 @@ import java.util.Map;
import javax.sql.DataSource;
import java.util.ServiceLoader;
import org.opengis.util.FactoryException;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.apache.sis.setup.InstallationResources;
import org.apache.sis.metadata.sql.internal.shared.Initializer;
import org.apache.sis.system.DataDirectory;
@@ -37,9 +38,6 @@ import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
import org.apache.sis.test.TestUtilities;
-// Specific to the geoapi-3.1 and geoapi-4.0 branches:
-import org.opengis.referencing.crs.CoordinateReferenceSystem;
-
/**
* Tests {@link EmbeddedResources}.
@@ -114,7 +112,7 @@ public final strictfp class EmbeddedResourcesTest {
final DataSource ds = Initializer.getDataSource();
assertNotNull(ds, "Cannot find the data source.");
try (Connection c = ds.getConnection()) {
- assertEquals("jdbc:derby:classpath:SIS_DATA/Databases/" +
EmbeddedResources.EMBEDDED_DATABASE, c.getMetaData().getURL(), "URL");
+ assertEquals("jdbc:derby:classpath:" + EmbeddedResources.DIRECTORY
+ "/Databases/" + Initializer.DATABASE, c.getMetaData().getURL(), "URL");
try (Statement s = c.createStatement()) {
try (ResultSet r = s.executeQuery("SELECT COORD_REF_SYS_NAME
FROM EPSG.\"Coordinate Reference System\" WHERE COORD_REF_SYS_CODE = 4326")) {
assertTrue(r.next(), "ResultSet.next()");
diff --git
a/optional/src/org.apache.sis.referencing.database/test/org/apache/sis/resources/embedded/Generator.java
b/optional/src/org.apache.sis.referencing.database/test/org/apache/sis/resources/embedded/Generator.java
index f0382b4d20..68bfc2e0b6 100644
---
a/optional/src/org.apache.sis.referencing.database/test/org/apache/sis/resources/embedded/Generator.java
+++
b/optional/src/org.apache.sis.referencing.database/test/org/apache/sis/resources/embedded/Generator.java
@@ -66,8 +66,8 @@ final class Generator extends ScriptProvider {
/**
* Provides a connection to the "SpatialMetadata" database, or {@code
null} if the database already exists.
- * The connection <abbr>URL</abbr> references the
<code>SIS_DATA/Databases/{@value EmbeddedResources#EMBEDDED_DATABASE}</code>
- * directory in the Maven {@code target/classes} directory.
+ * The connection <abbr>URL</abbr> references the following directory in
the compilation output directory:
+ * <code>{@value EmbeddedResources#DIRECTORY}/Databases/{@value
Initializer#DATABASE}</code>
*/
private final EmbeddedDataSource dataSource;
@@ -93,7 +93,7 @@ final class Generator extends ScriptProvider {
target = Files.createDirectory(target.resolve(Path.of("Databases")));
dataSource = new EmbeddedDataSource();
dataSource.setDataSourceName(Initializer.DATABASE);
-
dataSource.setDatabaseName(target.resolve(EmbeddedResources.EMBEDDED_DATABASE).toString());
+
dataSource.setDatabaseName(target.resolve(Initializer.DATABASE).toString());
dataSource.setCreateDatabase("create");
sourceEPSG = directoryOf(ScriptProvider.class);
}
diff --git
a/optional/src/org.apache.sis.referencing.epsg/test/org/apache/sis/referencing/factory/sql/epsg/DataScriptUpdater.java
b/optional/src/org.apache.sis.referencing.epsg/test/org/apache/sis/referencing/factory/sql/epsg/DataScriptUpdater.java
index 551bf54de0..1b899e3a1a 100644
---
a/optional/src/org.apache.sis.referencing.epsg/test/org/apache/sis/referencing/factory/sql/epsg/DataScriptUpdater.java
+++
b/optional/src/org.apache.sis.referencing.epsg/test/org/apache/sis/referencing/factory/sql/epsg/DataScriptUpdater.java
@@ -96,6 +96,9 @@ public final class DataScriptUpdater {
formatter.addAccentedCharacters("Réseau Géodésique des Terres
Australes et Antarctiques Françaises");
formatter.addAccentedCharacters("Réseau National Belge");
formatter.addAccentedCharacters("Posiciones Geodésicas
Argentinas");
+ /*
+ * Generate the script for EPSG data.
+ */
formatter.run(Path.of(arguments[0]), Path.of(arguments[1]));
formatter.printSpellingChangeCount(System.out);
}
diff --git a/parent/sis.css b/parent/sis.css
index 7514090095..deb1183af2 100644
--- a/parent/sis.css
+++ b/parent/sis.css
@@ -139,7 +139,6 @@ div.note {
margin-right: 40px;
margin-top: 9px;
margin-bottom: 9px;
- text-align: justify;
}
div.note:before {
@@ -197,7 +196,6 @@ div.block ul.verbose > li,
div.block ol.verbose > li {
margin-top: 9px;
margin-bottom: 9px;
- text-align: justify;
}
/*
@@ -256,7 +254,3 @@ td > pre.code-sample {
span.deprecated {
text-decoration: line-through;
}
-
-:not(td) > div.block {
- text-align: justify;
-}