changing test functionality by intended showing now selected file

This commit is contained in:
Armin Schrenk
2019-07-22 17:12:22 +02:00
parent fddae7d0e1
commit c2ed9958c7
2 changed files with 8 additions and 1 deletions

View File

@@ -1,6 +1,8 @@
package org.cryptomator.ui.addvaultwizard;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TextField;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import org.cryptomator.ui.common.FXMLLoaderFactory;
@@ -16,6 +18,9 @@ public class ChooseExistingVaultController implements FxController {
private final FXMLLoaderFactory fxmlLoaders;
private final Stage window;
@FXML
public TextField textField;
@Inject
ChooseExistingVaultController(@AddVaultWizard Stage window, @AddVaultWizard FXMLLoaderFactory fxmlLoaders) {
this.window = window;
@@ -28,7 +33,7 @@ public class ChooseExistingVaultController implements FxController {
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Cryptomator Masterkey", "*.cryptomator"));
final File file = fileChooser.showOpenDialog(window);
if (file != null) {
window.setWidth(100);
textField.setText(file.getAbsolutePath());
}
}

View File

@@ -4,6 +4,7 @@
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.TextField?>
<VBox xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="org.cryptomator.ui.addvaultwizard.ChooseExistingVaultController"
@@ -15,6 +16,7 @@
</padding>
<children>
<Label text="Open your existing vault by choosing its masterkey file:"/>
<TextField fx:id="textField" text="path/to/masterkey.cryptomator" disable="true"/>
<Button text="file picker" onAction="#chooseFile"/>
<Button text="Back" onAction="#goBack"/>
<Button text="Open" onAction="#confirm"/>