From f5822fc5686f8e3a735dc4b64ab2e31ca9ce96ad Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Mon, 4 Oct 2021 12:49:28 +0200 Subject: [PATCH] fix bug in check run selection and add small space between buttons --- .../ui/health/CheckListCellController.java | 14 ++++---------- src/main/resources/fxml/health_check_list.fxml | 2 ++ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/health/CheckListCellController.java b/src/main/java/org/cryptomator/ui/health/CheckListCellController.java index 799b73358..d3ec4b996 100644 --- a/src/main/java/org/cryptomator/ui/health/CheckListCellController.java +++ b/src/main/java/org/cryptomator/ui/health/CheckListCellController.java @@ -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; private final Binding checkName; private final Binding checkRunnable; - private final List 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 checkProperty() { diff --git a/src/main/resources/fxml/health_check_list.fxml b/src/main/resources/fxml/health_check_list.fxml index 1d8054ab6..d87062e59 100644 --- a/src/main/resources/fxml/health_check_list.fxml +++ b/src/main/resources/fxml/health_check_list.fxml @@ -10,6 +10,7 @@ +