sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 02/02: Begin refactoring of CRSChooser.
Date Sat, 09 Nov 2019 17:10:42 GMT
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

commit 6a6a650b667fae57b441aae42d6072826cf15669
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Sat Nov 9 18:10:17 2019 +0100

    Begin refactoring of CRSChooser.
---
 application/sis-javafx/pom.xml                     |   2 +-
 .../org/apache/sis/gui/referencing/CRSChooser.java | 203 ++++++++++------
 .../org/apache/sis/gui/referencing/CRSTable.java   | 260 ---------------------
 .../java/org/apache/sis/gui/referencing/Code.java  |  56 ++---
 .../apache/sis/gui/referencing/package-info.java   |  27 +++
 .../org/apache/sis/gui/referencing/CRSChooser.fxml |  30 ---
 6 files changed, 190 insertions(+), 388 deletions(-)

diff --git a/application/sis-javafx/pom.xml b/application/sis-javafx/pom.xml
index 082b07a..b019d9b 100644
--- a/application/sis-javafx/pom.xml
+++ b/application/sis-javafx/pom.xml
@@ -95,7 +95,7 @@
           <release>13</release>
           <compilerArgs>
             <arg>--module-path</arg> <arg>${env.PATH_TO_FX}</arg>
-            <arg>--add-modules</arg> <arg>javafx.graphics,javafx.controls,javafx.fxml,javafx.swing</arg>
+            <arg>--add-modules</arg> <arg>javafx.graphics,javafx.controls</arg>
           </compilerArgs>
         </configuration>
       </plugin>
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/CRSChooser.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/CRSChooser.java
index 3a729ff..765f837 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/CRSChooser.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/CRSChooser.java
@@ -16,22 +16,28 @@
  */
 package org.apache.sis.gui.referencing;
 
-import java.io.IOException;
-import java.io.UncheckedIOException;
-import javafx.beans.property.ObjectProperty;
+import java.util.Set;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Locale;
 import javafx.beans.property.SimpleObjectProperty;
-import javafx.beans.value.ObservableValue;
-import javafx.fxml.FXML;
-import javafx.fxml.FXMLLoader;
-import javafx.scene.Parent;
+import javafx.collections.FXCollections;
+import javafx.concurrent.Task;
 import javafx.scene.control.Alert;
 import javafx.scene.control.ButtonType;
 import javafx.scene.control.DialogPane;
+import javafx.scene.control.Label;
+import javafx.scene.control.ProgressIndicator;
+import javafx.scene.control.TableColumn;
+import javafx.scene.control.TableView;
 import javafx.scene.control.TextField;
 import javafx.scene.input.KeyEvent;
 import javafx.scene.layout.BorderPane;
+import org.opengis.referencing.crs.CRSAuthorityFactory;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
-import org.apache.sis.internal.gui.Resources;
+import org.apache.sis.internal.gui.BackgroundThreads;
+import org.apache.sis.util.resources.Vocabulary;
+import org.apache.sis.referencing.CRS;
 
 
 /**
@@ -39,84 +45,141 @@ import org.apache.sis.internal.gui.Resources;
  *
  * @author  Johann Sorel (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.0
- * @since   1.0
+ * @version 1.1
+ * @since   1.1
  * @module
  */
-public class CRSChooser extends BorderPane {
-
-    @FXML
-    private BorderPane uiPane;
+public class CRSChooser {
+    /**
+     * The preferred locale of CRS descriptions.
+     */
+    private final Locale locale;
 
-    @FXML
-    private TextField uiSearch;
+    /**
+     * The pane where the controls for this CRS chooser will be put.
+     */
+    final BorderPane content;
 
-    private CRSTable uiTable;
+    /**
+     * The text field where user can enter a fragment of the name of the CRS (s)he is looking
for.
+     */
+    private final TextField searchField;
 
-    private final ObjectProperty<CoordinateReferenceSystem> crsProperty = new SimpleObjectProperty<>();
-    private boolean updateText;
+    /**
+     * The table showing CRS names together with their codes.
+     */
+    private final TableView<Code> table;
 
     /**
-     * Create a new CRSChooser with no {@link CoordinateReferenceSystem} defined.
+     * Creates chooser proposing all coordinate reference systems from the given factory.
+     *
+     * @param  factory  the factory to use for creating coordinate reference systems, or
{@code null}
+     *                  for the {@linkplain CRS#getAuthorityFactory(String) Apache SIS default
factory}.
      */
-    public CRSChooser() {
-        try {
-            loadJRXML(this, CRSChooser.class);
-        } catch (IOException e) {
-            throw new UncheckedIOException(e);
-        }
-        uiSearch.addEventHandler(KeyEvent.KEY_PRESSED, (KeyEvent event) -> {
-            if (!updateText) {
-                uiTable.searchCRS(uiSearch.getText());
-            }
+    public CRSChooser(final CRSAuthorityFactory factory) {
+        locale = Locale.getDefault();
+        table  = new TableView<>();
+        /*
+         * Loading of all CRS codes may take about one second.
+         * Following put an animation will the CRS are loading.
+         *
+         * TODO: use deferred loading instead.
+         */
+        final ProgressIndicator loading = new ProgressIndicator();
+        loading.setMaxWidth(60);
+        loading.setMaxHeight(60);
+        loading.setProgress(-1);
+        table.setPlaceholder(loading);
+
+        final Vocabulary vocabulary = Vocabulary.getResources(locale);
+        final TableColumn<Code,String> names = new TableColumn<>(vocabulary.getString(Vocabulary.Keys.Name));
+        final TableColumn<Code,String> codes = new TableColumn<>(vocabulary.getString(Vocabulary.Keys.Code));
+        codes.setPrefWidth(150);
+        codes.setCellValueFactory((TableColumn.CellDataFeatures<Code,String> p) ->
new SimpleObjectProperty<>(p.getValue().code));
+        names.setCellValueFactory((TableColumn.CellDataFeatures<Code,String> p) ->
new SimpleObjectProperty<>(p.getValue().name(locale)));
+
+        table.getColumns().setAll(names, codes);
+        table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
+        table.setTableMenuButtonVisible(false);
+
+        content = new BorderPane();
+        searchField = new TextField();
+        searchField.addEventHandler(KeyEvent.KEY_PRESSED, (KeyEvent event) -> {
+            searchCRS(searchField.getText());
         });
+        content.setCenter(table);
+
+        BackgroundThreads.execute(new Loader(factory));
+    }
 
-        uiTable = new CRSTable();
-        uiPane.setCenter(uiTable);
+    private final class Loader extends Task<List<Code>> {
+        private CRSAuthorityFactory factory;
 
-        uiTable.crsProperty().bindBidirectional(crsProperty);
+        Loader(final CRSAuthorityFactory factory) {
+            this.factory = factory;
+        }
 
-        crsProperty.addListener((ObservableValue<? extends CoordinateReferenceSystem>
observable,
-                              CoordinateReferenceSystem oldValue, CoordinateReferenceSystem
newValue) -> {
-            uiTable.crsProperty().set(newValue);
-            if (newValue != null) {
-                updateText = true;
-                uiSearch.setText(newValue.getName().toString());
-                updateText = false;
+        @Override
+        protected List<Code> call() throws Exception {
+            if (factory == null) {
+                factory = CRS.getAuthorityFactory(null);
             }
-        });
+            final Set<String> strs = factory.getAuthorityCodes(CoordinateReferenceSystem.class);
+            final List<Code> codes = new ArrayList<>();
+            for (final String code : strs) {
+                codes.add(new Code(factory, code));
+            }
+            return codes;
+        }
+
+        @Override
+        protected void succeeded() {
+            table.setItems(FXCollections.observableArrayList(getValue()));
+            table.setPlaceholder(new Label(""));
+        }
+
+        @Override
+        protected void failed() {
+            error(getException());
+        }
     }
 
-    /**
-     * Loads and initializes widget from JRXML definition provided in this module.
-     * The JRXML file shall be in the same package than the given {@code loader} class
-     * and have the same simple name followed by the {@code ".fxml"} extension.
-     *
-     * @param  target  the widget for which to load the JRXML file.
-     * @param  loader  the class to use for loading the file.
-     * @throws IOException if an error occurred while loading the JRXML file.
-     */
-    private static void loadJRXML(final Parent target, final Class<?> loader) throws
IOException {
-        final FXMLLoader fxl = new FXMLLoader(loader.getResource(loader.getSimpleName() +
".fxml"), Resources.getInstance());
-        fxl.setRoot(target);
-        fxl.setController(target);
-        /*
-         * In some environements like OSGi, we must use the class loader of the widget
-         * (not the class loader of FXMLLoader).
-         */
-        fxl.setClassLoader(loader.getClassLoader());
-        fxl.load();
+    public void searchCRS(final String searchword){
+        filter(searchword);
+    }
+
+    private static void error(final Throwable e) {
+        // TODO
     }
 
     /**
-     * Returns the property containing the edited {@link CoordinateReferenceSystem}.
-     * This property can be modified and will send events.
-     * It can be used with JavaFx binding operations.
+     * Display only the CRS name that contains the specified keywords. The {@code keywords}
+     * argument is a space-separated list, usually provided by the user after he pressed
the
+     * "Search" button.
      *
-     * @return Property containing the edited {@link CoordinateReferenceSystem}
+     * @param keywords space-separated list of keywords to look for.
      */
-    public ObjectProperty<CoordinateReferenceSystem> crsProperty(){
-        return crsProperty;
+    private void filter(String keywords) {
+        final List<Code> allValues = table.getItems();
+        List<Code> model = allValues;
+        if (keywords != null) {
+            keywords = keywords.toLowerCase(locale).trim();
+            final String[] tokens = keywords.split("\\s+");
+            if (tokens.length != 0) {
+                model = new ArrayList<>();
+                scan:
+                for (Code code : allValues) {
+                    final String name = code.toString().toLowerCase(locale);
+                    for (int j=0; j<tokens.length; j++) {
+                        if (!name.contains(tokens[j])) {
+                            continue scan;
+                        }
+                    }
+                    model.add(code);
+                }
+            }
+        }
+        table.getItems().setAll(model);
     }
 
     /**
@@ -127,14 +190,14 @@ public class CRSChooser extends BorderPane {
      * @return modified {@link CoordinateReferenceSystem}.
      */
     public static CoordinateReferenceSystem showDialog(Object parent, CoordinateReferenceSystem
crs) {
-        final CRSChooser chooser = new CRSChooser();
-        chooser.crsProperty.set(crs);
+        final CRSChooser chooser = new CRSChooser(null);
+//        chooser.crsProperty.set(crs);
         final Alert alert = new Alert(Alert.AlertType.NONE);
         final DialogPane pane = alert.getDialogPane();
-        pane.setContent(chooser);
+        pane.setContent(chooser.content);
         alert.getButtonTypes().setAll(ButtonType.OK,ButtonType.CANCEL);
         alert.setResizable(true);
         final ButtonType res = alert.showAndWait().orElse(ButtonType.CANCEL);
-        return res == ButtonType.CANCEL ? null : chooser.crsProperty.get();
+        return null;//res == ButtonType.CANCEL ? null : chooser.crsProperty.get();
     }
 }
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/CRSTable.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/CRSTable.java
deleted file mode 100644
index 5837339..0000000
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/CRSTable.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.sis.gui.referencing;
-
-import java.awt.Color;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Locale;
-import java.util.Set;
-import javafx.application.Platform;
-import javafx.beans.property.ObjectProperty;
-import javafx.beans.property.SimpleObjectProperty;
-import javafx.collections.FXCollections;
-import javafx.collections.ListChangeListener;
-import javafx.collections.ObservableList;
-import javafx.event.EventHandler;
-import javafx.geometry.Insets;
-import javafx.scene.control.Label;
-import javafx.scene.control.ProgressIndicator;
-import javafx.scene.control.ScrollPane;
-import javafx.scene.control.SelectionMode;
-import javafx.scene.control.TableCell;
-import javafx.scene.control.TableColumn;
-import javafx.scene.control.TablePosition;
-import javafx.scene.control.TableView;
-import javafx.scene.input.MouseEvent;
-import javafx.scene.layout.Background;
-import javafx.scene.layout.BackgroundFill;
-import javafx.scene.layout.CornerRadii;
-import javafx.util.Callback;
-import org.apache.sis.io.wkt.FormattableObject;
-import org.apache.sis.metadata.iso.citation.Citations;
-import org.apache.sis.util.resources.Vocabulary;
-import org.opengis.referencing.IdentifiedObject;
-import org.opengis.referencing.crs.CRSAuthorityFactory;
-import org.opengis.referencing.crs.CoordinateReferenceSystem;
-import org.opengis.util.FactoryException;
-
-/**
- *
- * @author  Johann Sorel (Geomatys)
- * @version 1.0
- * @since   1.0
- * @module
- */
-final class CRSTable extends ScrollPane {
-
-    private static final Color COLOR = new Color(30, 150, 250);
-
-    private final ObjectProperty<CoordinateReferenceSystem> crsProperty = new SimpleObjectProperty<>();
-    private final TableView<Code> uiTable = new TableView<>();
-
-    private List<Code> allValues;
-
-    public CRSTable(){
-        uiTable.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
-        setContent(uiTable);
-        setFitToHeight(true);
-        setFitToWidth(true);
-
-        //add a loader while we load datas
-        final ProgressIndicator loading = new ProgressIndicator();
-        loading.setMaxWidth(60);
-        loading.setMaxHeight(60);
-        loading.setBackground(new Background(new BackgroundFill(new javafx.scene.paint.Color(0,
0, 0, 0), CornerRadii.EMPTY, Insets.EMPTY)));
-        loading.setProgress(-1);
-        uiTable.setPlaceholder(loading);
-        uiTable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
-        uiTable.setTableMenuButtonVisible(false);
-
-        uiTable.getSelectionModel().getSelectedCells().addListener(new ListChangeListener<TablePosition>()
{
-            @Override
-            public void onChanged(ListChangeListener.Change<? extends TablePosition>
c) {
-                final ObservableList<TablePosition> cells = uiTable.getSelectionModel().getSelectedCells();
-                if (!cells.isEmpty()) {
-                    final TablePosition cell = cells.get(0);
-                    final Code code = uiTable.getItems().get(cell.getRow());
-                    try {
-                        crsProperty.set((CoordinateReferenceSystem) code.createObject());
-                    } catch (FactoryException ex) {
-                        error(ex);
-                    }
-                }
-            }
-        });
-
-        uiTable.getColumns().add(new TypeColumn());
-        uiTable.getColumns().add(new CodeColumn());
-        uiTable.getColumns().add(new DescColumn());
-        uiTable.getColumns().add(new WKTColumn());
-
-
-        //load list
-        new Thread(){
-            @Override
-            public void run() {
-                try {
-                    allValues = getCodes();
-                    Platform.runLater(() -> {
-                        uiTable.setItems(FXCollections.observableArrayList(allValues));
-                        uiTable.setPlaceholder(new Label(""));
-                    });
-                } catch (FactoryException ex) {
-                    error(ex);
-                }
-            }
-        }.start();
-    }
-
-    public ObjectProperty<CoordinateReferenceSystem> crsProperty(){
-        return crsProperty;
-    }
-
-    public void searchCRS(final String searchword){
-        filter(searchword);
-    }
-
-    private static void error(final Exception e) {
-        // TODO
-    }
-
-    /**
-     * Display only the CRS name that contains the specified keywords. The {@code keywords}
-     * argument is a space-separated list, usually provided by the user after he pressed
the
-     * "Search" button.
-     *
-     * @param keywords space-separated list of keywords to look for.
-     */
-    private void filter(String keywords) {
-        List<Code> model = allValues;
-        if (keywords != null) {
-            final Locale locale = Locale.getDefault();
-            keywords = keywords.toLowerCase(locale).trim();
-            final String[] tokens = keywords.split("\\s+");
-            if (tokens.length != 0) {
-                model = new ArrayList<>();
-                scan:
-                for (Code code : allValues) {
-                    final String name = code.toString().toLowerCase(locale);
-                    for (int j=0; j<tokens.length; j++) {
-                        if (!name.contains(tokens[j])) {
-                            continue scan;
-                        }
-                    }
-                    model.add(code);
-                }
-            }
-        }
-        uiTable.getItems().setAll(model);
-    }
-
-    /**
-     * Returns a collection containing only the factories of the specified authority.
-     */
-    private static Collection<CRSAuthorityFactory> filter(
-            final Collection<? extends CRSAuthorityFactory> factories, final String
authority){
-        final List<CRSAuthorityFactory> filtered = new ArrayList<>();
-        for (final CRSAuthorityFactory factory : factories) {
-            if (Citations.identifierMatches(factory.getAuthority(), authority)) {
-                filtered.add(factory);
-            }
-        }
-        return filtered;
-    }
-
-    private List<Code> getCodes() throws FactoryException{
-        final CRSAuthorityFactory factory = org.apache.sis.referencing.CRS.getAuthorityFactory(null);
-        final Set<String> strs = factory.getAuthorityCodes(CoordinateReferenceSystem.class);
-        final List<Code> codes = new ArrayList<>();
-        for (String str : strs) {
-            codes.add(new Code(factory, str));
-        }
-        return codes;
-    }
-
-    private static class TypeColumn extends TableColumn<Code, Code> {
-
-        public TypeColumn() {
-            setEditable(false);
-            setPrefWidth(30);
-            setMinWidth(30);
-            setMaxWidth(30);
-            setCellValueFactory((CellDataFeatures<Code, Code> param) -> new SimpleObjectProperty<>(param.getValue()));
-        }
-    }
-
-    private static class CodeColumn extends TableColumn<Code, String> {
-
-        public CodeColumn() {
-            super(Vocabulary.format(Vocabulary.Keys.Code));
-            setEditable(false);
-            setPrefWidth(150);
-            setCellValueFactory((TableColumn.CellDataFeatures<Code, String> param)
-> new SimpleObjectProperty<>(param.getValue().code));
-        }
-
-    }
-
-    private static class DescColumn extends TableColumn<Code, String> {
-
-        public DescColumn() {
-            super(Vocabulary.format(Vocabulary.Keys.Description));
-            setEditable(false);
-            setCellValueFactory((TableColumn.CellDataFeatures<Code, String> param)
->
-                    new SimpleObjectProperty<>(param.getValue().getDescription()));
-        }
-
-    }
-
-    private static class WKTColumn extends TableColumn<Code, Code> {
-        public WKTColumn() {
-            super("");
-            setEditable(false);
-            setPrefWidth(26);
-            setMinWidth(26);
-            setMaxWidth(26);
-            setCellValueFactory((CellDataFeatures<Code, Code> param) -> new SimpleObjectProperty<>(param.getValue()));
-            setCellFactory(new Callback<TableColumn<Code, Code>, TableCell<Code,
Code>>() {
-
-                @Override
-                public TableCell<Code, Code> call(TableColumn<Code, Code> param)
{
-                    return new TableCell<Code,Code>() {
-                        {
-                            setOnMouseClicked(new EventHandler<MouseEvent>() {
-                                @Override
-                                public void handle(MouseEvent event) {
-                                    final Code item = getItem();
-                                    if (item!=null) {
-                                        try {
-                                            final IdentifiedObject obj = getItem().createObject();
-                                            if (obj instanceof FormattableObject) {
-                                                WKTPane.showDialog(this, (FormattableObject)
obj);
-                                            }
-                                        } catch (FactoryException ex) {
-                                            error(ex);
-                                        }
-                                    }
-                                }
-                            });
-                        }
-                    };
-                }
-            });
-        }
-    }
-}
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/Code.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/Code.java
index 59676d3..67bc212 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/Code.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/Code.java
@@ -16,9 +16,11 @@
  */
 package org.apache.sis.gui.referencing;
 
-import org.opengis.referencing.AuthorityFactory;
-import org.opengis.referencing.IdentifiedObject;
+import java.util.Locale;
 import org.opengis.util.FactoryException;
+import org.opengis.referencing.crs.CRSAuthorityFactory;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.apache.sis.util.Exceptions;
 
 
 /**
@@ -27,8 +29,8 @@ import org.opengis.util.FactoryException;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Johann Sorel (Geomatys)
- * @version 1.0
- * @since   1.0
+ * @version 1.1
+ * @since   1.1
  * @module
  */
 final class Code {
@@ -38,52 +40,52 @@ final class Code {
     final String code;
 
     /**
-     * The CRS object description for the {@linkplain #code}, fetched when first needed.
+     * The CRS object name for the {@linkplain #code}, fetched when first needed.
      * In Apache SIS implementation of EPSG factory, this is the CRS name.
      */
     private String name;
 
     /**
-     * The authority factory to use for fetching the name. Will be set to {@code null} after
-     * {@linkplain #name} has been made available, in order to allow the garbage collector
-     * to do its work if possible.
+     * The object returned by {@link #crs()}, cached for reuse.
      */
-    private final AuthorityFactory factory;
+    private CoordinateReferenceSystem crs;
+
+    /**
+     * The authority factory to use for fetching the name.
+     */
+    private final CRSAuthorityFactory factory;
 
     /**
      * Creates a code from the specified value.
      */
-    Code(final AuthorityFactory factory, final String code) {
+    Code(final CRSAuthorityFactory factory, final String code) {
         this.factory = factory;
         this.code    = code;
     }
 
     /**
-     * Create the Object identified by code.
+     * Creates the object identified by code.
      */
-    IdentifiedObject createObject() throws FactoryException{
-        return factory.createObject(code);
+    CoordinateReferenceSystem crs() throws FactoryException {
+        if (crs == null) {
+            crs = factory.createCoordinateReferenceSystem(code);
+        }
+        return crs;
     }
 
     /**
-     * Returns a description of the object.
+     * Returns a description of the object. This method fetches the description when first
needed.
+     * If the operation fails, the exception message will be used as a description.
+     *
+     * @param  locale  the desired locale, or {@code null} for the default locale.
+     * @return the object name in the given locale if possible.
      */
-    public String getDescription() {
+    String name(final Locale locale) {
         if (name == null) try {
-            name = factory.getDescriptionText(code).toString();
+            name = factory.getDescriptionText(code).toString(locale);
         } catch (FactoryException e) {
-            name = e.getLocalizedMessage();
+            name = Exceptions.getLocalizedMessage(e, locale);
         }
         return name;
     }
-
-    /**
-     * Returns the name for this code.
-     *
-     * @todo Maybe we should use the widget Locale when invoking InternationalString.toString(...).
-     */
-    @Override
-    public String toString() {
-        return code + " - " + getDescription();
-    }
 }
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/package-info.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/package-info.java
new file mode 100644
index 0000000..c8566ef
--- /dev/null
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/package-info.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Widgets about coordinate reference systems.
+ *
+ * @author  Johann Sorel (Geomatys)
+ * @author  Martin Desruisseaux (Geomatys)
+ * @version 1.1
+ * @since   1.1
+ * @module
+ */
+package org.apache.sis.gui.referencing;
diff --git a/application/sis-javafx/src/main/resources/org/apache/sis/gui/referencing/CRSChooser.fxml
b/application/sis-javafx/src/main/resources/org/apache/sis/gui/referencing/CRSChooser.fxml
deleted file mode 100644
index 7401b15..0000000
--- a/application/sis-javafx/src/main/resources/org/apache/sis/gui/referencing/CRSChooser.fxml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<?import javafx.geometry.*?>
-<?import java.lang.*?>
-<?import javafx.scene.control.*?>
-<?import javafx.scene.layout.*?>
-
-<fx:root maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity"
minWidth="-Infinity" type="BorderPane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
-  <top>
-    <GridPane hgap="10.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308"
vgap="10.0" BorderPane.alignment="CENTER">
-      <columnConstraints>
-        <ColumnConstraints hgrow="NEVER" />
-        <ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" />
-        <ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="10.0"
prefWidth="100.0" />
-      </columnConstraints>
-      <rowConstraints>
-        <RowConstraints vgrow="NEVER" />
-        <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="NEVER" />
-        <RowConstraints vgrow="NEVER" />
-      </rowConstraints>
-      <children>
-        <Label styleClass="property-key" text="%CRSs" GridPane.rowSpan="2" />
-        <TextField fx:id="uiSearch" GridPane.columnSpan="3" GridPane.rowIndex="2" />
-       </children>
-    </GridPane>
-  </top>
-  <center>
-    <BorderPane fx:id="uiPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308"
BorderPane.alignment="CENTER" />
-  </center>
-</fx:root>


Mime
View raw message