mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
Show failed ballots as failed, fix #2704
This commit is contained in:
parent
abc0909ffe
commit
98b4fe0d91
2 changed files with 27 additions and 8 deletions
|
@ -40,9 +40,13 @@ import de.jensd.fx.fontawesome.AwesomeIcon;
|
|||
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TableRow;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.StackPane;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ProposalListItem {
|
||||
|
||||
@Getter
|
||||
|
@ -50,16 +54,18 @@ public class ProposalListItem {
|
|||
@Getter
|
||||
private final Proposal proposal;
|
||||
private final Vote vote;
|
||||
private final boolean isMyBallotIncluded;
|
||||
private final BsqFormatter bsqFormatter;
|
||||
|
||||
private TableRow tableRow;
|
||||
|
||||
|
||||
ProposalListItem(EvaluatedProposal evaluatedProposal, Ballot ballot, BsqFormatter bsqFormatter) {
|
||||
ProposalListItem(EvaluatedProposal evaluatedProposal, Ballot ballot, boolean isMyBallotIncluded,
|
||||
BsqFormatter bsqFormatter) {
|
||||
this.evaluatedProposal = evaluatedProposal;
|
||||
proposal = evaluatedProposal.getProposal();
|
||||
vote = ballot.getVote();
|
||||
|
||||
this.isMyBallotIncluded = isMyBallotIncluded;
|
||||
this.bsqFormatter = bsqFormatter;
|
||||
}
|
||||
|
||||
|
@ -68,16 +74,26 @@ public class ProposalListItem {
|
|||
Label myVoteIcon;
|
||||
if (vote != null) {
|
||||
if ((vote).isAccepted()) {
|
||||
myVoteIcon = FormBuilder.getIcon(AwesomeIcon.THUMBS_UP);
|
||||
myVoteIcon.getStyleClass().add("dao-accepted-icon");
|
||||
myVoteIcon = getIcon(AwesomeIcon.THUMBS_UP, "dao-accepted-icon");
|
||||
} else {
|
||||
myVoteIcon = FormBuilder.getIcon(AwesomeIcon.THUMBS_DOWN);
|
||||
myVoteIcon.getStyleClass().add("dao-rejected-icon");
|
||||
myVoteIcon = getIcon(AwesomeIcon.THUMBS_DOWN, "dao-rejected-icon");
|
||||
}
|
||||
} else {
|
||||
myVoteIcon = FormBuilder.getIcon(AwesomeIcon.MINUS);
|
||||
myVoteIcon.getStyleClass().add("dao-ignored-icon");
|
||||
myVoteIcon = getIcon(AwesomeIcon.MINUS, "dao-ignored-icon");
|
||||
}
|
||||
if (!isMyBallotIncluded) {
|
||||
Label notIncluded = FormBuilder.getIcon(AwesomeIcon.BAN_CIRCLE);
|
||||
return new Label("", new HBox(10, new StackPane(myVoteIcon, notIncluded),
|
||||
getIcon(AwesomeIcon.MINUS, "dao-ignored-icon")));
|
||||
}
|
||||
return myVoteIcon;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Label getIcon(AwesomeIcon awesomeIcon, String s) {
|
||||
Label myVoteIcon;
|
||||
myVoteIcon = FormBuilder.getIcon(awesomeIcon);
|
||||
myVoteIcon.getStyleClass().add(s);
|
||||
return myVoteIcon;
|
||||
}
|
||||
|
||||
|
|
|
@ -460,6 +460,9 @@ public class VoteResultView extends ActivatableView<GridPane, Void> implements D
|
|||
})
|
||||
.map(evaluatedProposal -> new ProposalListItem(evaluatedProposal,
|
||||
ballotByProposalTxIdMap.get(evaluatedProposal.getProposalTxId()),
|
||||
voteListItemList.stream()
|
||||
.anyMatch(voteListItem ->
|
||||
bsqWalletService.getTransaction(voteListItem.getBlindVoteTxId()) != null),
|
||||
bsqFormatter))
|
||||
.collect(Collectors.toList()));
|
||||
GUIUtil.setFitToRowsForTableView(proposalsTableView, 25, 28, 6, 6);
|
||||
|
|
Loading…
Add table
Reference in a new issue