use of bisq.desktop.components.AddressWithIconAndDirection in project bisq-desktop by bisq-network.
the class TransactionsView method setAddressColumnCellFactory.
private void setAddressColumnCellFactory() {
addressColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
addressColumn.setCellFactory(new Callback<TableColumn<TransactionsListItem, TransactionsListItem>, TableCell<TransactionsListItem, TransactionsListItem>>() {
@Override
public TableCell<TransactionsListItem, TransactionsListItem> call(TableColumn<TransactionsListItem, TransactionsListItem> column) {
return new TableCell<TransactionsListItem, TransactionsListItem>() {
private AddressWithIconAndDirection field;
@Override
public void updateItem(final TransactionsListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
String addressString = item.getAddressString();
field = new AddressWithIconAndDirection(item.getDirection(), addressString, AwesomeIcon.EXTERNAL_LINK, item.getReceived());
field.setOnAction(event -> openAddressInBlockExplorer(item));
field.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForAddress", addressString)));
setGraphic(field);
} else {
setGraphic(null);
if (field != null)
field.setOnAction(null);
}
}
};
}
});
}
use of bisq.desktop.components.AddressWithIconAndDirection in project bisq-desktop by bisq-network.
the class BsqTxView method addInformationColumn.
private void addInformationColumn() {
TableColumn<BsqTxListItem, BsqTxListItem> column = new AutoTooltipTableColumn<>(Res.get("shared.information"));
column.setCellValueFactory(item -> new ReadOnlyObjectWrapper<>(item.getValue()));
column.setMinWidth(160);
column.setCellFactory(new Callback<TableColumn<BsqTxListItem, BsqTxListItem>, TableCell<BsqTxListItem, BsqTxListItem>>() {
@Override
public TableCell<BsqTxListItem, BsqTxListItem> call(TableColumn<BsqTxListItem, BsqTxListItem> column) {
return new TableCell<BsqTxListItem, BsqTxListItem>() {
private AddressWithIconAndDirection field;
@Override
public void updateItem(final BsqTxListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
TxType txType = item.getTxType();
String labelString = Res.get("dao.tx.type.enum." + txType.name());
Label label;
if (item.getConfirmations() > 0 && txType.ordinal() > TxType.INVALID.ordinal()) {
if (item.isBurnedBsqTx() || item.getAmount().isZero()) {
if (field != null)
field.setOnAction(null);
if (txType == TxType.TRANSFER_BSQ) {
if (item.getAmount().isZero())
labelString = Res.get("funds.tx.direction.self");
}
label = new AutoTooltipLabel(labelString);
setGraphic(label);
} else {
// Received
String addressString = item.getAddress();
field = new AddressWithIconAndDirection(item.getDirection(), addressString, AwesomeIcon.EXTERNAL_LINK, item.isReceived());
field.setOnAction(event -> openAddressInBlockExplorer(item));
field.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForAddress", addressString)));
setGraphic(field);
}
} else {
label = new AutoTooltipLabel(labelString);
setGraphic(label);
}
} else {
setGraphic(null);
if (field != null)
field.setOnAction(null);
}
}
};
}
});
tableView.getColumns().add(column);
}
Aggregations