implement requested changes from PR review

This commit is contained in:
Jan-Peter Klein
2023-07-06 11:03:34 +02:00
parent 09b638eafa
commit f817bc5378
4 changed files with 9 additions and 12 deletions

View File

@@ -26,6 +26,7 @@ public class CreateNewVaultExpertSettingsController implements FxController {
public static final int DEFAULT_SHORTENING_THRESHOLD = 220;
public static final int MIN_SHORTENING_THRESHOLD = 36;
private static final String DOCS_NAME_SHORTENING_URL = "https://docs.cryptomator.org/en/1.7/security/architecture/#name-shortening";
private final Stage window;
private final Lazy<Application> application;
private final Lazy<Scene> chooseLocationScene;
@@ -60,6 +61,8 @@ public class CreateNewVaultExpertSettingsController implements FxController {
@FXML
public void initialize() {
shorteningThresholdTextField.setPromptText(MIN_SHORTENING_THRESHOLD + "-" + DEFAULT_SHORTENING_THRESHOLD);
shorteningThresholdTextField.setText(Integer.toString(DEFAULT_SHORTENING_THRESHOLD));
shorteningThresholdTextField.textProperty().addListener((observable, oldValue, newValue) -> {
try {
int intValue = Integer.parseInt(newValue);
@@ -73,7 +76,7 @@ public class CreateNewVaultExpertSettingsController implements FxController {
@FXML
public void toggleUseExpertSettings() {
if (!expertSettingsCheckBox.isSelected()) {
shorteningThresholdTextField.setText(DEFAULT_SHORTENING_THRESHOLD + "");
shorteningThresholdTextField.setText(Integer.toString(DEFAULT_SHORTENING_THRESHOLD));
}
}
@@ -92,15 +95,11 @@ public class CreateNewVaultExpertSettingsController implements FxController {
}
public boolean isValidShorteningThreshold() {
try {
var value = shorteningThreshold.get();
if (value < MIN_SHORTENING_THRESHOLD || value > DEFAULT_SHORTENING_THRESHOLD) {
return false;
} else {
return true;
}
} catch (NumberFormatException e) {
var value = shorteningThreshold.get();
if (value < MIN_SHORTENING_THRESHOLD || value > DEFAULT_SHORTENING_THRESHOLD) {
return false;
} else {
return true;
}
}

View File

@@ -70,7 +70,6 @@ public class CreateNewVaultLocationController implements FxController {
@Inject
CreateNewVaultLocationController(@AddVaultWizardWindow Stage window, //
@FxmlScene(FxmlFile.ADDVAULT_NEW_NAME) Lazy<Scene> chooseNameScene, //
@FxmlScene(FxmlFile.ADDVAULT_NEW_PASSWORD) Lazy<Scene> choosePasswordScene, //
@FxmlScene(FxmlFile.ADDVAULT_NEW_EXPERT_SETTINGS) Lazy<Scene> chooseExpertSettingsScene, //
ObjectProperty<Path> vaultPath, //
@Named("vaultName") StringProperty vaultName, //