Browse Source

explicitly place decorationpane in the scene graph to avoid app resizing issues

terminal
Craig Raw 4 years ago
parent
commit
c5b09189df
  1. 2
      build.gradle
  2. 2
      src/main/java/com/sparrowwallet/sparrow/control/DevicePane.java
  3. 2
      src/main/java/com/sparrowwallet/sparrow/control/MessageSignDialog.java
  4. 4
      src/main/java/com/sparrowwallet/sparrow/control/MnemonicKeystoreImportPane.java
  5. 2
      src/main/java/com/sparrowwallet/sparrow/control/TransactionIdDialog.java
  6. 2
      src/main/java/com/sparrowwallet/sparrow/control/WalletBirthDateDialog.java
  7. 2
      src/main/java/com/sparrowwallet/sparrow/control/WalletNameDialog.java
  8. 2
      src/main/java/com/sparrowwallet/sparrow/control/WalletPasswordDialog.java
  9. 4
      src/main/java/com/sparrowwallet/sparrow/control/XprvKeystoreImportPane.java
  10. 4
      src/main/java/com/sparrowwallet/sparrow/preferences/ServerPreferencesController.java
  11. 4
      src/main/java/com/sparrowwallet/sparrow/wallet/KeystoreController.java
  12. 2
      src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java
  13. 5
      src/main/resources/com/sparrowwallet/sparrow/app.fxml

2
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",

2
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 -> {

2
src/main/java/com/sparrowwallet/sparrow/control/MessageSignDialog.java

@ -193,8 +193,8 @@ public class MessageSignDialog extends Dialog<ButtonBar.ButtonData> {
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) -> {

4
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);

2
src/main/java/com/sparrowwallet/sparrow/control/TransactionIdDialog.java

@ -45,12 +45,12 @@ public class TransactionIdDialog extends Dialog<Sha256Hash> {
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);

2
src/main/java/com/sparrowwallet/sparrow/control/WalletBirthDateDialog.java

@ -52,10 +52,10 @@ public class WalletBirthDateDialog extends Dialog<Date> {
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);

2
src/main/java/com/sparrowwallet/sparrow/control/WalletNameDialog.java

@ -93,6 +93,7 @@ public class WalletNameDialog extends Dialog<WalletNameDialog.NameAndBirthDate>
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<WalletNameDialog.NameAndBirthDate>
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);

2
src/main/java/com/sparrowwallet/sparrow/control/WalletPasswordDialog.java

@ -77,8 +77,8 @@ public class WalletPasswordDialog extends Dialog<SecureString> {
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);

4
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);

4
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

4
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() {

2
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);
}

5
src/main/resources/com/sparrowwallet/sparrow/app.fxml

@ -8,6 +8,7 @@
<?import com.sparrowwallet.sparrow.control.UnlabeledToggleSwitch?>
<?import com.sparrowwallet.drongo.BitcoinUnit?>
<?import com.sparrowwallet.sparrow.Theme?>
<?import impl.org.controlsfx.skin.DecorationPane?>
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="200" minWidth="350" prefHeight="770.0" prefWidth="1020.0" fx:controller="com.sparrowwallet.sparrow.AppController" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1">
<children>
@ -110,11 +111,11 @@
</Menu>
</menus>
</MenuBar>
<StackPane fx:id="rootStack" VBox.vgrow="ALWAYS">
<DecorationPane fx:id="rootStack" VBox.vgrow="ALWAYS">
<Rectangle styleClass="background-box" width="400" height="125" />
<Text styleClass="background-text" text="Drag files here to open" />
<TabPane fx:id="tabs" />
</StackPane>
</DecorationPane>
<StatusBar fx:id="statusBar" text="" minHeight="36">
<rightItems>

Loading…
Cancel
Save