Skip to content

Commit 0c4732b

Browse files
committed
Usability improvements
- The export AST now uses the same icon as other exports - The edit test code button now uses a more descriptive icon - The edit test name button is now smaller and to the left to keep them all aligned - The duplicate test tooltip text is improved - The border around test status no longer fades around the sides
1 parent 98395d1 commit 0c4732b

File tree

3 files changed

+30
-18
lines changed

3 files changed

+30
-18
lines changed

src/main/java/net/sourceforge/pmd/util/fxdesigner/util/controls/TestCaseListCell.java

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
import javafx.scene.layout.BackgroundFill;
4646
import javafx.scene.layout.CornerRadii;
4747
import javafx.scene.layout.HBox;
48-
import javafx.scene.layout.Pane;
4948
import javafx.scene.layout.Priority;
5049
import javafx.scene.paint.Color;
5150
import javafx.util.Duration;
@@ -66,7 +65,7 @@ public TestCaseListCell(TestCollectionController testCollectionController) {
6665
@Override
6766
protected Pair<Node, Subscription> getNonEditingGraphic(LiveTestCase testCase) {
6867
HBox hBox = new HBox();
69-
hBox.setSpacing(10);
68+
hBox.setSpacing(5);
7069

7170
FontIcon statusIcon = new FontIcon();
7271
Label statusLabel = new Label();
@@ -99,34 +98,34 @@ protected Pair<Node, Subscription> getNonEditingGraphic(LiveTestCase testCase) {
9998
}
10099
});
101100

102-
103-
Label descriptionLabel = new Label();
104-
105-
ControlUtil.bindLabelPropertyWithDefault(descriptionLabel, "(no description)", testCase.descriptionProperty());
106-
107-
ControlUtil.registerDoubleClickListener(descriptionLabel, this::doStartEdit);
108-
109101
Button editDescription = new Button();
110102
editDescription.setGraphic(new FontIcon("far-edit"));
111103
editDescription.getStyleClass().addAll("edit-test-description", "icon-button");
112104
Tooltip.install(editDescription, new Tooltip("Edit test description"));
113105
editDescription.setOnAction(e1 -> doStartEdit());
114106
sub = sub.and(() -> editDescription.setOnAction(null));
115107

116-
Pane spacer = new Pane();
117-
HBox.setHgrow(spacer, Priority.ALWAYS);
108+
Label descriptionLabel = new Label();
109+
ControlUtil.bindLabelPropertyWithDefault(descriptionLabel, "(no description)", testCase.descriptionProperty());
110+
111+
HBox descriptionPane = new HBox();
112+
descriptionPane.getChildren().addAll(editDescription, descriptionLabel);
113+
descriptionPane.setAlignment(Pos.CENTER_LEFT);
114+
descriptionPane.setSpacing(2);
115+
HBox.setHgrow(descriptionPane, Priority.ALWAYS);
116+
ControlUtil.registerDoubleClickListener(descriptionPane, this::doStartEdit);
118117

119118
Button duplicate = new Button();
120119
duplicate.setGraphic(new FontIcon("far-copy"));
121120
duplicate.getStyleClass().addAll("duplicate-test", "icon-button");
122-
Tooltip.install(duplicate, new Tooltip("Copy test case"));
121+
Tooltip.install(duplicate, new Tooltip("Duplicate test case"));
123122
duplicate.setOnAction(e1 -> collection.duplicate(testCase));
124123
sub = sub.and(() -> duplicate.setOnAction(null));
125124

126125

127126
ToggleButton load = new ToggleButton();
128127
load.setToggleGroup(collection.getLoadedToggleGroup());
129-
load.setGraphic(new FontIcon("fas-external-link-alt"));
128+
load.setGraphic(new FontIcon("far-file-code"));
130129
load.getStyleClass().addAll("load-button", "icon-button");
131130
Tooltip.install(load, new Tooltip("Load test case in editor"));
132131

@@ -154,10 +153,7 @@ protected Pair<Node, Subscription> getNonEditingGraphic(LiveTestCase testCase) {
154153
Tooltip.install(delete, new Tooltip("Remove test case"));
155154
delete.setOnAction(e -> collection.deleteTestCase(testCase));
156155

157-
ControlUtil.registerDoubleClickListener(spacer, load::fire);
158-
159-
160-
hBox.getChildren().setAll(statusLabel, descriptionLabel, editDescription, spacer, delete, duplicate, load);
156+
hBox.getChildren().setAll(statusLabel, descriptionPane, delete, duplicate, load);
161157
hBox.setAlignment(Pos.CENTER_LEFT);
162158

163159

src/main/resources/net/sourceforge/pmd/util/fxdesigner/fxml/editor.fxml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<?import javafx.scene.control.Tooltip?>
1818
<?import javafx.scene.layout.AnchorPane?>
1919
<?import javafx.scene.layout.BorderPane?>
20+
<?import javafx.scene.shape.SVGPath?>
2021
<BorderPane xmlns="http://javafx.com/javafx/8"
2122
xmlns:fx="http://javafx.com/fxml/1"
2223
fx:controller="net.sourceforge.pmd.util.fxdesigner.SourceEditorController">
@@ -116,7 +117,11 @@
116117
</Button>
117118
<Button fx:id="exportTreeButton" styleClass="icon-button">
118119
<graphic>
119-
<FontIcon iconLiteral="fas-external-link-alt"/>
120+
<!--Needs FA 5.1.0 -->
121+
<!--<FontIcon iconLiteral="fas-file-export" />-->
122+
<SVGPath styleClass="svg-icon"
123+
scaleX="0.024" scaleY="0.024"
124+
content="M384 121.9c0-6.3-2.5-12.4-7-16.9L279.1 7c-4.5-4.5-10.6-7-17-7H256v128h128v-6.1zM192 336v-32c0-8.84 7.16-16 16-16h176V160H248c-13.2 0-24-10.8-24-24V0H24C10.7 0 0 10.7 0 24v464c0 13.3 10.7 24 24 24h336c13.3 0 24-10.7 24-24V352H208c-8.84 0-16-7.16-16-16zm379.05-28.02l-95.7-96.43c-10.06-10.14-27.36-3.01-27.36 11.27V288H384v64h63.99v65.18c0 14.28 17.29 21.41 27.36 11.27l95.7-96.42c6.6-6.66 6.6-17.4 0-24.05z"/>
120125
</graphic>
121126
<tooltip>
122127
<Tooltip text="Export tree..."/>

src/main/resources/net/sourceforge/pmd/util/fxdesigner/less/tests.less

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
.status-label {
1717
-fx-background-color: white;
1818
-fx-background-radius: 12;
19+
-fx-padding: 0 1;
1920
}
2021

2122
.test-status {
@@ -65,6 +66,16 @@
6566
}
6667
}
6768

69+
.list-view .list-cell,
70+
.list-view:focused .list-cell:selected {
71+
.icon-button.edit-test-description {
72+
.force-square(16);
73+
74+
.ikonli-font-icon {
75+
-fx-icon-size: 10;
76+
}
77+
}
78+
}
6879

6980
.button.node-drag-over, .button:node-drag-possible-target {
7081

0 commit comments

Comments
 (0)