mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-18 10:41:26 +00:00
fix bug in check run selection and add small space between buttons
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package org.cryptomator.ui.health;
|
||||
|
||||
import com.tobiasdiez.easybind.EasyBind;
|
||||
import com.tobiasdiez.easybind.Subscription;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -9,8 +8,6 @@ import javafx.beans.binding.Binding;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CheckListCellController implements FxController {
|
||||
|
||||
@@ -18,7 +15,6 @@ public class CheckListCellController implements FxController {
|
||||
private final ObjectProperty<Check> check;
|
||||
private final Binding<String> checkName;
|
||||
private final Binding<Boolean> checkRunnable;
|
||||
private final List<Subscription> subscriptions;
|
||||
|
||||
/* FXML */
|
||||
public CheckBox forRunSelectedCheckBox;
|
||||
@@ -28,16 +24,14 @@ public class CheckListCellController implements FxController {
|
||||
check = new SimpleObjectProperty<>();
|
||||
checkRunnable = EasyBind.wrapNullable(check).mapObservable(Check::stateProperty).map(Check.CheckState.RUNNABLE::equals).orElse(false);
|
||||
checkName = EasyBind.wrapNullable(check).map(Check::getName).orElse("");
|
||||
subscriptions = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
subscriptions.add(EasyBind.subscribe(check, c -> {
|
||||
forRunSelectedCheckBox.selectedProperty().unbind();
|
||||
if (c != null) {
|
||||
forRunSelectedCheckBox.selectedProperty().bindBidirectional(c.chosenForExecutionProperty());
|
||||
forRunSelectedCheckBox.selectedProperty().addListener((observable, wasSelected, isSelected) -> {
|
||||
if (check.get() != null) {
|
||||
check.get().chosenForExecutionProperty().set(isSelected);
|
||||
}
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
public ObjectProperty<Check> checkProperty() {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import java.lang.Integer?>
|
||||
<?import javafx.scene.layout.Region?>
|
||||
<VBox xmlns:fx="http://javafx.com/fxml"
|
||||
xmlns="http://javafx.com/javafx"
|
||||
fx:controller="org.cryptomator.ui.health.CheckListController"
|
||||
@@ -29,6 +30,7 @@
|
||||
<Label text="%health.checkList.description" wrapText="true"/>
|
||||
<HBox alignment="CENTER">
|
||||
<Button onAction="#selectAllChecks" text="%health.checkList.selectAllButton" />
|
||||
<Region prefWidth="6"/>
|
||||
<Button onAction="#deselectAllChecks" text="%health.checkList.deselectAllButton" />
|
||||
</HBox>
|
||||
</VBox>
|
||||
|
||||
Reference in New Issue
Block a user