add select all button to utxos tab

This commit is contained in:
Craig Raw 2022-04-28 13:10:52 +02:00
parent 1ccfc3c042
commit 6931cf7a45
3 changed files with 11 additions and 1 deletions

View file

@ -83,6 +83,9 @@ public class UtxosController extends WalletFormController implements Initializab
@FXML
private Button mixTo;
@FXML
private Button selectAll;
@FXML
private Button clear;
@ -194,6 +197,7 @@ public class UtxosController extends WalletFormController implements Initializab
balance.setValue(walletUtxosEntry.getBalance());
mempoolBalance.setValue(walletUtxosEntry.getMempoolBalance());
utxoCount.setText(walletUtxosEntry.getChildren() != null ? Integer.toString(walletUtxosEntry.getChildren().size()) : "0");
selectAll.setDisable(walletUtxosEntry.getChildren() == null || walletUtxosEntry.getChildren().size() == 0);
}
private boolean canWalletMix() {
@ -203,6 +207,7 @@ public class UtxosController extends WalletFormController implements Initializab
private void updateButtons(BitcoinUnit unit) {
List<Entry> selectedEntries = getSelectedEntries();
selectAll.setDisable(utxosTable.getRoot().getChildren().size() == utxosTable.getSelectionModel().getSelectedCells().size());
clear.setDisable(selectedEntries.isEmpty());
sendSelected.setDisable(selectedEntries.isEmpty());
mixSelected.setDisable(selectedEntries.isEmpty() || !AppServices.isConnected());
@ -374,6 +379,10 @@ public class UtxosController extends WalletFormController implements Initializab
.collect(Collectors.toList());
}
public void selectAll(ActionEvent event) {
utxosTable.getSelectionModel().selectAll();
}
public void clear(ActionEvent event) {
utxosTable.getSelectionModel().clearSelection();
}

View file

@ -213,7 +213,7 @@ public class WalletForm {
private void updateWallets(Integer blockHeight, Wallet previousWallet) {
List<WalletNode> nestedHistoryChangedNodes = new ArrayList<>();
for(Wallet childWallet : wallet.getChildWallets()) {
for(Wallet childWallet : new ArrayList<>(wallet.getChildWallets())) {
if(childWallet.isNested()) {
Wallet previousChildWallet = previousWallet.getChildWallet(childWallet.getName());
if(previousChildWallet != null) {

View file

@ -83,6 +83,7 @@
</HBox>
<Region HBox.hgrow="ALWAYS" />
<HBox styleClass="utxos-buttons-box" spacing="20" alignment="BOTTOM_RIGHT">
<Button fx:id="selectAll" text="Select All" onAction="#selectAll"/>
<Button fx:id="clear" text="Clear" onAction="#clear"/>
<Button fx:id="mixSelected" text="Mix Selected" graphicTextGap="5" onAction="#mixSelected">
<graphic>