From e134d2f422511043b3a527e60e47527861d82fbb Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Fri, 21 May 2021 17:48:20 +0200 Subject: [PATCH] keep more ui code in fxml --- .../cryptomator/ui/health/CheckListController.java | 14 +++++++------- .../src/main/resources/fxml/health_check_list.fxml | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/health/CheckListController.java b/main/ui/src/main/java/org/cryptomator/ui/health/CheckListController.java index bfd64dba3..ccb41d56b 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/health/CheckListController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/health/CheckListController.java @@ -21,6 +21,7 @@ import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.concurrent.Worker; +import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.CheckBox; import javafx.scene.control.ListView; @@ -55,7 +56,6 @@ public class CheckListController implements FxController { private final BooleanProperty showResultScreen; /* FXML */ - public CheckBox selectAllBox; public ListView checksListView; @@ -96,13 +96,13 @@ public class CheckListController implements FxController { } })); selectedTask.bind(checksListView.getSelectionModel().selectedItemProperty()); - selectAllBox.selectedProperty().addListener(this::selectOrDeselectAll); - selectAllBox.visibleProperty().bind(showResultScreen.not()); - selectAllBox.managedProperty().bind(showResultScreen.not()); } - public void selectOrDeselectAll(ObservableValue observable, boolean oldValue, boolean newValue) { - listPickIndicators.forEach( (task, pickProperty) -> pickProperty.set(newValue)); + @FXML + public void toggleSelectAll(ActionEvent event) { + if (event.getSource() instanceof CheckBox c) { + listPickIndicators.forEach( (task, pickProperty) -> pickProperty.set(c.isSelected())); + } } @FXML @@ -113,9 +113,9 @@ public class CheckListController implements FxController { batchService.setExecutor(executorService); batchService.start(); runningTask.set(batchService); - checksListView.setCellFactory(view -> new CheckListCell()); showResultScreen.set(true); checksListView.getSelectionModel().select(batch.get(0)); + checksListView.setCellFactory(view -> new CheckListCell()); window.sizeToScene(); } diff --git a/main/ui/src/main/resources/fxml/health_check_list.fxml b/main/ui/src/main/resources/fxml/health_check_list.fxml index ee1cdebef..17ec12d0b 100644 --- a/main/ui/src/main/resources/fxml/health_check_list.fxml +++ b/main/ui/src/main/resources/fxml/health_check_list.fxml @@ -25,7 +25,7 @@