mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
add copy context menu to date/address/output column in search wallet dialog
This commit is contained in:
parent
41146310d6
commit
2d0a94d024
2 changed files with 15 additions and 3 deletions
|
@ -606,7 +606,7 @@ public class EntryCell extends TreeTableCell<Entry, Entry> implements Confirmati
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class TransactionContextMenu extends ContextMenu {
|
protected static class TransactionContextMenu extends ContextMenu {
|
||||||
public TransactionContextMenu(String date, BlockTransaction blockTransaction) {
|
public TransactionContextMenu(String date, BlockTransaction blockTransaction) {
|
||||||
MenuItem viewTransaction = new MenuItem("View Transaction");
|
MenuItem viewTransaction = new MenuItem("View Transaction");
|
||||||
viewTransaction.setGraphic(getViewTransactionGlyph());
|
viewTransaction.setGraphic(getViewTransactionGlyph());
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class SearchWalletDialog extends Dialog<Entry> {
|
||||||
dialogPane.getStylesheets().add(AppServices.class.getResource("wallet/wallet.css").toExternalForm());
|
dialogPane.getStylesheets().add(AppServices.class.getResource("wallet/wallet.css").toExternalForm());
|
||||||
dialogPane.getStylesheets().add(AppServices.class.getResource("search.css").toExternalForm());
|
dialogPane.getStylesheets().add(AppServices.class.getResource("search.css").toExternalForm());
|
||||||
AppServices.setStageIcon(dialogPane.getScene().getWindow());
|
AppServices.setStageIcon(dialogPane.getScene().getWindow());
|
||||||
dialogPane.setHeaderText(showWallet ? "Search All Wallets" : "Search Wallet");
|
dialogPane.setHeaderText(showWallet ? "Search All Wallets" : "Search Wallet " + walletForms.get(0).getMasterWallet().getName());
|
||||||
|
|
||||||
Image image = new Image("image/sparrow-small.png", 50, 50, false, false);
|
Image image = new Image("image/sparrow-small.png", 50, 50, false, false);
|
||||||
if(!image.isError()) {
|
if(!image.isError()) {
|
||||||
|
@ -265,7 +265,19 @@ public class SearchWalletDialog extends Dialog<Entry> {
|
||||||
@Override
|
@Override
|
||||||
protected void updateItem(Entry entry, boolean empty) {
|
protected void updateItem(Entry entry, boolean empty) {
|
||||||
super.updateItem(entry, empty);
|
super.updateItem(entry, empty);
|
||||||
setContextMenu(null);
|
|
||||||
|
ContextMenu copyMenu;
|
||||||
|
if(entry instanceof TransactionEntry transactionEntry) {
|
||||||
|
copyMenu = new TransactionContextMenu(getText(), transactionEntry.getBlockTransaction());
|
||||||
|
} else if(entry instanceof NodeEntry nodeEntry) {
|
||||||
|
copyMenu = new AddressContextMenu(nodeEntry.getAddress(), nodeEntry.getOutputDescriptor(), null, false, null);
|
||||||
|
} else if(entry instanceof UtxoEntry utxoEntry) {
|
||||||
|
copyMenu = new HashIndexEntryContextMenu(null, utxoEntry);
|
||||||
|
} else {
|
||||||
|
copyMenu = new ContextMenu();
|
||||||
|
}
|
||||||
|
copyMenu.getItems().removeIf(menuItem -> !menuItem.getText().startsWith("Copy"));
|
||||||
|
setContextMenu(copyMenu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue