use of bisq.desktop.components.AutoTooltipTableColumn in project bisq-desktop by bisq-network.
the class BaseProposalView method createProposalColumns.
// /////////////////////////////////////////////////////////////////////////////////////////
// TableColumns
// /////////////////////////////////////////////////////////////////////////////////////////
protected void createProposalColumns(TableView<ProposalListItem> tableView) {
TableColumn<ProposalListItem, ProposalListItem> dateColumn = new AutoTooltipTableColumn<ProposalListItem, ProposalListItem>(Res.get("shared.dateTime")) {
{
setMinWidth(190);
setMaxWidth(190);
}
};
dateColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
dateColumn.setCellFactory(new Callback<TableColumn<ProposalListItem, ProposalListItem>, TableCell<ProposalListItem, ProposalListItem>>() {
@Override
public TableCell<ProposalListItem, ProposalListItem> call(TableColumn<ProposalListItem, ProposalListItem> column) {
return new TableCell<ProposalListItem, ProposalListItem>() {
@Override
public void updateItem(final ProposalListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null)
setText(bsqFormatter.formatDateTime(item.getProposal().getProposalPayload().getCreationDate()));
else
setText("");
}
};
}
});
dateColumn.setComparator(Comparator.comparing(o3 -> o3.getProposal().getProposalPayload().getCreationDate()));
dateColumn.setSortType(TableColumn.SortType.DESCENDING);
tableView.getColumns().add(dateColumn);
tableView.getSortOrder().add(dateColumn);
TableColumn<ProposalListItem, ProposalListItem> nameColumn = new AutoTooltipTableColumn<>(Res.get("shared.name"));
nameColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
nameColumn.setCellFactory(new Callback<TableColumn<ProposalListItem, ProposalListItem>, TableCell<ProposalListItem, ProposalListItem>>() {
@Override
public TableCell<ProposalListItem, ProposalListItem> call(TableColumn<ProposalListItem, ProposalListItem> column) {
return new TableCell<ProposalListItem, ProposalListItem>() {
@Override
public void updateItem(final ProposalListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null)
setText(item.getProposal().getProposalPayload().getName());
else
setText("");
}
};
}
});
nameColumn.setComparator(Comparator.comparing(o2 -> o2.getProposal().getProposalPayload().getName()));
tableView.getColumns().add(nameColumn);
TableColumn<ProposalListItem, ProposalListItem> titleColumn = new AutoTooltipTableColumn<>(Res.get("dao.proposal.title"));
titleColumn.setPrefWidth(100);
titleColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
titleColumn.setCellFactory(new Callback<TableColumn<ProposalListItem, ProposalListItem>, TableCell<ProposalListItem, ProposalListItem>>() {
@Override
public TableCell<ProposalListItem, ProposalListItem> call(TableColumn<ProposalListItem, ProposalListItem> column) {
return new TableCell<ProposalListItem, ProposalListItem>() {
@Override
public void updateItem(final ProposalListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null)
setText(item.getProposal().getProposalPayload().getTitle());
else
setText("");
}
};
}
});
titleColumn.setComparator(Comparator.comparing(o2 -> o2.getProposal().getProposalPayload().getTitle()));
tableView.getColumns().add(titleColumn);
TableColumn<ProposalListItem, ProposalListItem> uidColumn = new AutoTooltipTableColumn<>(Res.get("shared.id"));
uidColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
uidColumn.setCellFactory(new Callback<TableColumn<ProposalListItem, ProposalListItem>, TableCell<ProposalListItem, ProposalListItem>>() {
@Override
public TableCell<ProposalListItem, ProposalListItem> call(TableColumn<ProposalListItem, ProposalListItem> column) {
return new TableCell<ProposalListItem, ProposalListItem>() {
private HyperlinkWithIcon field;
@Override
public void updateItem(final ProposalListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
final Proposal proposal = item.getProposal();
final ProposalPayload proposalPayload = proposal.getProposalPayload();
field = new HyperlinkWithIcon(proposalPayload.getShortId());
field.setOnAction(event -> {
new ProposalDetailsWindow(bsqFormatter, bsqWalletService, proposalPayload).show();
});
field.setTooltip(new Tooltip(Res.get("tooltip.openPopupForDetails")));
setGraphic(field);
} else {
setGraphic(null);
if (field != null)
field.setOnAction(null);
}
}
};
}
});
uidColumn.setComparator(Comparator.comparing(o -> o.getProposal().getProposalPayload().getUid()));
tableView.getColumns().add(uidColumn);
}
use of bisq.desktop.components.AutoTooltipTableColumn in project bisq-desktop by bisq-network.
the class TraderDisputeView method getContractColumn.
private TableColumn<Dispute, Dispute> getContractColumn() {
TableColumn<Dispute, Dispute> column = new AutoTooltipTableColumn<Dispute, Dispute>(Res.get("shared.details")) {
{
setMinWidth(80);
setSortable(false);
}
};
column.setCellValueFactory((dispute) -> new ReadOnlyObjectWrapper<>(dispute.getValue()));
column.setCellFactory(new Callback<TableColumn<Dispute, Dispute>, TableCell<Dispute, Dispute>>() {
@Override
public TableCell<Dispute, Dispute> call(TableColumn<Dispute, Dispute> column) {
return new TableCell<Dispute, Dispute>() {
Button button;
@Override
public void updateItem(final Dispute item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
if (button == null) {
button = new AutoTooltipButton(Res.get("shared.details"));
setGraphic(button);
}
button.setOnAction(e -> onOpenContract(item));
} else {
setGraphic(null);
if (button != null) {
button.setOnAction(null);
button = null;
}
}
}
};
}
});
return column;
}
use of bisq.desktop.components.AutoTooltipTableColumn in project bisq-desktop by bisq-network.
the class TraderDisputeView method getTradeIdColumn.
private TableColumn<Dispute, Dispute> getTradeIdColumn() {
TableColumn<Dispute, Dispute> column = new AutoTooltipTableColumn<Dispute, Dispute>(Res.get("shared.tradeId")) {
{
setMinWidth(110);
}
};
column.setCellValueFactory((dispute) -> new ReadOnlyObjectWrapper<>(dispute.getValue()));
column.setCellFactory(new Callback<TableColumn<Dispute, Dispute>, TableCell<Dispute, Dispute>>() {
@Override
public TableCell<Dispute, Dispute> call(TableColumn<Dispute, Dispute> column) {
return new TableCell<Dispute, Dispute>() {
private HyperlinkWithIcon field;
@Override
public void updateItem(final Dispute item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
field = new HyperlinkWithIcon(item.getShortTradeId());
Optional<Trade> tradeOptional = tradeManager.getTradeById(item.getTradeId());
if (tradeOptional.isPresent()) {
field.setMouseTransparent(false);
field.setTooltip(new Tooltip(Res.get("tooltip.openPopupForDetails")));
field.setOnAction(event -> tradeDetailsWindow.show(tradeOptional.get()));
} else {
field.setMouseTransparent(true);
}
setGraphic(field);
} else {
setGraphic(null);
if (field != null)
field.setOnAction(null);
}
}
};
}
});
return column;
}
use of bisq.desktop.components.AutoTooltipTableColumn in project bisq-desktop by bisq-network.
the class MyVotesView method createVoteColumns.
// /////////////////////////////////////////////////////////////////////////////////////////
// TableColumns
// /////////////////////////////////////////////////////////////////////////////////////////
private void createVoteColumns(TableView<VoteListItem> tableView) {
TableColumn<VoteListItem, VoteListItem> dateColumn = new AutoTooltipTableColumn<VoteListItem, VoteListItem>(Res.get("shared.dateTime")) {
{
setMinWidth(190);
setMaxWidth(190);
}
};
dateColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
dateColumn.setCellFactory(new Callback<TableColumn<VoteListItem, VoteListItem>, TableCell<VoteListItem, VoteListItem>>() {
@Override
public TableCell<VoteListItem, VoteListItem> call(TableColumn<VoteListItem, VoteListItem> column) {
return new TableCell<VoteListItem, VoteListItem>() {
@Override
public void updateItem(final VoteListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null)
setText(bsqFormatter.formatDateTime(new Date(item.getMyVote().getDate())));
else
setText("");
}
};
}
});
dateColumn.setComparator(Comparator.comparing(o3 -> o3.getMyVote().getDate()));
dateColumn.setSortType(TableColumn.SortType.DESCENDING);
tableView.getColumns().add(dateColumn);
tableView.getSortOrder().add(dateColumn);
TableColumn<VoteListItem, VoteListItem> proposalListColumn = new AutoTooltipTableColumn<>(Res.get("dao.proposal.myVotes.proposalList"));
proposalListColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
proposalListColumn.setCellFactory(new Callback<TableColumn<VoteListItem, VoteListItem>, TableCell<VoteListItem, VoteListItem>>() {
@Override
public TableCell<VoteListItem, VoteListItem> call(TableColumn<VoteListItem, VoteListItem> column) {
return new TableCell<VoteListItem, VoteListItem>() {
@Override
public void updateItem(final VoteListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
ProposalList proposalList = item.getMyVote().getProposalList();
HyperlinkWithIcon field = new HyperlinkWithIcon(Res.get("dao.proposal.myVotes.showProposalList"), AwesomeIcon.INFO_SIGN);
field.setOnAction(event -> onShowProposalList(proposalList));
field.setTooltip(new Tooltip(Res.get("dao.proposal.myVotes.tooltip.showProposalList")));
setGraphic(field);
} else {
setGraphic(null);
}
}
};
}
});
proposalListColumn.setSortable(false);
tableView.getColumns().add(proposalListColumn);
TableColumn<VoteListItem, VoteListItem> stakeColumn = new AutoTooltipTableColumn<>(Res.get("dao.proposal.votes.stake"));
stakeColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
stakeColumn.setCellFactory(new Callback<TableColumn<VoteListItem, VoteListItem>, TableCell<VoteListItem, VoteListItem>>() {
@Override
public TableCell<VoteListItem, VoteListItem> call(TableColumn<VoteListItem, VoteListItem> column) {
return new TableCell<VoteListItem, VoteListItem>() {
@Override
public void updateItem(final VoteListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
textProperty().bind(item.getStakeAsStringProperty());
} else {
textProperty().unbind();
setText("");
}
}
};
}
});
stakeColumn.setComparator(Comparator.comparing(VoteListItem::getStake));
tableView.getColumns().add(stakeColumn);
TableColumn<VoteListItem, VoteListItem> txColumn = new AutoTooltipTableColumn<>(Res.get("dao.proposal.myVotes.tx"));
txColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
txColumn.setCellFactory(new Callback<TableColumn<VoteListItem, VoteListItem>, TableCell<VoteListItem, VoteListItem>>() {
@Override
public TableCell<VoteListItem, VoteListItem> call(TableColumn<VoteListItem, VoteListItem> column) {
return new TableCell<VoteListItem, VoteListItem>() {
@Override
public void updateItem(final VoteListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
String txId = item.getMyVote().getTxId();
HyperlinkWithIcon hyperlinkWithIcon = new HyperlinkWithIcon(txId, AwesomeIcon.EXTERNAL_LINK);
hyperlinkWithIcon.setOnAction(event -> {
if (txId != null)
GUIUtil.openWebPage(preferences.getBlockChainExplorer().txUrl + txId);
});
hyperlinkWithIcon.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForTx", txId)));
setGraphic(hyperlinkWithIcon);
} else {
setGraphic(null);
}
}
};
}
});
txColumn.setComparator(Comparator.comparing(o2 -> o2.getMyVote().getBlindVote().getTxId()));
tableView.getColumns().add(txColumn);
TableColumn<VoteListItem, VoteListItem> confidenceColumn = new TableColumn<>(Res.get("shared.confirmations"));
confidenceColumn.setMinWidth(130);
confidenceColumn.setMaxWidth(confidenceColumn.getMinWidth());
confidenceColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
confidenceColumn.setCellFactory(new Callback<TableColumn<VoteListItem, VoteListItem>, TableCell<VoteListItem, VoteListItem>>() {
@Override
public TableCell<VoteListItem, VoteListItem> call(TableColumn<VoteListItem, VoteListItem> column) {
return new TableCell<VoteListItem, VoteListItem>() {
@Override
public void updateItem(final VoteListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
setGraphic(item.getTxConfidenceIndicator());
} else {
setGraphic(null);
}
}
};
}
});
confidenceColumn.setComparator(Comparator.comparing(VoteListItem::getConfirmations));
tableView.getColumns().add(confidenceColumn);
}
use of bisq.desktop.components.AutoTooltipTableColumn in project bisq-desktop by bisq-network.
the class OfferBookView method getAmountColumn.
// /////////////////////////////////////////////////////////////////////////////////////////
// Table
// /////////////////////////////////////////////////////////////////////////////////////////
private AutoTooltipTableColumn<OfferBookListItem, OfferBookListItem> getAmountColumn() {
AutoTooltipTableColumn<OfferBookListItem, OfferBookListItem> column = new AutoTooltipTableColumn<>(Res.get("shared.BTCMinMax"), Res.get("shared.amountHelp"));
column.setMinWidth(100);
column.getStyleClass().add("number-column");
column.setCellValueFactory((offer) -> new ReadOnlyObjectWrapper<>(offer.getValue()));
column.setCellFactory(new Callback<TableColumn<OfferBookListItem, OfferBookListItem>, TableCell<OfferBookListItem, OfferBookListItem>>() {
@Override
public TableCell<OfferBookListItem, OfferBookListItem> call(TableColumn<OfferBookListItem, OfferBookListItem> column) {
return new TableCell<OfferBookListItem, OfferBookListItem>() {
@Override
public void updateItem(final OfferBookListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty)
setGraphic(new ColoredDecimalPlacesWithZerosText(model.getAmount(item), GUIUtil.AMOUNT_DECIMALS_WITH_ZEROS));
else
setGraphic(null);
}
};
}
});
return column;
}
Aggregations