diff --git a/build.gradle b/build.gradle index ea6228c4..1e125aa0 100644 --- a/build.gradle +++ b/build.gradle @@ -105,6 +105,7 @@ run { "--add-opens=javafx.base/com.sun.javafx.event=org.controlsfx.controls", "--add-opens=javafx.controls/javafx.scene.control.cell=com.sparrowwallet.sparrow", "--add-opens=org.controlsfx.controls/impl.org.controlsfx.skin=com.sparrowwallet.sparrow", + "--add-opens=org.controlsfx.controls/impl.org.controlsfx.skin=javafx.fxml", "--add-opens=javafx.graphics/com.sun.javafx.tk=centerdevice.nsmenufx", "--add-opens=javafx.graphics/com.sun.javafx.tk.quantum=centerdevice.nsmenufx", "--add-opens=javafx.graphics/com.sun.glass.ui=centerdevice.nsmenufx", @@ -143,6 +144,7 @@ jlink { "--add-opens=javafx.base/com.sun.javafx.event=org.controlsfx.controls", "--add-opens=javafx.controls/javafx.scene.control.cell=com.sparrowwallet.sparrow", "--add-opens=org.controlsfx.controls/impl.org.controlsfx.skin=com.sparrowwallet.sparrow", + "--add-opens=org.controlsfx.controls/impl.org.controlsfx.skin=javafx.fxml", "--add-opens=javafx.graphics/com.sun.javafx.tk=com.sparrowwallet.merged.module", "--add-opens=javafx.graphics/com.sun.javafx.tk.quantum=com.sparrowwallet.merged.module", "--add-opens=javafx.graphics/com.sun.glass.ui=com.sparrowwallet.merged.module", diff --git a/src/main/java/com/sparrowwallet/sparrow/control/DevicePane.java b/src/main/java/com/sparrowwallet/sparrow/control/DevicePane.java index bb813eeb..8c219f30 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/DevicePane.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/DevicePane.java @@ -627,11 +627,11 @@ public class DevicePane extends TitledDescriptionPane { HBox.setHgrow(derivationField, Priority.ALWAYS); ValidationSupport validationSupport = new ValidationSupport(); + validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); validationSupport.registerValidator(derivationField, Validator.combine( Validator.createEmptyValidator("Derivation is required"), (Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Invalid derivation", !KeyDerivation.isValid(newValue)) )); - validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); Button importDerivationButton = new Button("Import"); importDerivationButton.setOnAction(event -> { diff --git a/src/main/java/com/sparrowwallet/sparrow/control/MessageSignDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/MessageSignDialog.java index 9f39094a..64c407aa 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/MessageSignDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/MessageSignDialog.java @@ -193,8 +193,8 @@ public class MessageSignDialog extends Dialog { ValidationSupport validationSupport = new ValidationSupport(); Platform.runLater(() -> { - validationSupport.registerValidator(address, (Control c, String newValue) -> ValidationResult.fromErrorIf(c, "Invalid address", !isValidAddress())); validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); + validationSupport.registerValidator(address, (Control c, String newValue) -> ValidationResult.fromErrorIf(c, "Invalid address", !isValidAddress())); }); address.textProperty().addListener((observable, oldValue, newValue) -> { diff --git a/src/main/java/com/sparrowwallet/sparrow/control/MnemonicKeystoreImportPane.java b/src/main/java/com/sparrowwallet/sparrow/control/MnemonicKeystoreImportPane.java index be30fcd1..54fbddd8 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/MnemonicKeystoreImportPane.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/MnemonicKeystoreImportPane.java @@ -427,11 +427,11 @@ public class MnemonicKeystoreImportPane extends TitledDescriptionPane { autoCompletionBinding.setDelay(50); ValidationSupport validationSupport = new ValidationSupport(); + validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); validationSupport.registerValidator(wordField, Validator.combine( Validator.createEmptyValidator("Word is required"), (Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Invalid word", !wordList.contains(newValue)) )); - validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); wordField.textProperty().addListener((observable, oldValue, newValue) -> { wordEntryList.set(wordNumber, newValue); @@ -501,11 +501,11 @@ public class MnemonicKeystoreImportPane extends TitledDescriptionPane { HBox.setHgrow(derivationField, Priority.ALWAYS); ValidationSupport validationSupport = new ValidationSupport(); + validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); validationSupport.registerValidator(derivationField, Validator.combine( Validator.createEmptyValidator("Derivation is required"), (Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Invalid derivation", !KeyDerivation.isValid(newValue)) )); - validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); Button importDerivationButton = new Button("Import Custom Derivation Keystore"); importDerivationButton.setDisable(true); diff --git a/src/main/java/com/sparrowwallet/sparrow/control/TransactionIdDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/TransactionIdDialog.java index dc8e0d10..76a9c3ac 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/TransactionIdDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/TransactionIdDialog.java @@ -45,12 +45,12 @@ public class TransactionIdDialog extends Dialog { ValidationSupport validationSupport = new ValidationSupport(); Platform.runLater(() -> { + validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); validationSupport.registerValidator(txid, Validator.combine( Validator.createEmptyValidator("Transaction id is required"), (Control c, String newValue) -> ValidationResult.fromErrorIf(c, "Transaction ID length incorrect", newValue.length() != 64), (Control c, String newValue) -> ValidationResult.fromErrorIf(c, "Transaction ID must be hexadecimal", !Utils.isHex(newValue)) )); - validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); }); final ButtonType okButtonType = new javafx.scene.control.ButtonType("Open Transaction", ButtonBar.ButtonData.OK_DONE); diff --git a/src/main/java/com/sparrowwallet/sparrow/control/WalletBirthDateDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/WalletBirthDateDialog.java index 103665c1..2bdcaa70 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/WalletBirthDateDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/WalletBirthDateDialog.java @@ -52,10 +52,10 @@ public class WalletBirthDateDialog extends Dialog { ValidationSupport validationSupport = new ValidationSupport(); Platform.runLater( () -> { + validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); validationSupport.registerValidator(birthDatePicker, Validator.combine( (Control c, LocalDate newValue) -> ValidationResult.fromErrorIf( c, "Birth date not specified", newValue == null) )); - validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); }); final ButtonType okButtonType = new javafx.scene.control.ButtonType("Rescan Wallet", ButtonBar.ButtonData.OK_DONE); diff --git a/src/main/java/com/sparrowwallet/sparrow/control/WalletNameDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/WalletNameDialog.java index e0b33a69..a7f8a996 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/WalletNameDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/WalletNameDialog.java @@ -93,6 +93,7 @@ public class WalletNameDialog extends Dialog ValidationSupport validationSupport = new ValidationSupport(); Platform.runLater( () -> { + validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); validationSupport.registerValidator(name, Validator.combine( Validator.createEmptyValidator("Wallet name is required"), (Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Wallet name is not unique", Storage.walletExists(newValue)) @@ -100,7 +101,6 @@ public class WalletNameDialog extends Dialog validationSupport.registerValidator(existingPicker, Validator.combine( (Control c, LocalDate newValue) -> ValidationResult.fromErrorIf( c, "Birth date not specified", existingCheck.isSelected() && newValue == null) )); - validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); }); final ButtonType okButtonType = new javafx.scene.control.ButtonType("Create Wallet", ButtonBar.ButtonData.OK_DONE); diff --git a/src/main/java/com/sparrowwallet/sparrow/control/WalletPasswordDialog.java b/src/main/java/com/sparrowwallet/sparrow/control/WalletPasswordDialog.java index fda849da..fd8a78b8 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/WalletPasswordDialog.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/WalletPasswordDialog.java @@ -77,8 +77,8 @@ public class WalletPasswordDialog extends Dialog { ValidationSupport validationSupport = new ValidationSupport(); Platform.runLater( () -> { - validationSupport.registerValidator(passwordConfirm, (Control c, String newValue) -> ValidationResult.fromErrorIf(c, "Password confirmation does not match", !passwordConfirm.getText().equals(password.getText()))); validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); + validationSupport.registerValidator(passwordConfirm, (Control c, String newValue) -> ValidationResult.fromErrorIf(c, "Password confirmation does not match", !passwordConfirm.getText().equals(password.getText()))); }); okButtonType = new javafx.scene.control.ButtonType(requirement.okButtonText, ButtonBar.ButtonData.OK_DONE); diff --git a/src/main/java/com/sparrowwallet/sparrow/control/XprvKeystoreImportPane.java b/src/main/java/com/sparrowwallet/sparrow/control/XprvKeystoreImportPane.java index fad9bdbb..ffe20fa2 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/XprvKeystoreImportPane.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/XprvKeystoreImportPane.java @@ -135,11 +135,11 @@ public class XprvKeystoreImportPane extends TitledDescriptionPane { } ValidationSupport validationSupport = new ValidationSupport(); + validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); validationSupport.registerValidator(xprvField, Validator.combine( Validator.createEmptyValidator("xprv is required"), (Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Invalid private key", !ExtendedKey.isValid(newValue) || ExtendedKey.fromDescriptor(newValue).getKey().isPubKeyOnly()) )); - validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); Button importXprvButton = new Button("Import"); importXprvButton.setMinWidth(80); @@ -176,11 +176,11 @@ public class XprvKeystoreImportPane extends TitledDescriptionPane { HBox.setHgrow(derivationField, Priority.ALWAYS); ValidationSupport validationSupport = new ValidationSupport(); + validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); validationSupport.registerValidator(derivationField, Validator.combine( Validator.createEmptyValidator("Derivation is required"), (Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Invalid derivation", !KeyDerivation.isValid(newValue)) )); - validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); Button importDerivationButton = new Button("Import Custom Derivation Keystore"); importDerivationButton.setDisable(true); diff --git a/src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java b/src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java index 83e09b0f..476873b6 100644 --- a/src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java +++ b/src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java @@ -580,6 +580,8 @@ public class ServerPreferencesController extends PreferencesDetailController { } private void setupValidation() { + validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); + validationSupport.registerValidator(publicProxyHost, Validator.combine( (Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Proxy host required", publicUseProxy.isSelected() && newValue.isEmpty()), (Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Invalid host name", getHost(newValue) == null) @@ -629,8 +631,6 @@ public class ServerPreferencesController extends PreferencesDetailController { validationSupport.registerValidator(electrumCertificate, Validator.combine( (Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Invalid certificate file", newValue != null && !newValue.isEmpty() && getCertificate(newValue) == null) )); - - validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); } @NotNull diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java index 7e0667a9..e4b3ca0e 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java @@ -219,6 +219,8 @@ public class KeystoreController extends WalletFormController implements Initiali } private void setupValidation() { + validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); + validationSupport.registerValidator(label, Validator.combine( Validator.createEmptyValidator("Label is required"), (Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Label is not unique", walletForm.getWallet().getKeystores().stream().filter(k -> k != keystore).map(Keystore::getLabel).collect(Collectors.toList()).contains(newValue)), @@ -240,8 +242,6 @@ public class KeystoreController extends WalletFormController implements Initiali Validator.createEmptyValidator("Master fingerprint is required"), (Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Master fingerprint is invalid", (newValue == null || newValue.length() != 8 || !Utils.isHex(newValue))) )); - - validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); } private void updateType() { diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java index a399d712..45389a1d 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java @@ -401,13 +401,13 @@ public class SendController extends WalletFormController implements Initializabl private void addValidation() { validationSupport = new ValidationSupport(); + validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); validationSupport.registerValidator(fee, Validator.combine( (Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Insufficient Inputs", userFeeSet.get() && insufficientInputsProperty.get()), (Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Insufficient Fee", getFeeValueSats() != null && getFeeValueSats() == 0), (Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Insufficient Fee Rate", isInsufficientFeeRate()) )); - validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); validationSupport.setErrorDecorationEnabled(false); } diff --git a/src/main/resources/com/sparrowwallet/sparrow/app.fxml b/src/main/resources/com/sparrowwallet/sparrow/app.fxml index 9bb8584f..c77731d4 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/app.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/app.fxml @@ -8,6 +8,7 @@ + @@ -110,11 +111,11 @@ - + - +