1212import java .util .logging .Level ;
1313import java .util .stream .Collectors ;
1414
15- import javafx .scene .control .Label ;
15+ import javafx .beans .property .ReadOnlyObjectWrapper ;
16+ import javafx .scene .control .*;
17+ import javafx .scene .layout .HBox ;
1618import org .phoebus .channelfinder .Channel ;
1719import org .phoebus .channelfinder .ChannelUtil ;
1820import org .phoebus .framework .adapter .AdapterService ;
2527import javafx .collections .FXCollections ;
2628import javafx .collections .ObservableList ;
2729import javafx .fxml .FXML ;
28- import javafx .scene .control .Button ;
29- import javafx .scene .control .CheckBox ;
30- import javafx .scene .control .ContextMenu ;
31- import javafx .scene .control .MenuItem ;
32- import javafx .scene .control .SelectionMode ;
33- import javafx .scene .control .TextField ;
34- import javafx .scene .control .TreeItem ;
35- import javafx .scene .control .TreeTableColumn ;
36- import javafx .scene .control .TreeTableView ;
3730import javafx .scene .image .ImageView ;
3831
3932/**
@@ -59,7 +52,7 @@ public class ChannelTreeController extends ChannelFinderController {
5952 Label count ;
6053
6154 @ FXML
62- TreeTableColumn <ChannelTreeByPropertyNode , String > node ;
55+ TreeTableColumn <ChannelTreeByPropertyNode , ChannelTreeByPropertyNode > node ;
6356 @ FXML
6457 TreeTableColumn <ChannelTreeByPropertyNode , String > value ;
6558
@@ -70,8 +63,33 @@ public class ChannelTreeController extends ChannelFinderController {
7063 @ FXML
7164 public void initialize () {
7265 dispose ();
66+ // what should the value be
67+ node .setCellValueFactory (cellValue -> new ReadOnlyObjectWrapper <>(cellValue .getValue ().getValue ()));
68+
69+ // how should the value be displayed
70+ node .setCellFactory (column -> new TreeTableCell <>() {
71+ @ Override
72+ public void updateItem (ChannelTreeByPropertyNode node , boolean isEmpty ) {
73+ super .updateItem (node , isEmpty );
74+ if (isEmpty || node == null ) {
75+ setGraphic (null );
76+ setText (null );
77+ } else {
78+ if (node .getPropertyName () != null ) {
79+ HBox hBox = new HBox ();
80+ Label propertyLabel = new Label (node .getPropertyName () + " " );
81+ propertyLabel .setStyle ("-fx-font-weight: bold;" );
82+ hBox .getChildren ().addAll (propertyLabel , new Label (node .getDisplayName ()));
83+ setGraphic (hBox );
84+ setText (null );
85+ } else {
86+ setText (node .getDisplayName ());
87+ setGraphic (null );
88+ }
89+ }
90+ }
91+ });
7392
74- node .setCellValueFactory (cellValue -> new ReadOnlyStringWrapper (cellValue .getValue ().getValue ().getDisplayName ()));
7593 value .setCellValueFactory (cellValue -> new ReadOnlyStringWrapper (cellValue .getValue ().getValue ().getDisplayValue ()));
7694
7795 treeTableView .getSelectionModel ().setSelectionMode (SelectionMode .MULTIPLE );
@@ -141,10 +159,12 @@ private void reconstructTree() {
141159 public void configure () {
142160 if (model != null ) {
143161 List <String > allProperties = ChannelUtil .getPropertyNames (model .getRoot ().getNodeChannels ()).stream ().sorted ().collect (Collectors .toList ());
162+
144163 OrderedSelectionDialog dialog = new OrderedSelectionDialog (allProperties , orderedProperties );
145164 Optional <List <String >> result = dialog .showAndWait ();
146165 result .ifPresent (r -> {
147166 setOrderedProperties (r );
167+
148168 });
149169 }
150170 }
@@ -244,5 +264,4 @@ private ObservableList<TreeItem<ChannelTreeByPropertyNode>> buildChildren(
244264 return children ;
245265 }
246266 }
247-
248267}
0 commit comments