Browse Source

fix combobox texfield repeat selection

terminal
Craig Raw 3 years ago
parent
commit
e26587e807
  1. 14
      src/main/java/com/sparrowwallet/sparrow/control/ComboBoxTextField.java
  2. 2
      src/main/java/com/sparrowwallet/sparrow/io/ColdcardMultisig.java
  3. 2
      src/main/java/com/sparrowwallet/sparrow/io/ColdcardSinglesig.java

14
src/main/java/com/sparrowwallet/sparrow/control/ComboBoxTextField.java

@ -1,5 +1,6 @@
package com.sparrowwallet.sparrow.control;
import javafx.application.Platform;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.scene.Cursor;
@ -12,12 +13,13 @@ import org.controlsfx.control.textfield.CustomTextField;
public class ComboBoxTextField extends CustomTextField {
private final ObjectProperty<ComboBox<?>> comboProperty = new SimpleObjectProperty<>();
private boolean initialized;
private boolean comboShowing;
public ComboBoxTextField() {
super();
getStyleClass().add("combo-text-field");
setupCopyButtonField(super.rightProperty());
setupComboButtonField(super.rightProperty());
disabledProperty().addListener((observable, oldValue, newValue) -> {
if(comboProperty.isNotNull().get()) {
@ -26,7 +28,7 @@ public class ComboBoxTextField extends CustomTextField {
});
}
private void setupCopyButtonField(ObjectProperty<Node> rightProperty) {
private void setupComboButtonField(ObjectProperty<Node> rightProperty) {
Region showComboButton = new Region();
showComboButton.getStyleClass().addAll("graphic"); //$NON-NLS-1$
StackPane showComboButtonPane = new StackPane(showComboButton);
@ -41,6 +43,14 @@ public class ComboBoxTextField extends CustomTextField {
}
comboShowing = !comboShowing;
if(!initialized) {
comboProperty.get().valueProperty().addListener((observable, oldValue, newValue) -> {
comboShowing = false;
Platform.runLater(() -> comboProperty.get().getSelectionModel().clearSelection());
});
initialized = true;
}
}
});

2
src/main/java/com/sparrowwallet/sparrow/io/ColdcardMultisig.java

@ -85,7 +85,7 @@ public class ColdcardMultisig implements WalletImport, KeystoreFileImport, Walle
@Override
public String getKeystoreImportDescription() {
return "Import file created by using the Settings > Multisig Wallets > Export XPUB feature on your Coldcard.";
return "Import file created by using the Settings > Multisig Wallets > Export XPUB > 0 feature on your Coldcard.";
}
@Override

2
src/main/java/com/sparrowwallet/sparrow/io/ColdcardSinglesig.java

@ -29,7 +29,7 @@ public class ColdcardSinglesig implements KeystoreFileImport, WalletImport {
@Override
public String getKeystoreImportDescription() {
return "Import file created by using the Advanced > MicroSD > Export Wallet > Generic JSON feature on your Coldcard. Note this requires firmware version 3.1.3 or later.";
return "Import file created by using the Advanced > MicroSD > Export Wallet > Generic JSON > 0 feature on your Coldcard. Note this requires firmware version 3.1.3 or later.";
}
@Override

Loading…
Cancel
Save