浏览代码

#926 replacing boolean by a string for current vault state

Armin Schrenk 5 年之前
父节点
当前提交
fc51e5caff

+ 11 - 0
main/ui/src/main/java/org/cryptomator/ui/mainwindow/VaultDetailController.java

@@ -1,5 +1,6 @@
 package org.cryptomator.ui.mainwindow;
 
+import javafx.beans.binding.BooleanBinding;
 import javafx.beans.property.ObjectProperty;
 import javafx.beans.property.ReadOnlyObjectProperty;
 import javafx.fxml.FXML;
@@ -21,6 +22,7 @@ public class VaultDetailController implements FxController {
 	private static final Logger LOG = LoggerFactory.getLogger(VaultDetailController.class);
 
 	private final ReadOnlyObjectProperty<Vault> vault;
+	private final BooleanBinding anyVaultSelected;
 	private final ExecutorService executor;
 	private final FxApplication application;
 	private final VaultOptionsComponent.Builder vaultOptionsWindow;
@@ -33,6 +35,7 @@ public class VaultDetailController implements FxController {
 		this.application = application;
 		this.vaultOptionsWindow = vaultOptionsWindow;
 		this.changePasswordWindow = changePasswordWindow;
+		this.anyVaultSelected = vault.isNotNull();
 	}
 
 	@FXML
@@ -74,4 +77,12 @@ public class VaultDetailController implements FxController {
 		return vault.get();
 	}
 
+	public BooleanBinding anyVaultSelectedProperty() {
+		return anyVaultSelected;
+	}
+
+	public boolean isAnyVaultSelected() {
+		return anyVaultSelected.get();
+	}
+
 }

+ 14 - 9
main/ui/src/main/resources/fxml/vault_detail.fxml

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <?import javafx.geometry.Insets?>
-<?import javafx.scene.layout.VBox?>
 <?import javafx.scene.control.Button?>
+<?import javafx.scene.layout.VBox?>
 <?import javafx.scene.text.Text?>
 <?import javafx.scene.text.TextFlow?>
 <VBox xmlns="http://javafx.com/javafx"
@@ -14,18 +14,23 @@
 	</padding>
 	<children>
 		<!--TODO: add caption style class -->
-		<Text text="${controller.vault.displayableName}" />
-		<TextFlow><!--TODO: add visibility of the textflows -->
-			<Text text="%vaultDetail.info.storageLocation" />
+		<Text text="${controller.vault.displayableName}"/>
+		<TextFlow visible="${controller.anyVaultSelected}"><!--TODO: add visibility of the textflows -->
+			<Text text="%vaultDetail.info.storageLocation"/>
+			<Text text="&quot;"/>
 			<Text text="${controller.vault.displayablePath}"/>
+			<Text text="&quot;"/>
 		</TextFlow>
-		<TextFlow>
-			<Text text="%vaultDetail.info.accessLocation" />
+		<TextFlow visible="${controller.anyVaultSelected}">
+			<Text text="%vaultDetail.info.accessLocation"/>
+			<Text text="&quot;"/>
 			<Text text="${controller.vault.customMountPath}"/>
+			<Text text="&quot;"/>
 		</TextFlow>
-		<TextFlow>
-			<Text text="%vaultDetail.info.currentState" />
-			<Text text="${controller.vault.locked}"/>
+		<TextFlow visible="${controller.anyVaultSelected}">
+			<Text text="%vaultDetail.info.currentState"/>
+			<Text text="LOCKED" visible="${controller.vault.locked}" managed="${controller.vault.locked}"/><!-- hacky but working -->
+			<Text text="UNLOCKED" visible="${controller.vault.unlocked}" managed="${controller.vault.unlocked}"/>
 		</TextFlow>
 
 		<Button text="TODO unlock" onAction="#unlock" visible="${controller.vault.locked}" defaultButton="${controller.vault.locked}"/>

+ 1 - 1
main/ui/src/main/resources/i18n/strings.properties

@@ -65,7 +65,7 @@ main.closeBtn.tooltip=Close
 main.settingsBtn.tooltip=Settings
 vaultlist.emptyList.onboardingInstruction=Click here to add a vault
 ## Vault detail
-vaultDetail.info.storageLocation=Stored at
+vaultDetail.info.storageLocation=Stored at 
 vaultDetail.info.accessLocation=Accesssible at
 vaultDetail.info.currentState=Currently