Kaynağa Gözat

Fixed Next button for Invalid Vault Name

Carrima Hewitt 2 yıl önce
ebeveyn
işleme
4c96c285bf

+ 1 - 1
.idea/misc.xml

@@ -8,7 +8,7 @@
       </list>
     </option>
   </component>
-  <component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
     <output url="file://$PROJECT_DIR$/out" />
   </component>
 </project>

+ 10 - 6
src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultNameController.java

@@ -40,7 +40,7 @@ public class CreateNewVaultNameController implements FxController {
 		this.chooseLocationScene = chooseLocationScene;
 		this.vaultPath = vaultPath;
 		this.vaultName = vaultName;
-		this.validVaultName = Bindings.createBooleanBinding(this::isValidVaultNameInternal, vaultName);
+		this.validVaultName = Bindings.createBooleanBinding(this::isValidVaultName, vaultName);
 	}
 
 	@FXML
@@ -49,10 +49,6 @@ public class CreateNewVaultNameController implements FxController {
 		vaultName.addListener(this::vaultNameChanged);
 	}
 
-	private boolean isValidVaultNameInternal() {
-		return vaultName.get() != null && VALID_NAME_PATTERN.matcher(vaultName.get().trim()).matches();
-	}
-
 	private void vaultNameChanged(@SuppressWarnings("unused") Observable observable) {
 		if (isValidVaultName()) {
 			if (vaultPath.get() != null) {
@@ -79,7 +75,15 @@ public class CreateNewVaultNameController implements FxController {
 	}
 
 	public boolean isValidVaultName() {
-		return validVaultName.get();
+		return vaultName.get() != null && VALID_NAME_PATTERN.matcher(vaultName.get().trim()).matches();
+		//return validVaultName.get();
 	}
+	/*
+	* Issue with next button:
+	* In the "addvault_new_location.fxml" class's method "buttonMinWidth," the next button was referring to an inValidVaultPath function which does not exist...
+	* I changed it to "!controller.validVaultName" and that worked
+	*
+	* Other "issue" I noticed is that closing the application window does not stop the program. Unsure if this is a major issue.
+	* */
 
 }

+ 1 - 1
src/main/resources/fxml/addvault_new_name.fxml

@@ -71,7 +71,7 @@
 		<ButtonBar buttonMinWidth="120" buttonOrder="B+X">
 			<buttons>
 				<Button text="%generic.button.back" ButtonBar.buttonData="BACK_PREVIOUS" onAction="#back"/>
-				<Button text="%generic.button.next" ButtonBar.buttonData="NEXT_FORWARD" onAction="#next" defaultButton="true" disable="${controller.invalidVaultName}"/>
+				<Button text="%generic.button.next" ButtonBar.buttonData="NEXT_FORWARD" onAction="#next" defaultButton="true" disable="${!controller.validVaultName}"/>
 			</buttons>
 		</ButtonBar>
 	</children>