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 19b59af Provides a Widget base class for making easier to locate SIS widgets.
19b59af is described below
commit 19b59afcde2b5391c930ed3f0e1bacbcb9feef08
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Sun Apr 12 13:08:56 2020 +0200
Provides a Widget base class for making easier to locate SIS widgets.
---
.../src/main/java/org/apache/sis/gui/Widget.java | 57 ++++++++++++++++++++++
.../apache/sis/gui/coverage/CoverageExplorer.java | 4 +-
.../org/apache/sis/gui/dataset/WindowManager.java | 9 +---
.../apache/sis/gui/metadata/MetadataSummary.java | 4 +-
4 files changed, 65 insertions(+), 9 deletions(-)
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/Widget.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/Widget.java
new file mode 100644
index 0000000..3c18bc5
--- /dev/null
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/Widget.java
@@ -0,0 +1,57 @@
+/*
+ * 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;
+
+import javafx.scene.layout.Region;
+
+
+/**
+ * Base class of user interfaces provided by Apache SIS.
+ * This base class is used for components that encapsulate JavaFX controls instead than extending
them.
+ * We use this indirection level for hiding implementation details such as the exact JavaFX
classes used
+ * for implementing the widget.
+ *
+ * <h2>Other controls</h2>
+ * Not all Apache SIS widgets extent this class.
+ * Other widgets extending directly a JavaFX control or other classes are
+ * {@link org.apache.sis.gui.metadata.MetadataTree},
+ * {@link org.apache.sis.gui.dataset.ResourceTree},
+ * {@link org.apache.sis.gui.dataset.FeatureTable},
+ * {@link org.apache.sis.gui.coverage.GridView},
+ * {@link org.apache.sis.gui.referencing.CRSChooser} and
+ * {@link org.apache.sis.gui.map.MapCanvas}.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.1
+ * @since 1.1
+ * @module
+ */
+public abstract class Widget {
+ /**
+ * Creates a new widget.
+ */
+ protected Widget() {
+ }
+
+ /**
+ * Returns the encapsulated JavaFX component to add in a scene graph for making the widget
visible.
+ * The {@code Region} subclass is implementation dependent and may change in any future
SIS version.
+ *
+ * @return the JavaFX component to insert in a scene graph.
+ */
+ public abstract Region getView();
+}
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageExplorer.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageExplorer.java
index b824b44..8d0bb38 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageExplorer.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageExplorer.java
@@ -31,6 +31,7 @@ import org.apache.sis.internal.gui.Resources;
import org.apache.sis.internal.gui.Styles;
import org.apache.sis.internal.gui.ToolbarButton;
import org.apache.sis.util.resources.Vocabulary;
+import org.apache.sis.gui.Widget;
/**
@@ -42,7 +43,7 @@ import org.apache.sis.util.resources.Vocabulary;
* @since 1.1
* @module
*/
-public class CoverageExplorer {
+public class CoverageExplorer extends Widget {
/**
* Index in the {@link #views} array for the {@link GridView} (tabular data)
* or the {@link CoverageView} (image).
@@ -149,6 +150,7 @@ public class CoverageExplorer {
*
* @return the region to show.
*/
+ @Override
public final Region getView() {
return content;
}
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/WindowManager.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/WindowManager.java
index c83c666..bb9f6c5 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/WindowManager.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/WindowManager.java
@@ -21,12 +21,12 @@ import java.util.ArrayList;
import javafx.collections.ObservableList;
import javafx.stage.Stage;
import javafx.event.ActionEvent;
-import javafx.scene.layout.Region;
import javafx.scene.control.MenuItem;
import javafx.scene.control.SeparatorMenuItem;
import javafx.beans.property.ReadOnlyBooleanProperty;
import javafx.beans.property.ReadOnlyBooleanPropertyBase;
import org.apache.sis.internal.gui.Resources;
+import org.apache.sis.gui.Widget;
/**
@@ -37,7 +37,7 @@ import org.apache.sis.internal.gui.Resources;
* @since 1.1
* @module
*/
-abstract class WindowManager {
+abstract class WindowManager extends Widget {
/**
* The contextual menu items for creating a new window showing selected data.
* All menus in this list will be enabled or disabled depending on whether there is data
to show.
@@ -94,11 +94,6 @@ abstract class WindowManager {
abstract Resources localized();
/**
- * Returns the control shown in the main window.
- */
- abstract Region getView();
-
- /**
* Creates a menu item for creating new windows for the currently selected resource.
* The new menu item is initially disabled. Its will become enabled automatically when
* a resource is selected.
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/MetadataSummary.java
b/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/MetadataSummary.java
index c74a539..742b809 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/MetadataSummary.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/MetadataSummary.java
@@ -49,6 +49,7 @@ import org.apache.sis.storage.Resource;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.collection.TreeTable;
import org.apache.sis.util.iso.Types;
+import org.apache.sis.gui.Widget;
/**
@@ -61,7 +62,7 @@ import org.apache.sis.util.iso.Types;
* @module
*/
@DefaultProperty("metadata")
-public class MetadataSummary {
+public class MetadataSummary extends Widget {
/**
* Titles panes for different metadata sections (identification info, spatial information,
<i>etc</i>).
* This is similar to {@link javafx.scene.control.Accordion} except that we allow an
arbitrary amount
@@ -165,6 +166,7 @@ public class MetadataSummary {
*
* @return the region to show.
*/
+ @Override
public final Region getView() {
return content;
}
|