From 01ca501607cff86b742fec793b13e6939ea01aaf Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Mon, 29 Jul 2019 19:15:10 +0200 Subject: [PATCH] disabling open button in addExistingVault wizard if no file is selected. --- .../ChooseExistingVaultController.java | 16 ++++++++++++++-- .../main/resources/fxml/addvault_existing.fxml | 2 +- .../src/main/resources/i18n/strings.properties | 2 +- .../main/resources/i18n/strings_en.properties | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/ChooseExistingVaultController.java b/main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/ChooseExistingVaultController.java index 2b21a02c6..7455e27fa 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/ChooseExistingVaultController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/ChooseExistingVaultController.java @@ -1,14 +1,15 @@ package org.cryptomator.ui.addvaultwizard; import dagger.Lazy; +import javafx.beans.property.BooleanProperty; import javafx.beans.property.ObjectProperty; +import javafx.beans.property.SimpleBooleanProperty; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.scene.Scene; import javafx.stage.FileChooser; import javafx.stage.Stage; import org.cryptomator.common.settings.VaultSettings; -import org.cryptomator.ui.common.FXMLLoaderFactory; import org.cryptomator.ui.common.FxController; import org.cryptomator.ui.common.FxmlFile; import org.cryptomator.ui.common.FxmlScene; @@ -16,7 +17,6 @@ import org.cryptomator.ui.model.Vault; import org.cryptomator.ui.model.VaultFactory; import javax.inject.Inject; -import javax.inject.Named; import java.io.File; import java.nio.file.Path; import java.util.ResourceBundle; @@ -28,6 +28,7 @@ public class ChooseExistingVaultController implements FxController { private final Lazy welcomeScene; private final ObjectProperty vaultPath; private final ObservableList vaults; + private final BooleanProperty isVaultPathNull; private final VaultFactory vaultFactory; private final ResourceBundle resourceBundle; @@ -39,6 +40,8 @@ public class ChooseExistingVaultController implements FxController { this.vaults = vaults; this.vaultFactory = vaultFactory; this.resourceBundle = resourceBundle; + this.isVaultPathNull = new SimpleBooleanProperty(); + isVaultPathNull.bind(vaultPath.isNull()); } @FXML @@ -75,4 +78,13 @@ public class ChooseExistingVaultController implements FxController { public ObjectProperty vaultPathProperty() { return vaultPath; } + + public boolean getIsVaultPathNull() { + return isVaultPathNull.get(); + } + + public BooleanProperty isVaultPathNullProperty() { + return isVaultPathNull; + } + } diff --git a/main/ui/src/main/resources/fxml/addvault_existing.fxml b/main/ui/src/main/resources/fxml/addvault_existing.fxml index 32f63e5a6..f69046c84 100644 --- a/main/ui/src/main/resources/fxml/addvault_existing.fxml +++ b/main/ui/src/main/resources/fxml/addvault_existing.fxml @@ -28,7 +28,7 @@