Deactivated nav items show as greyed out
This commit is contained in:
1 parent
6d59ad6805
commit
a4ac411e56
4 files changed
+24
-7
No files matched your search
@@ -85,7 +85,12 @@ public class TestCaseEditorPane extends BorderPane implements Destroyable {
|
|||||||
bottom.getChildren().add(actions);
|
bottom.getChildren().add(actions);
|
||||||
|
|
||||||
activeToggle = new ToggleSwitch("Activo");
|
activeToggle = new ToggleSwitch("Activo");
|
||||||
activeToggle.selectedProperty().addListener((obs, old, value)-> testCase.setActive(value));
|
activeToggle.setSelected(testCase.isActive());
|
||||||
|
// Listener added after the initial value, so opening the editor does not save.
|
||||||
|
activeToggle.selectedProperty().addListener((obs, old, value)-> {
|
||||||
|
testCase.setActive(value);
|
||||||
|
submit.run();
|
||||||
|
});
|
||||||
actions.getChildren().add(activeToggle);
|
actions.getChildren().add(activeToggle);
|
||||||
|
|
||||||
actions.getChildren().add(new Spacer());
|
actions.getChildren().add(new Spacer());
|
||||||
@@ -108,7 +113,6 @@ public class TestCaseEditorPane extends BorderPane implements Destroyable {
|
|||||||
|
|
||||||
private void loadTestCase(TestCase testCase) {
|
private void loadTestCase(TestCase testCase) {
|
||||||
title.setText("Caso %s".formatted(testCase.getName()));
|
title.setText("Caso %s".formatted(testCase.getName()));
|
||||||
activeToggle.setSelected(testCase.isActive());
|
|
||||||
nameField.setText(testCase.getName());
|
nameField.setText(testCase.getName());
|
||||||
endpointField.setText(testCase.getEndpoint());
|
endpointField.setText(testCase.getEndpoint());
|
||||||
actionField.setText(testCase.getAction());
|
actionField.setText(testCase.getAction());
|
||||||
|
|||||||
@@ -95,7 +95,12 @@ public class StepEditorPane extends BorderPane implements Destroyable {
|
|||||||
setBottom(bottom);
|
setBottom(bottom);
|
||||||
|
|
||||||
activeToggle = new ToggleSwitch("Activo");
|
activeToggle = new ToggleSwitch("Activo");
|
||||||
activeToggle.selectedProperty().addListener((obs, old, value)-> step.setActive(value));
|
activeToggle.setSelected(step.isActive());
|
||||||
|
// Listener added after the initial value, so opening the editor does not save.
|
||||||
|
activeToggle.selectedProperty().addListener((obs, old, value)-> {
|
||||||
|
step.setActive(value);
|
||||||
|
StepService.write(stepPath, step);
|
||||||
|
});
|
||||||
bottom.getChildren().add(activeToggle);
|
bottom.getChildren().add(activeToggle);
|
||||||
|
|
||||||
bottom.getChildren().add(new Spacer());
|
bottom.getChildren().add(new Spacer());
|
||||||
@@ -156,7 +161,6 @@ public class StepEditorPane extends BorderPane implements Destroyable {
|
|||||||
|
|
||||||
private void loadStep(Step step) {
|
private void loadStep(Step step) {
|
||||||
title.setText("Paso %s".formatted(step.getName()));
|
title.setText("Paso %s".formatted(step.getName()));
|
||||||
activeToggle.setSelected(step.isActive());
|
|
||||||
payload.setXml(step.getPayload());
|
payload.setXml(step.getPayload());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,7 +125,7 @@ public class SopaTreeCell extends TreeCell<TreeIdentity> {
|
|||||||
if (empty || item == null)
|
if (empty || item == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
getStyleClass().remove("text-bold");
|
getStyleClass().removeAll("text-bold", "inactive");
|
||||||
var path = item.path();
|
var path = item.path();
|
||||||
try {
|
try {
|
||||||
switch (item.kind()) {
|
switch (item.kind()) {
|
||||||
@@ -136,12 +136,16 @@ public class SopaTreeCell extends TreeCell<TreeIdentity> {
|
|||||||
getStyleClass().add("text-bold");
|
getStyleClass().add("text-bold");
|
||||||
break;
|
break;
|
||||||
case testcase:
|
case testcase:
|
||||||
setText(TestCaseRepository.get(path).getName());
|
var testCase = TestCaseRepository.get(path);
|
||||||
|
setText(testCase.getName());
|
||||||
|
if (!testCase.isActive()) getStyleClass().add("inactive");
|
||||||
setGraphic(null);
|
setGraphic(null);
|
||||||
setContextMenu(new TestCaseContextMenu(item.path()));
|
setContextMenu(new TestCaseContextMenu(item.path()));
|
||||||
break;
|
break;
|
||||||
case step:
|
case step:
|
||||||
setText(StepRepository.get(path).getName());
|
var step = StepRepository.get(path);
|
||||||
|
setText(step.getName());
|
||||||
|
if (!step.isActive()) getStyleClass().add("inactive");
|
||||||
setContextMenu(new StepContextMenu(item.path()));
|
setContextMenu(new StepContextMenu(item.path()));
|
||||||
setGraphic(flightIcon(flightStates.apply(path)));
|
setGraphic(flightIcon(flightStates.apply(path)));
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -43,3 +43,8 @@
|
|||||||
.tree-cell .flight-icon.exception {
|
.tree-cell .flight-icon.exception {
|
||||||
-fx-icon-color: -color-danger-fg;
|
-fx-icon-color: -color-danger-fg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Deactivated testcases and steps appear de-emphasized in the project tree. */
|
||||||
|
.tree-cell.inactive {
|
||||||
|
-color-cell-fg: -color-fg-muted;
|
||||||
|
}
|
||||||
Reference in new issue
Block a user