remove redundant property, fix logic error

This commit is contained in:
Armin Schrenk 2021-05-17 12:49:08 +02:00
parent 749e0ac02d
commit 8e1be4c67b
No known key found for this signature in database
GPG Key ID: 8F2992163CBBA7FC
2 changed files with 4 additions and 5 deletions

View File

@ -35,7 +35,6 @@ public class CheckListController implements FxController {
private final SimpleObjectProperty<Worker<?>> runningTask;
private final Binding<Boolean> running;
private final Binding<Boolean> finished;
private final BooleanBinding anyCheckSelected;
private final BooleanBinding readyToRun;
/* FXML */
@ -51,7 +50,6 @@ public class CheckListController implements FxController {
this.runningTask = new SimpleObjectProperty<>();
this.running = EasyBind.wrapNullable(runningTask).mapObservable(Worker::runningProperty).orElse(false);
this.finished = EasyBind.wrapNullable(runningTask).mapObservable(Worker::stateProperty).map(endStates::contains).orElse(false);
this.anyCheckSelected = selectedTask.isNotNull();
this.readyToRun = runningTask.isNull();
}
@ -91,6 +89,7 @@ public class CheckListController implements FxController {
try {
reportWriter.writeReport(tasks);
} catch (IOException e) {
//TODO: better error handling
LOG.error("Failed to write health check report.", e);
}
}
@ -122,10 +121,10 @@ public class CheckListController implements FxController {
}
public boolean isAnyCheckSelected() {
return anyCheckSelected.get();
return anyCheckSelectedProperty().get();
}
public BooleanBinding anyCheckSelectedProperty() {
return anyCheckSelected;
return selectedTask.isNotNull();
}
}

View File

@ -23,7 +23,7 @@
<Label fx:id="listHeading" text="Health checks"/>
<ListView fx:id="checksListView"/>
<!-- TODO: clean up button states: -->
<Button text="TODO: run selected" onAction="#runSelectedChecks" disable="${controller.anyCheckSelected}" visible="${controller.readyToRun}" managed="${controller.readyToRun}" maxWidth="Infinity"/>
<Button text="TODO: run selected" onAction="#runSelectedChecks" disable="${!controller.anyCheckSelected}" visible="${controller.readyToRun}" managed="${controller.readyToRun}" maxWidth="Infinity"/>
<Button text="TODO: run all" onAction="#runAllChecks" visible="${controller.readyToRun}" managed="${controller.readyToRun}" maxWidth="Infinity"/>
<Button text="%generic.button.cancel" onAction="#cancelCheck" visible="${controller.running}" managed="${controller.running}" maxWidth="Infinity"/>
</VBox>