add select all checkbox

This commit is contained in:
Armin Schrenk
2021-05-21 13:16:14 +02:00
parent b4f268f551
commit c01c405f20
2 changed files with 12 additions and 0 deletions

View File

@@ -16,10 +16,12 @@ import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.concurrent.Worker;
import javafx.fxml.FXML;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ListView;
import javafx.scene.control.cell.CheckBoxListCell;
import javafx.stage.Stage;
@@ -51,6 +53,7 @@ public class CheckListController implements FxController {
private final BooleanProperty showResultScreen;
/* FXML */
public CheckBox selectAllBox;
public ListView<HealthCheckTask> checksListView;
@@ -90,6 +93,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<? extends Boolean> observable, boolean oldValue, boolean newValue) {
listPickIndicators.forEach( (task, pickProperty) -> pickProperty.set(newValue));
}
@FXML

View File

@@ -9,6 +9,7 @@
<?import javafx.scene.layout.VBox?>
<?import java.lang.Integer?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.control.CheckBox?>
<VBox xmlns:fx="http://javafx.com/fxml"
xmlns="http://javafx.com/javafx"
fx:controller="org.cryptomator.ui.health.CheckListController"
@@ -25,6 +26,7 @@
<VBox minWidth="80" maxWidth="200" spacing="6" HBox.hgrow="ALWAYS" >
<Label fx:id="listHeading" text="%health.check.listHeader"/>
<!-- TODO:HEADER with select all checkbox -->
<CheckBox fx:id="selectAllBox" text="FIX: SELECT ALL" />
<ListView fx:id="checksListView" VBox.vgrow="ALWAYS"/>
</VBox>
<StackPane visible="${controller.showResultScreen}" managed="${controller.showResultScreen}" HBox.hgrow="ALWAYS" >