disable clear button when no utxos are selected

This commit is contained in:
Craig Raw 2022-04-26 16:03:49 +02:00
parent 516ee26ba0
commit 6aa3bb2ff3
2 changed files with 6 additions and 1 deletions

View file

@ -83,6 +83,9 @@ public class UtxosController extends WalletFormController implements Initializab
@FXML @FXML
private Button mixTo; private Button mixTo;
@FXML
private Button clear;
@FXML @FXML
private Button sendSelected; private Button sendSelected;
@ -172,6 +175,7 @@ public class UtxosController extends WalletFormController implements Initializab
} }
} }
clear.setDisable(true);
sendSelected.setDisable(true); sendSelected.setDisable(true);
sendSelected.setTooltip(new Tooltip("Send selected UTXOs. Use " + (org.controlsfx.tools.Platform.getCurrent() == org.controlsfx.tools.Platform.OSX ? "Cmd" : "Ctrl") + "+click to select multiple." )); sendSelected.setTooltip(new Tooltip("Send selected UTXOs. Use " + (org.controlsfx.tools.Platform.getCurrent() == org.controlsfx.tools.Platform.OSX ? "Cmd" : "Ctrl") + "+click to select multiple." ));
mixSelected.managedProperty().bind(mixSelected.visibleProperty()); mixSelected.managedProperty().bind(mixSelected.visibleProperty());
@ -199,6 +203,7 @@ public class UtxosController extends WalletFormController implements Initializab
private void updateButtons(BitcoinUnit unit) { private void updateButtons(BitcoinUnit unit) {
List<Entry> selectedEntries = getSelectedEntries(); List<Entry> selectedEntries = getSelectedEntries();
clear.setDisable(selectedEntries.isEmpty());
sendSelected.setDisable(selectedEntries.isEmpty()); sendSelected.setDisable(selectedEntries.isEmpty());
mixSelected.setDisable(selectedEntries.isEmpty() || !AppServices.isConnected()); mixSelected.setDisable(selectedEntries.isEmpty() || !AppServices.isConnected());

View file

@ -83,7 +83,7 @@
</HBox> </HBox>
<Region HBox.hgrow="ALWAYS" /> <Region HBox.hgrow="ALWAYS" />
<HBox styleClass="utxos-buttons-box" spacing="20" alignment="BOTTOM_RIGHT"> <HBox styleClass="utxos-buttons-box" spacing="20" alignment="BOTTOM_RIGHT">
<Button text="Clear" onAction="#clear"/> <Button fx:id="clear" text="Clear" onAction="#clear"/>
<Button fx:id="mixSelected" text="Mix Selected" graphicTextGap="5" onAction="#mixSelected"> <Button fx:id="mixSelected" text="Mix Selected" graphicTextGap="5" onAction="#mixSelected">
<graphic> <graphic>
<Glyph fontFamily="Font Awesome 5 Free Solid" icon="RANDOM" fontSize="12" /> <Glyph fontFamily="Font Awesome 5 Free Solid" icon="RANDOM" fontSize="12" />