sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 03/05: Move MetadataOverview back to its own package. The intent is to make easier to split the sections in separated classes.
Date Sun, 03 Nov 2019 22:51:29 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 7cd909e26036e213c5f9c43d0945ac7469cd38cf
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Sun Nov 3 22:38:24 2019 +0100

    Move MetadataOverview back to its own package. The intent is to make easier to split the
sections in separated classes.
---
 .../apache/sis/gui/dataset/ResourceExplorer.java   |  4 +++-
 .../{dataset => metadata}/MetadataOverview.java    | 20 +++++++++-------
 .../MetadataTree.java}                             |  8 +++----
 .../MetadataSection.java => metadata/Section.java} |  6 ++---
 .../org/apache/sis/gui/metadata/package-info.java  | 28 ++++++++++++++++++++++
 5 files changed, 50 insertions(+), 16 deletions(-)

diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceExplorer.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceExplorer.java
index 49b874d..8f8d515 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceExplorer.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceExplorer.java
@@ -16,12 +16,14 @@
  */
 package org.apache.sis.gui.dataset;
 
+import java.util.Locale;
 import java.util.Collection;
 import javafx.collections.ListChangeListener;
 import javafx.scene.layout.Region;
 import javafx.scene.control.SplitPane;
 import javafx.scene.control.TreeItem;
 import org.apache.sis.storage.Resource;
+import org.apache.sis.gui.metadata.MetadataOverview;
 
 
 /**
@@ -55,7 +57,7 @@ public class ResourceExplorer {
      */
     public ResourceExplorer() {
         resources = new ResourceTree();
-        metadata  = new MetadataOverview(resources.getLocale());
+        metadata  = new MetadataOverview(resources.getLocale(), Locale.getDefault(Locale.Category.FORMAT));
         pane      = new SplitPane();
         pane.getItems().setAll(resources, metadata.getView());
         resources.getSelectionModel().getSelectedItems().addListener(this::selectResource);
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/MetadataOverview.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/MetadataOverview.java
similarity index 97%
rename from application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/MetadataOverview.java
rename to application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/MetadataOverview.java
index dcd29a6..ba43613 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/MetadataOverview.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/MetadataOverview.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sis.gui.dataset;
+package org.apache.sis.gui.metadata;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -85,7 +85,7 @@ import static org.apache.sis.internal.util.CollectionsExt.nonNull;
  * @since   1.1
  * @module
  */
-final class MetadataOverview {
+public class MetadataOverview {
     /**
      * Minimal size of rectangles to be drawn by {@link IdentificationInfo#drawOnMap(GeographicBoundingBox)}.
      * If a rectangle is smaller, it will be expanded to this size. We use a minimal size
because otherwise
@@ -160,10 +160,14 @@ final class MetadataOverview {
 
     /**
      * Creates an initially empty metadata overview.
+     *
+     * @param  textLocale  the locale for the text.
+     * @param  dataLocale  the locale for formatting numbers and dates.
+     *                     This is often the same than {@code textLocale}.
      */
-    MetadataOverview(final Locale locale) {
-        localized    = Resources.forLocale(locale);
-        formatLocale = Locale.getDefault(Locale.Category.FORMAT);
+    public MetadataOverview(final Locale textLocale, final Locale dataLocale) {
+        localized    = Resources.forLocale(textLocale);
+        formatLocale = dataLocale;
         information  = new TitledPane[] {
             new TitledPane(localized.getString(Resources.Keys.ResourceIdentification), new
IdentificationInfo(this)),
             new TitledPane(localized.getString(Resources.Keys.SpatialRepresentation),  new
RepresentationInfo(this))
@@ -265,7 +269,7 @@ final class MetadataOverview {
          */
         int i = 0;
         for (TitledPane pane : information) {
-            final MetadataSection<?> info = (MetadataSection<?>) pane.getContent();
+            final Section<?> info = (Section<?>) pane.getContent();
             info.setInformation(metadata);
             final boolean isEmpty   = info.isEmpty();
             final boolean isPresent = (i < children.size()) && children.get(i)
== pane;
@@ -288,7 +292,7 @@ final class MetadataOverview {
      * The same pane can be used for an arbitrary amount of identifications.
      * Each instance is identified by its title.
      */
-    private static final class IdentificationInfo extends MetadataSection<Identification>
{
+    private static final class IdentificationInfo extends Section<Identification> {
         /**
          * The resource title, or if non the identifier as a fallback.
          */
@@ -577,7 +581,7 @@ final class MetadataOverview {
      * The pane where to show the values of {@link SpatialRepresentation} objects.
      * The same pane can be used for an arbitrary amount of spatial representations.
      */
-    private static final class RepresentationInfo extends MetadataSection<SpatialRepresentation>
{
+    private static final class RepresentationInfo extends Section<SpatialRepresentation>
{
         /**
          * The reference system, or {@code null} if none.
          */
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/MetadataNode.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/MetadataTree.java
similarity index 98%
rename from application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/MetadataNode.java
rename to application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/MetadataTree.java
index 09e185e..d6db49c 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/MetadataNode.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/MetadataTree.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sis.gui.dataset;
+package org.apache.sis.gui.metadata;
 
 import java.util.Collection;
 import java.util.Comparator;
@@ -36,7 +36,7 @@ import org.opengis.referencing.ReferenceSystem;
  *
  * @author Siddhesh Rane
  */
-final class MetadataNode extends TreeTableView<TreeTable.Node> {
+final class MetadataTree extends TreeTableView<TreeTable.Node> {
 
     private static final Predicate<TreeTable.Node> HIDE_EMPTY_LEAF = t -> !t.isLeaf()
|| t.getValue(TableColumn.VALUE) != null;
     private static final Predicate<TreeTable.Node> EXPAND_SINGLE_CHILD = node ->
node.getChildren().size() == 1 || node.getParent() == null;
@@ -118,12 +118,12 @@ final class MetadataNode extends TreeTableView<TreeTable.Node>
{
         return order.get();
     }
 
-    MetadataNode(TreeTable treeTable) {
+    MetadataTree(TreeTable treeTable) {
         this();
         setTreeTable(treeTable);
     }
 
-    private MetadataNode() {
+    private MetadataTree() {
         createTableColumns();
         setShowRoot(false);
         setColumnResizePolicy(CONSTRAINED_RESIZE_POLICY);
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/MetadataSection.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/Section.java
similarity index 98%
rename from application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/MetadataSection.java
rename to application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/Section.java
index a44070b..dd80c9e 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/MetadataSection.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/Section.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sis.gui.dataset;
+package org.apache.sis.gui.metadata;
 
 import java.text.NumberFormat;
 import java.util.Collection;
@@ -53,7 +53,7 @@ import org.apache.sis.util.ArraysExt;
  * @since 1.1
  * @module
  */
-abstract class MetadataSection<T> extends GridPane implements EventHandler<ActionEvent>
{
+abstract class Section<T> extends GridPane implements EventHandler<ActionEvent>
{
     /**
      * Margin to keep around all forms.
      */
@@ -110,7 +110,7 @@ abstract class MetadataSection<T> extends GridPane implements EventHandler<Actio
     /**
      * Creates a new section.
      */
-    MetadataSection(final MetadataOverview owner) {
+    Section(final MetadataOverview owner) {
         this.owner = owner;
         pageGroup  = new ToggleGroup();
         pagination = new TilePane(Orientation.VERTICAL);
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/package-info.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/package-info.java
new file mode 100644
index 0000000..ff35e56
--- /dev/null
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/package-info.java
@@ -0,0 +1,28 @@
+/*
+ * 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 metadata.
+ *
+ * @author  Smaniotto Enzo
+ * @author  Johann Sorel (Geomatys)
+ * @author  Martin Desruisseaux (Geomatys)
+ * @version 1.1
+ * @since   1.1
+ * @module
+ */
+package org.apache.sis.gui.metadata;


Mime
View raw message