adding back, open and file chooser button.

This commit is contained in:
Armin Schrenk
2019-07-22 16:53:06 +02:00
parent fa729e220c
commit fddae7d0e1
2 changed files with 37 additions and 3 deletions

View File

@@ -1,13 +1,43 @@
package org.cryptomator.ui.addvaultwizard;
import javafx.event.ActionEvent;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import org.cryptomator.ui.common.FXMLLoaderFactory;
import org.cryptomator.ui.common.FxController;
import javax.inject.Inject;
import java.io.File;
import java.io.IOException;
@AddVaultWizardScoped
public class ChooseExistingVaultController implements FxController {
@Inject
ChooseExistingVaultController() {}
private final FXMLLoaderFactory fxmlLoaders;
private final Stage window;
@Inject
ChooseExistingVaultController(@AddVaultWizard Stage window, @AddVaultWizard FXMLLoaderFactory fxmlLoaders) {
this.window = window;
this.fxmlLoaders = fxmlLoaders;
}
public void chooseFile(ActionEvent actionEvent) {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Open Masterkey File");
fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Cryptomator Masterkey", "*.cryptomator"));
final File file = fileChooser.showOpenDialog(window);
if (file != null) {
window.setWidth(100);
}
}
public void goBack(ActionEvent actionEvent) throws IOException {
fxmlLoaders.setScene("/fxml/addvault_welcome.fxml", window);
}
public void confirm(ActionEvent actionEvent) {
window.close();
}
}

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.VBox?>
<VBox xmlns="http://javafx.com/javafx"
@@ -13,6 +14,9 @@
<Insets top="12" right="12" bottom="12" left="12"/>
</padding>
<children>
<Label text="TODO existing!"/>
<Label text="Open your existing vault by choosing its masterkey file:"/>
<Button text="file picker" onAction="#chooseFile"/>
<Button text="Back" onAction="#goBack"/>
<Button text="Open" onAction="#confirm"/>
</children>
</VBox>