From 19a88d4e5c28295aea8f8f2d077a8c442c0cbbe0 Mon Sep 17 00:00:00 2001 From: milenaschedle Date: Wed, 8 Jul 2026 15:23:18 +0200 Subject: [PATCH 1/2] added value property to display name --- .../phoebus/channelfinder/ChannelUtil.java | 2 + app/channel/views/pom.xml | 6 +++ .../views/ui/ChannelTreeByPropertyNode.java | 4 +- .../views/ui/ChannelTreeController.java | 45 +++++++++++++------ 4 files changed, 43 insertions(+), 14 deletions(-) diff --git a/app/channel/channelfinder/src/main/java/org/phoebus/channelfinder/ChannelUtil.java b/app/channel/channelfinder/src/main/java/org/phoebus/channelfinder/ChannelUtil.java index d1b8f8bdd1..d0d902dec6 100644 --- a/app/channel/channelfinder/src/main/java/org/phoebus/channelfinder/ChannelUtil.java +++ b/app/channel/channelfinder/src/main/java/org/phoebus/channelfinder/ChannelUtil.java @@ -98,6 +98,8 @@ public static Collection getPropValues(Collection channels, Str return propertyValues; } + //public static void getPropertyValueByDisplayName + /** * Returns all the channel Names in the given Collection of channels * diff --git a/app/channel/views/pom.xml b/app/channel/views/pom.xml index 69b18b75d1..40dd054e9d 100644 --- a/app/channel/views/pom.xml +++ b/app/channel/views/pom.xml @@ -38,5 +38,11 @@ core-types 6.0.0-SNAPSHOT + + org.eclipse.jetty + jetty-util + 9.4.46.v20220331 + compile + diff --git a/app/channel/views/src/main/java/org/phoebus/channel/views/ui/ChannelTreeByPropertyNode.java b/app/channel/views/src/main/java/org/phoebus/channel/views/ui/ChannelTreeByPropertyNode.java index 0b4a98f9b3..4dc966e94c 100644 --- a/app/channel/views/src/main/java/org/phoebus/channel/views/ui/ChannelTreeByPropertyNode.java +++ b/app/channel/views/src/main/java/org/phoebus/channel/views/ui/ChannelTreeByPropertyNode.java @@ -56,6 +56,7 @@ public class ChannelTreeByPropertyNode { public ChannelTreeByPropertyNode(ChannelTreeByPropertyModel model, ChannelTreeByPropertyNode parentNode, String displayName) { this.model = model; this.parentNode = parentNode; + this.displayName = displayName; // Calculate depth if (parentNode == null) { @@ -64,7 +65,6 @@ public ChannelTreeByPropertyNode(ChannelTreeByPropertyModel model, ChannelTreeBy depth = parentNode.depth + 1; } - this.displayName = displayName; // Construct the Channel list if (parentNode == null) { @@ -90,6 +90,7 @@ public ChannelTreeByPropertyNode(ChannelTreeByPropertyModel model, ChannelTreeBy } } } + } else { // Filter the channels that match the property name nodeChannels = new ArrayList(); @@ -115,6 +116,7 @@ public ChannelTreeByPropertyNode(ChannelTreeByPropertyModel model, ChannelTreeBy } else { childrenNames = null; } + } /** diff --git a/app/channel/views/src/main/java/org/phoebus/channel/views/ui/ChannelTreeController.java b/app/channel/views/src/main/java/org/phoebus/channel/views/ui/ChannelTreeController.java index 00f3a243ee..200981d524 100644 --- a/app/channel/views/src/main/java/org/phoebus/channel/views/ui/ChannelTreeController.java +++ b/app/channel/views/src/main/java/org/phoebus/channel/views/ui/ChannelTreeController.java @@ -12,7 +12,9 @@ import java.util.logging.Level; import java.util.stream.Collectors; -import javafx.scene.control.Label; +import javafx.beans.property.ReadOnlyObjectWrapper; +import javafx.scene.control.*; +import javafx.scene.layout.HBox; import org.phoebus.channelfinder.Channel; import org.phoebus.channelfinder.ChannelUtil; import org.phoebus.framework.adapter.AdapterService; @@ -25,15 +27,6 @@ import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; -import javafx.scene.control.Button; -import javafx.scene.control.CheckBox; -import javafx.scene.control.ContextMenu; -import javafx.scene.control.MenuItem; -import javafx.scene.control.SelectionMode; -import javafx.scene.control.TextField; -import javafx.scene.control.TreeItem; -import javafx.scene.control.TreeTableColumn; -import javafx.scene.control.TreeTableView; import javafx.scene.image.ImageView; /** @@ -59,7 +52,7 @@ public class ChannelTreeController extends ChannelFinderController { Label count; @FXML - TreeTableColumn node; + TreeTableColumn node; @FXML TreeTableColumn value; @@ -70,8 +63,33 @@ public class ChannelTreeController extends ChannelFinderController { @FXML public void initialize() { dispose(); + // what should the value be + node.setCellValueFactory(cellValue -> new ReadOnlyObjectWrapper<>(cellValue.getValue().getValue())); + + // how should the value be displayed + node.setCellFactory(column -> new TreeTableCell<>() { + @Override + public void updateItem(ChannelTreeByPropertyNode node, boolean isEmpty) { + super.updateItem(node, isEmpty); + if (isEmpty || node == null) { + setGraphic(null); + setText(null); + } else { + if (node.getPropertyName() != null) { + HBox hBox = new HBox(); + Label propertyLabel = new Label(node.getPropertyName() + " "); + propertyLabel.setStyle("-fx-font-weight: bold;"); + hBox.getChildren().addAll(propertyLabel, new Label(node.getDisplayName())); + setGraphic(hBox); + setText(null); + } else { + setText(node.getDisplayName()); + setGraphic(null); + } + } + } + }); - node.setCellValueFactory(cellValue -> new ReadOnlyStringWrapper(cellValue.getValue().getValue().getDisplayName())); value.setCellValueFactory(cellValue -> new ReadOnlyStringWrapper(cellValue.getValue().getValue().getDisplayValue())); treeTableView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); @@ -141,10 +159,12 @@ private void reconstructTree() { public void configure() { if (model != null) { List allProperties = ChannelUtil.getPropertyNames(model.getRoot().getNodeChannels()).stream().sorted().collect(Collectors.toList()); + OrderedSelectionDialog dialog = new OrderedSelectionDialog(allProperties, orderedProperties); Optional> result = dialog.showAndWait(); result.ifPresent(r -> { setOrderedProperties(r); + }); } } @@ -244,5 +264,4 @@ private ObservableList> buildChildren( return children; } } - } From 840d0e66a58492da599f390cb07a15be9c56f123 Mon Sep 17 00:00:00 2001 From: milenaschedle Date: Fri, 10 Jul 2026 09:47:44 +0200 Subject: [PATCH 2/2] removed outcommented line and dependency --- .../main/java/org/phoebus/channelfinder/ChannelUtil.java | 2 -- app/channel/views/pom.xml | 6 ------ 2 files changed, 8 deletions(-) diff --git a/app/channel/channelfinder/src/main/java/org/phoebus/channelfinder/ChannelUtil.java b/app/channel/channelfinder/src/main/java/org/phoebus/channelfinder/ChannelUtil.java index d0d902dec6..d1b8f8bdd1 100644 --- a/app/channel/channelfinder/src/main/java/org/phoebus/channelfinder/ChannelUtil.java +++ b/app/channel/channelfinder/src/main/java/org/phoebus/channelfinder/ChannelUtil.java @@ -98,8 +98,6 @@ public static Collection getPropValues(Collection channels, Str return propertyValues; } - //public static void getPropertyValueByDisplayName - /** * Returns all the channel Names in the given Collection of channels * diff --git a/app/channel/views/pom.xml b/app/channel/views/pom.xml index 40dd054e9d..69b18b75d1 100644 --- a/app/channel/views/pom.xml +++ b/app/channel/views/pom.xml @@ -38,11 +38,5 @@ core-types 6.0.0-SNAPSHOT - - org.eclipse.jetty - jetty-util - 9.4.46.v20220331 - compile -