disabling open button in addExistingVault wizard if no file is selected.

This commit is contained in:
Armin Schrenk
2019-07-29 19:15:10 +02:00
parent ba34b37f8a
commit 01ca501607
4 changed files with 17 additions and 5 deletions

View File

@@ -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<Scene> welcomeScene;
private final ObjectProperty<Path> vaultPath;
private final ObservableList<Vault> 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<Path> vaultPathProperty() {
return vaultPath;
}
public boolean getIsVaultPathNull() {
return isVaultPathNull.get();
}
public BooleanProperty isVaultPathNullProperty() {
return isVaultPathNull;
}
}

View File

@@ -28,7 +28,7 @@
<ButtonBar buttonMinWidth="120" buttonOrder="B+I">
<buttons>
<Button text="TODO Back" ButtonBar.buttonData="BACK_PREVIOUS" onAction="#back"/>
<Button text="TODO Open" ButtonBar.buttonData="FINISH" onAction="#finish" defaultButton="true"/>
<Button text="TODO Open" ButtonBar.buttonData="FINISH" onAction="#finish" defaultButton="true" disable="${controller.isVaultPathNull}"/>
</buttons>
</ButtonBar>
</children>

View File

@@ -1,4 +1,4 @@
addvaultwizard.existing.instruction=Please choose the masterkey.cryptomator file of your existing vault
addvaultwizard.existing.instruction=Please choose the masterkey.cryptomator file of your existing vault. The directory contain it will be displayed.
addvaultwizard.existing.filePickerTitle=Open Masterkey File
main.closeBtn.tooltip=Close
main.settingsBtn.tooltip=Settings

View File

@@ -1,4 +1,4 @@
addvaultwizard.existing.instruction=Please choose the masterkey.cryptomator file of your existing vault
addvaultwizard.existing.instruction=Please choose the masterkey.cryptomator file of your existing vault. The directory contain it will be displayed.
addvaultwizard.existing.filePickerTitle=Open Masterkey File
main.closeBtn.tooltip=Close
main.settingsBtn.tooltip=Settings