Skip to content

Commit 67a2511

Browse files
authored
Merge pull request #2321 from ControlSystemStudio/CSSTUDIO-1720
Save&restore tree view improvement
2 parents 6424b43 + 8011da0 commit 67a2511

File tree

3 files changed

+27
-44
lines changed

3 files changed

+27
-44
lines changed

app/save-and-restore/app/src/main/java/org/phoebus/applications/saveandrestore/ui/BrowserTreeCell.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ public class BrowserTreeCell extends TreeCell<Node> {
5858
private javafx.scene.Node saveSetBox;
5959
private javafx.scene.Node snapshotBox;
6060

61-
private ContextMenu folderContextMenu;
62-
private ContextMenu saveSetContextMenu;
63-
private ContextMenu snapshotContextMenu;
64-
private ContextMenu rootFolderContextMenu;
61+
private final ContextMenu folderContextMenu;
62+
private final ContextMenu saveSetContextMenu;
63+
private final ContextMenu snapshotContextMenu;
64+
private final ContextMenu rootFolderContextMenu;
6565

6666
private static final Border BORDER = new Border(new BorderStroke(Color.GREEN, BorderStrokeStyle.SOLID,
6767
new CornerRadii(5.0), BorderStroke.THIN));
@@ -155,12 +155,11 @@ public void updateItem(Node node, boolean empty) {
155155
setContextMenu(null);
156156
return;
157157
}
158-
158+
setGraphic(folderBox);
159159
switch (node.getNodeType()) {
160160
case SNAPSHOT:
161161
((Label) snapshotBox.lookup("#primaryLabel"))
162162
.setText(node.getName());
163-
((Label) snapshotBox.lookup("#secondaryLabel")).setText(node.getCreated() + " (" + node.getUserName() + ")");
164163
snapshotBox.lookup("#tagIcon").setVisible(node.getTags() != null && !node.getTags().isEmpty());
165164
setGraphic(snapshotBox);
166165
if (node.getProperty("golden") != null && Boolean.valueOf(node.getProperty("golden"))) {
@@ -170,9 +169,12 @@ public void updateItem(Node node, boolean empty) {
170169
}
171170
setContextMenu(snapshotContextMenu);
172171
String comment = node.getProperty("comment");
172+
StringBuffer stringBuffer = new StringBuffer();
173173
if (comment != null && !comment.isEmpty()) {
174-
setTooltip(new Tooltip(comment));
174+
stringBuffer.append(comment).append(System.lineSeparator());
175175
}
176+
stringBuffer.append(node.getCreated()).append(" (").append(node.getUserName()).append(")");
177+
setTooltip(new Tooltip(stringBuffer.toString()));
176178
setEditable(false);
177179
break;
178180
case CONFIGURATION:
5.98 KB
Loading
Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<?import javafx.geometry.Insets?>
43
<?import javafx.scene.control.Label?>
54
<?import javafx.scene.image.Image?>
65
<?import javafx.scene.image.ImageView?>
76
<?import javafx.scene.layout.FlowPane?>
87
<?import javafx.scene.layout.HBox?>
9-
<?import javafx.scene.layout.VBox?>
10-
<?import javafx.scene.control.TextField?>
118

129
<FlowPane xmlns="http://javafx.com/javafx/8.0.999-ea" xmlns:fx="http://javafx.com/fxml/1">
1310

@@ -28,49 +25,33 @@
2825
<image>
2926
<Image url="/icons/save-and-restore/saveset.png" />
3027
</image>
31-
<HBox.margin>
32-
<Insets top="-1.0" />
33-
</HBox.margin>
28+
3429
</ImageView>
3530
<Label fx:id="savesetLabel" text="Label">
36-
<HBox.margin>
37-
<Insets />
38-
</HBox.margin></Label>
31+
</Label>
3932
</children>
4033
</HBox>
4134

42-
<VBox fx:id="snapshot">
35+
36+
<HBox fx:id="snapshot">
4337
<children>
44-
<HBox>
45-
<ImageView fx:id="snapshotIcon" pickOnBounds="true" preserveRatio="true">
38+
<ImageView fx:id="snapshotIcon" pickOnBounds="true" preserveRatio="true">
39+
<image>
40+
<Image url="/icons/save-and-restore/snapshot.png" />
41+
</image>
42+
43+
</ImageView>
44+
45+
<HBox alignment="CENTER_LEFT" spacing="3">
46+
<children>
47+
<Label fx:id="primaryLabel" text="Label" />
48+
<ImageView fx:id="tagIcon" visible="false" fitHeight="13" pickOnBounds="true" preserveRatio="true">
4649
<image>
47-
<Image url="/icons/save-and-restore/snapshot.png" />
50+
<Image url="/icons/save-and-restore/snapshot-tags.png" />
4851
</image>
49-
<HBox.margin>
50-
<Insets top="3.0" />
51-
</HBox.margin>
52-
</ImageView>
53-
<VBox fx:id="snapshotNodeName">
54-
<HBox alignment="CENTER_LEFT" spacing="3">
55-
<Label fx:id="primaryLabel" text="Label" />
56-
<ImageView fx:id="tagIcon" visible="false" fitHeight="13" pickOnBounds="true" preserveRatio="true">
57-
<image>
58-
<Image url="/icons/save-and-restore/snapshot-tags.png" />
59-
</image>
60-
</ImageView>
61-
</HBox>
62-
<Label fx:id="secondaryLabel" style="-fx-font-size: 8pt;" text="Label"/>
63-
<VBox.margin>
64-
<Insets left="2.0" />
65-
</VBox.margin>
66-
<HBox.margin>
67-
<Insets left="2.0" />
68-
</HBox.margin>
69-
70-
</VBox>
52+
</ImageView></children>
7153
</HBox>
7254
</children>
73-
</VBox>
74-
55+
</HBox>
7556

7657
</FlowPane>

0 commit comments

Comments
 (0)