mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-05 05:46:44 +00:00
add context menu options to date column in utxos table to freeze utxo and view transaction
This commit is contained in:
parent
c6ea37e081
commit
7c43ee7208
3 changed files with 14 additions and 7 deletions
|
@ -1,6 +1,5 @@
|
||||||
package com.sparrowwallet.sparrow.control;
|
package com.sparrowwallet.sparrow.control;
|
||||||
|
|
||||||
import com.sparrowwallet.drongo.wallet.BlockTransactionHashIndex;
|
|
||||||
import com.sparrowwallet.sparrow.wallet.Entry;
|
import com.sparrowwallet.sparrow.wallet.Entry;
|
||||||
import com.sparrowwallet.sparrow.wallet.UtxoEntry;
|
import com.sparrowwallet.sparrow.wallet.UtxoEntry;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
|
@ -12,6 +11,8 @@ import javafx.util.Duration;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
|
||||||
|
import static com.sparrowwallet.sparrow.control.EntryCell.HashIndexEntryContextMenu;
|
||||||
|
|
||||||
public class DateCell extends TreeTableCell<Entry, Entry> {
|
public class DateCell extends TreeTableCell<Entry, Entry> {
|
||||||
private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||||
|
|
||||||
|
@ -36,11 +37,11 @@ public class DateCell extends TreeTableCell<Entry, Entry> {
|
||||||
UtxoEntry utxoEntry = (UtxoEntry)entry;
|
UtxoEntry utxoEntry = (UtxoEntry)entry;
|
||||||
if(utxoEntry.getHashIndex().getHeight() <= 0) {
|
if(utxoEntry.getHashIndex().getHeight() <= 0) {
|
||||||
setText("Unconfirmed " + (utxoEntry.getHashIndex().getHeight() < 0 ? "Parent " : "") + (utxoEntry.getWallet().isWhirlpoolMixWallet() ? "(Not yet mixable)" : (utxoEntry.isSpendable() ? "(Spendable)" : "(Not yet spendable)")));
|
setText("Unconfirmed " + (utxoEntry.getHashIndex().getHeight() < 0 ? "Parent " : "") + (utxoEntry.getWallet().isWhirlpoolMixWallet() ? "(Not yet mixable)" : (utxoEntry.isSpendable() ? "(Spendable)" : "(Not yet spendable)")));
|
||||||
setContextMenu(null);
|
setContextMenu(new HashIndexEntryContextMenu(getTreeTableView(), utxoEntry));
|
||||||
} else if(utxoEntry.getHashIndex().getDate() != null) {
|
} else if(utxoEntry.getHashIndex().getDate() != null) {
|
||||||
String date = DATE_FORMAT.format(utxoEntry.getHashIndex().getDate());
|
String date = DATE_FORMAT.format(utxoEntry.getHashIndex().getDate());
|
||||||
setText(date);
|
setText(date);
|
||||||
setContextMenu(new DateContextMenu(date, utxoEntry.getHashIndex()));
|
setContextMenu(new DateContextMenu(getTreeTableView(), utxoEntry, date));
|
||||||
} else {
|
} else {
|
||||||
setText("Unknown");
|
setText("Unknown");
|
||||||
setContextMenu(null);
|
setContextMenu(null);
|
||||||
|
@ -56,8 +57,10 @@ public class DateCell extends TreeTableCell<Entry, Entry> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class DateContextMenu extends ContextMenu {
|
private static class DateContextMenu extends HashIndexEntryContextMenu {
|
||||||
public DateContextMenu(String date, BlockTransactionHashIndex reference) {
|
public DateContextMenu(TreeTableView<Entry> treeTableView, UtxoEntry utxoEntry, String date) {
|
||||||
|
super(treeTableView, utxoEntry);
|
||||||
|
|
||||||
MenuItem copyDate = new MenuItem("Copy Date");
|
MenuItem copyDate = new MenuItem("Copy Date");
|
||||||
copyDate.setOnAction(AE -> {
|
copyDate.setOnAction(AE -> {
|
||||||
hide();
|
hide();
|
||||||
|
@ -70,7 +73,7 @@ public class DateCell extends TreeTableCell<Entry, Entry> {
|
||||||
copyHeight.setOnAction(AE -> {
|
copyHeight.setOnAction(AE -> {
|
||||||
hide();
|
hide();
|
||||||
ClipboardContent content = new ClipboardContent();
|
ClipboardContent content = new ClipboardContent();
|
||||||
content.putString(reference.getHeight() > 0 ? Integer.toString(reference.getHeight()) : "Mempool");
|
content.putString(utxoEntry.getHashIndex().getHeight() > 0 ? Integer.toString(utxoEntry.getHashIndex().getHeight()) : "Mempool");
|
||||||
Clipboard.getSystemClipboard().setContent(content);
|
Clipboard.getSystemClipboard().setContent(content);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -691,7 +691,7 @@ public class EntryCell extends TreeTableCell<Entry, Entry> implements Confirmati
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class HashIndexEntryContextMenu extends ContextMenu {
|
static class HashIndexEntryContextMenu extends ContextMenu {
|
||||||
public HashIndexEntryContextMenu(TreeTableView<Entry> treeTableView, HashIndexEntry hashIndexEntry) {
|
public HashIndexEntryContextMenu(TreeTableView<Entry> treeTableView, HashIndexEntry hashIndexEntry) {
|
||||||
MenuItem viewTransaction = new MenuItem("View Transaction");
|
MenuItem viewTransaction = new MenuItem("View Transaction");
|
||||||
viewTransaction.setGraphic(getViewTransactionGlyph());
|
viewTransaction.setGraphic(getViewTransactionGlyph());
|
||||||
|
|
|
@ -331,3 +331,7 @@ HorizontalHeaderColumn > TableColumnHeader.column-header.table-column{
|
||||||
.root .hyperlink:visited {
|
.root .hyperlink:visited {
|
||||||
-fx-text-fill: #229df5;
|
-fx-text-fill: #229df5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#grid .spreadsheet-cell.selection {
|
||||||
|
-fx-text-fill: -fx-base;
|
||||||
|
}
|
Loading…
Reference in a new issue