mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 12:46:45 +00:00
fix issues when removing selected items from utxotreetable
This commit is contained in:
parent
86a49e0d9a
commit
a934ffa76c
1 changed files with 10 additions and 1 deletions
|
@ -30,6 +30,7 @@ import javafx.fxml.FXML;
|
|||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Tooltip;
|
||||
import javafx.scene.control.TreeItem;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.stage.FileChooser;
|
||||
import javafx.stage.Stage;
|
||||
|
@ -192,7 +193,9 @@ public class UtxosController extends WalletFormController implements Initializab
|
|||
}
|
||||
|
||||
private List<Entry> getSelectedEntries() {
|
||||
return utxosTable.getSelectionModel().getSelectedCells().stream().map(tp -> (UtxoEntry)tp.getTreeItem().getValue())
|
||||
return utxosTable.getSelectionModel().getSelectedCells().stream()
|
||||
.filter(tp -> tp.getTreeItem() != null)
|
||||
.map(tp -> (UtxoEntry)tp.getTreeItem().getValue())
|
||||
.filter(utxoEntry -> utxoEntry.isSpendable() && !utxoEntry.isMixing())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
@ -445,9 +448,15 @@ public class UtxosController extends WalletFormController implements Initializab
|
|||
if(event.getWallet().equals(walletForm.getWallet())) {
|
||||
WalletUtxosEntry walletUtxosEntry = getWalletForm().getWalletUtxosEntry();
|
||||
|
||||
List<Entry> selectedEntries = utxosTable.getSelectionModel().getSelectedItems().stream().map(TreeItem::getValue).filter(Objects::nonNull).toList();
|
||||
|
||||
//Will automatically update utxosTable
|
||||
walletUtxosEntry.updateUtxos();
|
||||
|
||||
if(!walletUtxosEntry.getChildren().containsAll(selectedEntries)) {
|
||||
utxosTable.getSelectionModel().clearSelection();
|
||||
}
|
||||
|
||||
utxosTable.updateHistory(event.getHistoryChangedNodes());
|
||||
utxosChart.update(walletUtxosEntry);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue