use of org.bitcoinj.wallet.listeners.WalletEventListener in project bisq-desktop by bisq-network.
the class TransactionsView method initialize.
@Override
public void initialize() {
dateColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.dateTime")));
detailsColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.details")));
addressColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.address")));
transactionColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.txId", Res.getBaseCurrencyCode())));
amountColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.amountWithCur", Res.getBaseCurrencyCode())));
confidenceColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.confirmations", Res.getBaseCurrencyCode())));
revertTxColumn.setGraphic(new AutoTooltipLabel(Res.get("shared.revert", Res.getBaseCurrencyCode())));
tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
tableView.setPlaceholder(new AutoTooltipLabel(Res.get("funds.tx.noTxAvailable")));
setDateColumnCellFactory();
setDetailsColumnCellFactory();
setAddressColumnCellFactory();
setTransactionColumnCellFactory();
setAmountColumnCellFactory();
setConfidenceColumnCellFactory();
setRevertTxColumnCellFactory();
dateColumn.setComparator(Comparator.comparing(TransactionsListItem::getDate));
detailsColumn.setComparator((o1, o2) -> {
String id1 = o1.getTradable() != null ? o1.getTradable().getId() : o1.getDetails();
String id2 = o2.getTradable() != null ? o2.getTradable().getId() : o2.getDetails();
return id1.compareTo(id2);
});
addressColumn.setComparator(Comparator.comparing(TransactionsListItem::getAddressString));
transactionColumn.setComparator(Comparator.comparing(TransactionsListItem::getTxId));
amountColumn.setComparator(Comparator.comparing(TransactionsListItem::getAmountAsCoin));
confidenceColumn.setComparator(Comparator.comparingDouble(item -> item.getTxConfidenceIndicator().getProgress()));
dateColumn.setSortType(TableColumn.SortType.DESCENDING);
tableView.getSortOrder().add(dateColumn);
// noinspection deprecation
walletEventListener = new WalletEventListener() {
@Override
public void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
displayedTransactions.update();
}
@Override
public void onCoinsSent(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
displayedTransactions.update();
}
@Override
public void onReorganize(Wallet wallet) {
displayedTransactions.update();
}
@Override
public void onTransactionConfidenceChanged(Wallet wallet, Transaction tx) {
}
@Override
public void onWalletChanged(Wallet wallet) {
displayedTransactions.update();
}
@Override
public void onScriptsChanged(Wallet wallet, List<Script> scripts, boolean isAddingScripts) {
displayedTransactions.update();
}
@Override
public void onKeysAdded(List<ECKey> keys) {
displayedTransactions.update();
}
};
keyEventEventHandler = event -> {
if (Utilities.isAltOrCtrlPressed(KeyCode.R, event))
revertTxColumn.setVisible(!revertTxColumn.isVisible());
else if (Utilities.isAltOrCtrlPressed(KeyCode.A, event))
showStatisticsPopup();
};
exportButton.setText(Res.get("shared.exportCSV"));
}
Aggregations