mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-14 08:41:28 +00:00
rename supporterCert WhiteSpace and VaultNameLength methods
This commit is contained in:
@@ -34,10 +34,10 @@ public class SupporterCertificateController implements FxController {
|
||||
public void initialize() {
|
||||
supporterCertificateField.setText(licenseHolder.getLicenseKey().orElse(null));
|
||||
supporterCertificateField.textProperty().addListener(this::registrationKeyChanged);
|
||||
supporterCertificateField.setTextFormatter(new TextFormatter<>(this::checkVaultNameLength));
|
||||
supporterCertificateField.setTextFormatter(new TextFormatter<>(this::removeWhitespaces));
|
||||
}
|
||||
|
||||
private TextFormatter.Change checkVaultNameLength(TextFormatter.Change change) {
|
||||
private TextFormatter.Change removeWhitespaces(TextFormatter.Change change) {
|
||||
if (change.isContentChange()) {
|
||||
var strippedText = CharMatcher.whitespace().removeFrom(change.getText());
|
||||
change.setText(strippedText);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class GeneralVaultOptionsController implements FxController {
|
||||
public void initialize() {
|
||||
vaultName.textProperty().set(vault.getVaultSettings().displayName().get());
|
||||
vaultName.focusedProperty().addListener(this::trimVaultNameOnFocusLoss);
|
||||
vaultName.setTextFormatter(new TextFormatter<>(this::removeWhitespaces));
|
||||
vaultName.setTextFormatter(new TextFormatter<>(this::checkVaultNameLength));
|
||||
unlockOnStartupCheckbox.selectedProperty().bindBidirectional(vault.getVaultSettings().unlockAfterStartup());
|
||||
actionAfterUnlockChoiceBox.getItems().addAll(WhenUnlocked.values());
|
||||
actionAfterUnlockChoiceBox.valueProperty().bindBidirectional(vault.getVaultSettings().actionAfterUnlock());
|
||||
@@ -63,7 +63,7 @@ public class GeneralVaultOptionsController implements FxController {
|
||||
}
|
||||
}
|
||||
|
||||
private TextFormatter.Change removeWhitespaces(TextFormatter.Change change) {
|
||||
private TextFormatter.Change checkVaultNameLength(TextFormatter.Change change) {
|
||||
if (change.isContentChange() && change.getControlNewText().length() > VAULTNAME_TRUNCATE_THRESHOLD) {
|
||||
return null; // reject any change that would lead to a text exceeding threshold
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user