This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits 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 bfc9eed9b6 Replace some usages of `ReadOnlyObjectWrapper` by
`SimpleObjectProperty` in places where the read-only aspect of the property was
not really used.
bfc9eed9b6 is described below
commit bfc9eed9b682544847f4c3e8ae5990528539d5cb
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Fri May 15 22:08:18 2026 +0200
Replace some usages of `ReadOnlyObjectWrapper` by `SimpleObjectProperty`
in places where the read-only aspect of the property was not really used.
---
.../org/apache/sis/gui/coverage/BandRangeTable.java | 6 +++---
.../main/org/apache/sis/gui/dataset/FeatureTable.java | 19 +++++++++----------
.../apache/sis/gui/internal/IdentityValueFactory.java | 4 ++--
.../org/apache/sis/gui/metadata/MetadataTree.java | 7 +++----
4 files changed, 17 insertions(+), 19 deletions(-)
diff --git
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/BandRangeTable.java
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/BandRangeTable.java
index 9f7bde3f69..05f50caf38 100644
---
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/BandRangeTable.java
+++
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/coverage/BandRangeTable.java
@@ -22,7 +22,7 @@ import javafx.scene.control.TableCell;
import javafx.scene.control.TableView;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableColumn.CellDataFeatures;
-import javafx.beans.property.ReadOnlyObjectWrapper;
+import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ObservableValue;
import javafx.geometry.Pos;
import org.opengis.util.GenericName;
@@ -141,7 +141,7 @@ final class BandRangeTable implements
Callback<TableColumn<SampleDimension, Numb
case UNITS: text = sd.getUnits(); break;
default: throw new AssertionError(); // Should not happen.
}
- return
text.map(Object::toString).map(ReadOnlyObjectWrapper::new).orElse(null);
+ return
text.map(Object::toString).map(SimpleObjectProperty::new).orElse(null);
}
/**
@@ -155,6 +155,6 @@ final class BandRangeTable implements
Callback<TableColumn<SampleDimension, Numb
case MAXIMUM: value = range.map(NumberRange::getMaxValue); break;
default: throw new AssertionError(); // Should not happen.
}
- return value.map(ReadOnlyObjectWrapper::new).orElse(null);
+ return value.map(SimpleObjectProperty::new).orElse(null);
}
}
diff --git
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/dataset/FeatureTable.java
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/dataset/FeatureTable.java
index eae6a3e79e..4bb0f17dc1 100644
---
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/dataset/FeatureTable.java
+++
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/dataset/FeatureTable.java
@@ -29,7 +29,6 @@ import javafx.scene.layout.Region;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import javafx.beans.DefaultProperty;
-import javafx.beans.property.ReadOnlyObjectWrapper;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.ObjectProperty;
import javafx.beans.value.ObservableValue;
@@ -276,8 +275,8 @@ public class FeatureTable extends TableView<Feature> {
*/
private void createColumns() {
final Collection<? extends PropertyType> properties =
featureType.getProperties(true);
- final List<TableColumn<Feature,?>> columns = new
ArrayList<>(properties.size());
- final List<String> multiValued = new ArrayList<>(columns.size());
+ final var columns = new ArrayList<TableColumn<Feature,
?>>(properties.size());
+ final var multiValued = new ArrayList<String>(columns.size());
for (final PropertyType pt : properties) {
/*
* Get localized text to show in column header. Also remember
@@ -309,7 +308,7 @@ public class FeatureTable extends TableView<Feature> {
* gives the whole collection. Fetching a particular element in
that collection will
* be ElementCell's work.
*/
- final TableColumn<Feature,Object> column = new
TableColumn<>(title);
+ final var column = new TableColumn<Feature, Object>(title);
column.setCellValueFactory(new ValueGetter(name));
column.setCellFactory(isMultiValued ? ElementCell::new :
ValueCell::new);
if (AttributeConvention.contains(qualifiedName)) {
@@ -326,7 +325,7 @@ public class FeatureTable extends TableView<Feature> {
} else {
final ExpandableList list = getExpandableList();
list.setMultivaluedColumns(multiValued);
- final TableColumn<Feature,Feature> column = new TableColumn<>("▤");
+ final var column = new TableColumn<Feature, Feature>("▤");
column.setCellValueFactory(IdentityValueFactory.instance());
column.setCellFactory(list);
column.setReorderable(false);
@@ -349,7 +348,7 @@ public class FeatureTable extends TableView<Feature> {
* easy way to know the current row number. Fetching a particular element
in that collection will be done by
* {@link ExpandedFeature}.
*/
- private static final class ValueGetter implements
Callback<TableColumn.CellDataFeatures<Feature,Object>, ObservableValue<Object>>
{
+ private static final class ValueGetter implements
Callback<TableColumn.CellDataFeatures<Feature, Object>,
ObservableValue<Object>> {
/**
* The name of the feature property for which to fetch values.
*/
@@ -375,7 +374,7 @@ public class FeatureTable extends TableView<Feature> {
if (feature != null) {
value = feature.getPropertyValue(name);
}
- return new ReadOnlyObjectWrapper<>(value);
+ return new SimpleObjectProperty<>(value);
}
}
@@ -383,13 +382,13 @@ public class FeatureTable extends TableView<Feature> {
* A cell displaying a value in {@link FeatureTable}. This base class
expects single values.
* If the property values are collections, then {@link ElementCell} should
be used instead.
*/
- private static class ValueCell extends TableCell<Feature,Object> {
+ private static class ValueCell extends TableCell<Feature, Object> {
/**
* Creates a new cell for feature property value.
*
* @param column the column where the cell will be shown.
*/
- ValueCell(final TableColumn<Feature,Object> column) {
+ ValueCell(final TableColumn<Feature, Object> column) {
// Column not used at this time, but we need it in method
signature.
}
@@ -431,7 +430,7 @@ public class FeatureTable extends TableView<Feature> {
*
* @param column the column where the cell will be shown.
*/
- ElementCell(final TableColumn<Feature,Object> column) {
+ ElementCell(final TableColumn<Feature, Object> column) {
super(column);
}
diff --git
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/internal/IdentityValueFactory.java
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/internal/IdentityValueFactory.java
index 4dabe6fa3b..6a047eda59 100644
---
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/internal/IdentityValueFactory.java
+++
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/internal/IdentityValueFactory.java
@@ -16,7 +16,7 @@
*/
package org.apache.sis.gui.internal;
-import javafx.beans.property.ReadOnlyObjectWrapper;
+import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ObservableValue;
import javafx.scene.control.TableColumn;
import javafx.util.Callback;
@@ -66,6 +66,6 @@ public final class IdentityValueFactory<S extends T, T>
*/
@Override
public ObservableValue<T> call(final TableColumn.CellDataFeatures<S,T>
cell) {
- return new ReadOnlyObjectWrapper<>(cell.getValue());
+ return new SimpleObjectProperty<>(cell.getValue());
}
}
diff --git
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/metadata/MetadataTree.java
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/metadata/MetadataTree.java
index 6b1481a41d..26b047f14d 100644
---
a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/metadata/MetadataTree.java
+++
b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/metadata/MetadataTree.java
@@ -22,9 +22,8 @@ import java.io.IOException;
import javafx.util.Callback;
import javafx.beans.DefaultProperty;
import javafx.beans.property.ObjectProperty;
-import javafx.beans.property.ReadOnlyObjectWrapper;
-import javafx.beans.property.ReadOnlyStringWrapper;
import javafx.beans.property.SimpleObjectProperty;
+import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ObservableValue;
import javafx.collections.ObservableList;
import javafx.scene.control.Dialog;
@@ -338,7 +337,7 @@ check: if (data != null) {
} else {
text = (value != null) ? value.toString() : null;
}
- return new ReadOnlyStringWrapper(text);
+ return new SimpleStringProperty(text);
}
/**
@@ -376,7 +375,7 @@ check: if (data != null) {
} catch (IOException e) { // Should never happen
because we append in a StringBuilder.
throw new AssertionError(e);
}
- return new ReadOnlyObjectWrapper<>(value);
+ return new SimpleObjectProperty<>(value);
}
}