use of bisq.desktop.main.dao.proposal.ProposalListItem in project bisq-desktop by bisq-network.
the class MyVotesView method createProposalColumns.
@Override
protected void createProposalColumns(TableView<ProposalListItem> tableView) {
super.createProposalColumns(tableView);
TableColumn<ProposalListItem, ProposalListItem> actionColumn = new TableColumn<>(Res.get("dao.proposal.votes.header"));
actionColumn.setMinWidth(50);
actionColumn.setMaxWidth(actionColumn.getMinWidth());
actionColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
actionColumn.setCellFactory(new Callback<TableColumn<ProposalListItem, ProposalListItem>, TableCell<ProposalListItem, ProposalListItem>>() {
@Override
public TableCell<ProposalListItem, ProposalListItem> call(TableColumn<ProposalListItem, ProposalListItem> column) {
return new TableCell<ProposalListItem, ProposalListItem>() {
ImageView actionButtonIconView;
@Override
public void updateItem(final ProposalListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
actionButtonIconView = new ImageView();
VoteResult voteResult = item.getProposal().getVoteResult();
if (voteResult instanceof BooleanVoteResult) {
if (((BooleanVoteResult) voteResult).isAccepted()) {
actionButtonIconView.setId("accepted");
} else {
actionButtonIconView.setId("rejected");
}
} else {
// TODO
}
setGraphic(actionButtonIconView);
} else {
setGraphic(null);
}
}
};
}
});
actionColumn.setComparator(Comparator.comparing(ProposalListItem::getConfirmations));
tableView.getColumns().add(actionColumn);
}
use of bisq.desktop.main.dao.proposal.ProposalListItem in project bisq-desktop by bisq-network.
the class ActiveProposalsView method createProposalColumns.
// /////////////////////////////////////////////////////////////////////////////////////////
// TableColumns
// /////////////////////////////////////////////////////////////////////////////////////////
@Override
protected void createProposalColumns(TableView<ProposalListItem> tableView) {
super.createProposalColumns(tableView);
createConfidenceColumn(tableView);
TableColumn<ProposalListItem, ProposalListItem> actionColumn = new TableColumn<>();
actionColumn.setMinWidth(130);
actionColumn.setMaxWidth(actionColumn.getMinWidth());
actionColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
actionColumn.setCellFactory(new Callback<TableColumn<ProposalListItem, ProposalListItem>, TableCell<ProposalListItem, ProposalListItem>>() {
@Override
public TableCell<ProposalListItem, ProposalListItem> call(TableColumn<ProposalListItem, ProposalListItem> column) {
return new TableCell<ProposalListItem, ProposalListItem>() {
Node node;
@Override
public void updateItem(final ProposalListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty) {
if (node == null) {
node = item.getActionNode();
setGraphic(node);
item.setOnRemoveHandler(() -> {
ActiveProposalsView.this.selectedProposalListItem = item;
ActiveProposalsView.this.onRemove();
});
item.applyState(currentPhase, item.getProposal().getVoteResultProperty().get());
}
} else {
setGraphic(null);
if (node != null) {
if (node instanceof Button)
((Button) node).setOnAction(null);
node = null;
}
}
}
};
}
});
actionColumn.setComparator(Comparator.comparing(ProposalListItem::getConfirmations));
tableView.getColumns().add(actionColumn);
}
Aggregations