From 1ff3013a0b31362b38a2494799100fbcc80ec850 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Thu, 28 Mar 2019 11:40:34 +0100 Subject: [PATCH 1/3] Reset selected item to enable re-opening of proposal details --- .../desktop/main/dao/governance/result/VoteResultView.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java index 1cb3a49e929..d327aa5bb5f 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java @@ -127,7 +127,8 @@ public class VoteResultView extends ActivatableView implements D private final BsqFormatter bsqFormatter; private final MyProposalListService myProposalListService; private final MyBlindVoteListService myBlindVoteListService; - private ProposalResultsWindow proposalResultsWindow; + private final ProposalResultsWindow proposalResultsWindow; + private Button exportButton; private int gridRow = 0; @@ -192,6 +193,8 @@ public void initialize() { GridPane.setMargin(exportButton, new Insets(10, -10, -50, 0)); GridPane.setColumnSpan(exportButton, 2); GridPane.setHalignment(exportButton, HPos.RIGHT); + + proposalResultsWindow.onClose(() -> proposalsTableView.getSelectionModel().clearSelection()); } @Override From 2ee9b882c08ac858cbc5b4979b9bfcd556a18e26 Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Thu, 28 Mar 2019 12:17:01 +0100 Subject: [PATCH 2/3] Add transaction id and date to proposal votes table --- .../resources/i18n/displayStrings.properties | 4 +- .../governance/proposals/ProposalsView.java | 2 +- .../dao/governance/result/VoteListItem.java | 4 + .../dao/governance/result/VoteResultView.java | 2 +- .../windows/ProposalResultsWindow.java | 117 +++++++++++++----- 5 files changed, 95 insertions(+), 34 deletions(-) diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index aee1ff1083d..0af3223e2f4 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -198,7 +198,7 @@ shared.actions=Actions shared.buyerUpperCase=Buyer shared.sellerUpperCase=Seller shared.new=NEW -shared.new=NEW +shared.blindVoteTxId=Blind vote transaction ID #################################################################### # UI views @@ -1677,7 +1677,6 @@ dao.proposal.type.short.GENERIC=Generic proposal # suppress inspection "UnusedProperty" dao.proposal.type.short.CONFISCATE_BOND=Confiscating a bond - dao.proposal.details=Proposal details dao.proposal.selectedProposal=Selected proposal dao.proposal.active.header=Proposals of current cycle @@ -1691,7 +1690,6 @@ dao.proposal.myVote.reject=Reject proposal dao.proposal.myVote.removeMyVote=Ignore proposal dao.proposal.myVote.merit=Vote weight from earned BSQ dao.proposal.myVote.stake=Vote weight from stake -dao.proposal.myVote.blindVoteTxId=Blind vote transaction ID dao.proposal.myVote.revealTxId=Vote reveal transaction ID dao.proposal.myVote.stake.prompt=Max. available stake for voting: {0} dao.proposal.votes.header=Set stake for voting and publish your votes diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java index 57b51782d57..1a5190642dc 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java @@ -637,7 +637,7 @@ private void createVoteView() { voteFields.add(stakeInputTextField); Tuple3 tuple = addTopLabelTxIdTextField(root, ++gridRow, - Res.get("dao.proposal.myVote.blindVoteTxId"), 0); + Res.get("shared.blindVoteTxId"), 0); blindVoteTxIdTextField = tuple.second; blindVoteTxIdContainer = tuple.third; blindVoteTxIdTextField.setBsq(true); diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteListItem.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteListItem.java index 924cf302078..823e44d2bfc 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteListItem.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteListItem.java @@ -29,6 +29,7 @@ import de.jensd.fx.fontawesome.AwesomeIcon; +import java.util.Date; import java.util.Optional; import lombok.Getter; @@ -48,6 +49,8 @@ public class VoteListItem { private String blindVoteTxId = ""; @Getter private String voteRevealTxId = ""; + @Getter + private Date blindVoteDate; VoteListItem(Proposal proposal, DecryptedBallotsWithMerits decryptedBallotsWithMerits, @@ -62,6 +65,7 @@ public class VoteListItem { merit = decryptedBallotsWithMerits.getMerit(daoStateService); stake = decryptedBallotsWithMerits.getStake(); blindVoteTxId = decryptedBallotsWithMerits.getBlindVoteTxId(); + daoStateService.getTx(blindVoteTxId).ifPresent(tx -> blindVoteDate = new Date(tx.getTime())); voteRevealTxId = decryptedBallotsWithMerits.getVoteRevealTxId(); } } diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java index d327aa5bb5f..85138d20e9c 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java @@ -270,7 +270,7 @@ private void onResultsListItemSelected(CycleListItem item) { item.getResultsOfCycle().getCycle().getHeightOfFirstBlock())) .forEach(e -> { sb.append("\n") - .append(Res.getWithCol("dao.proposal.myVote.blindVoteTxId")).append(" ") + .append(Res.getWithCol("shared.blindVoteTxId")).append(" ") .append(e.getBlindVoteTxId()).append("\n") .append(Res.getWithCol("dao.results.votes.table.header.stake")).append(" ") .append(bsqFormatter.formatCoinWithCode(Coin.valueOf(e.getStake()))).append("\n"); diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/ProposalResultsWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/ProposalResultsWindow.java index 81681b9fba2..494a3d29244 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/ProposalResultsWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/ProposalResultsWindow.java @@ -3,14 +3,15 @@ import bisq.desktop.Navigation; import bisq.desktop.components.AutoTooltipLabel; import bisq.desktop.components.AutoTooltipTableColumn; +import bisq.desktop.components.HyperlinkWithIcon; import bisq.desktop.components.TableGroupHeadline; import bisq.desktop.main.dao.governance.ProposalDisplay; import bisq.desktop.main.dao.governance.result.VoteListItem; import bisq.desktop.main.overlays.TabbedOverlay; +import bisq.desktop.util.GUIUtil; import bisq.desktop.util.Layout; import bisq.core.dao.DaoFacade; -import bisq.core.dao.governance.proposal.param.ChangeParamValidator; import bisq.core.dao.state.model.governance.Ballot; import bisq.core.dao.state.model.governance.EvaluatedProposal; import bisq.core.dao.state.model.governance.Proposal; @@ -24,6 +25,7 @@ import de.jensd.fx.fontawesome.AwesomeDude; import de.jensd.fx.fontawesome.AwesomeIcon; +import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon; import javafx.scene.Scene; import javafx.scene.control.Button; @@ -32,6 +34,7 @@ import javafx.scene.control.TableCell; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; +import javafx.scene.control.Tooltip; import javafx.scene.input.KeyCode; import javafx.scene.layout.ColumnConstraints; import javafx.scene.layout.GridPane; @@ -47,8 +50,6 @@ import javafx.util.Callback; -import java.util.Optional; - import lombok.extern.slf4j.Slf4j; import static bisq.desktop.util.FormBuilder.addButtonAfterGroup; @@ -58,15 +59,8 @@ public class ProposalResultsWindow extends TabbedOverlay private final BsqFormatter bsqFormatter; private final DaoFacade daoFacade; - private final ChangeParamValidator changeParamValidator; private final Navigation navigation; private final Preferences preferences; - private Optional acceptHandlerOptional; - private Optional rejectHandlerOptional; - private Optional ignoreHandlerOptional; - private Optional removeHandlerOptional; - private EvaluatedProposal evaluatedProposal; - private Ballot ballot; private boolean isVoteIncludedInResult; private SortedList sortedVotes; private Tab proposalTab, votesTab; @@ -76,12 +70,12 @@ public class ProposalResultsWindow extends TabbedOverlay /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public ProposalResultsWindow(BsqFormatter bsqFormatter, DaoFacade daoFacade, - ChangeParamValidator changeParamValidator, Navigation navigation, + public ProposalResultsWindow(BsqFormatter bsqFormatter, + DaoFacade daoFacade, + Navigation navigation, Preferences preferences) { this.bsqFormatter = bsqFormatter; this.daoFacade = daoFacade; - this.changeParamValidator = changeParamValidator; this.navigation = navigation; this.preferences = preferences; } @@ -89,8 +83,6 @@ public ProposalResultsWindow(BsqFormatter bsqFormatter, DaoFacade daoFacade, public void show(EvaluatedProposal evaluatedProposal, Ballot ballot, boolean isVoteIncludedInResult, SortedList sortedVotes) { - this.evaluatedProposal = evaluatedProposal; - this.ballot = ballot; this.isVoteIncludedInResult = isVoteIncludedInResult; this.sortedVotes = sortedVotes; @@ -166,10 +158,9 @@ private void addContent(EvaluatedProposal evaluatedProposal, Ballot ballot) { votesTab.setContent(createVotesTable()); } - private Button addCloseButton(GridPane gridPane, int rowIndex) { + private void addCloseButton(GridPane gridPane, int rowIndex) { Button closeButton = addButtonAfterGroup(gridPane, rowIndex, Res.get("shared.close")); closeButton.setOnAction(event -> doClose()); - return closeButton; } private GridPane createVotesTable() { @@ -191,7 +182,7 @@ private GridPane createVotesTable() { GridPane.setColumnSpan(votesTableHeader, 2); votesGridPane.getChildren().add(votesTableHeader); - TableView votesTableView = new TableView<>(); + TableView votesTableView = new TableView<>(); votesTableView.setPlaceholder(new AutoTooltipLabel(Res.get("table.placeholder.noData"))); votesTableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); @@ -212,11 +203,12 @@ private GridPane createVotesTable() { private void createColumns(TableView votesTableView) { TableColumn column; - column = new AutoTooltipTableColumn<>(Res.get("dao.results.votes.table.header.vote")); - column.setSortable(false); - column.setMinWidth(50); - column.setMaxWidth(column.getMinWidth()); + column = new AutoTooltipTableColumn<>(Res.get("shared.dateTime")); column.getStyleClass().add("first-column"); + column.setSortable(false); + column.setMinWidth(180); + column.setMaxWidth(column.getMinWidth() + 20); + column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); column.setCellFactory( new Callback<>() { @@ -224,20 +216,49 @@ private void createColumns(TableView votesTableView) { public TableCell call( TableColumn column) { return new TableCell<>() { - private Label icon; @Override public void updateItem(final VoteListItem item, boolean empty) { super.updateItem(item, empty); if (item != null && !empty) { - Tuple2 iconStyleTuple = item.getIconStyleTuple(); - icon = new Label(); - AwesomeDude.setIcon(icon, iconStyleTuple.first); - icon.getStyleClass().add(iconStyleTuple.second); - setGraphic(icon); + setText(bsqFormatter.formatDateTime(item.getBlindVoteDate())); + } else { + setText(""); + } + } + }; + } + }); + votesTableView.getColumns().add(column); + + column = new AutoTooltipTableColumn<>(Res.get("shared.blindVoteTxId")); + column.setSortable(false); + column.setMinWidth(100); + column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); + column.setCellFactory( + new Callback<>() { + @Override + public TableCell call( + TableColumn column) { + return new TableCell<>() { + + private HyperlinkWithIcon hyperlinkWithIcon; + + @Override + public void updateItem(final VoteListItem item, boolean empty) { + super.updateItem(item, empty); + + if (item != null && !empty) { + String transactionId = item.getBlindVoteTxId(); + hyperlinkWithIcon = new HyperlinkWithIcon(transactionId, MaterialDesignIcon.LINK); + hyperlinkWithIcon.setOnAction(event -> openTxInBlockExplorer(item)); + hyperlinkWithIcon.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForTx", transactionId))); + setGraphic(hyperlinkWithIcon); } else { setGraphic(null); + if (hyperlinkWithIcon != null) + hyperlinkWithIcon.setOnAction(null); } } }; @@ -267,6 +288,7 @@ public void updateItem(final VoteListItem item, boolean empty) { } }); votesTableView.getColumns().add(column); + column = new AutoTooltipTableColumn<>(Res.get("dao.results.votes.table.header.merit")); column.setSortable(false); column.setMinWidth(100); @@ -293,7 +315,6 @@ public void updateItem(final VoteListItem item, boolean empty) { column = new AutoTooltipTableColumn<>(Res.get("dao.results.votes.table.header.stake")); column.setSortable(false); column.setMinWidth(100); - column.getStyleClass().add("last-column"); column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); column.setCellFactory( new Callback<>() { @@ -313,6 +334,39 @@ public void updateItem(final VoteListItem item, boolean empty) { } }); votesTableView.getColumns().add(column); + + column = new AutoTooltipTableColumn<>(Res.get("dao.results.votes.table.header.vote")); + column.setSortable(false); + column.setMinWidth(50); + column.getStyleClass().add("last-column"); + column.setMaxWidth(column.getMinWidth()); + column.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); + column.setCellFactory( + new Callback<>() { + @Override + public TableCell call( + TableColumn column) { + return new TableCell<>() { + private Label icon; + + @Override + public void updateItem(final VoteListItem item, boolean empty) { + super.updateItem(item, empty); + + if (item != null && !empty) { + Tuple2 iconStyleTuple = item.getIconStyleTuple(); + icon = new Label(); + AwesomeDude.setIcon(icon, iconStyleTuple.first); + icon.getStyleClass().add(iconStyleTuple.second); + setGraphic(icon); + } else { + setGraphic(null); + } + } + }; + } + }); + votesTableView.getColumns().add(column); } private void setupCloseKeyHandler(Scene scene) { @@ -323,4 +377,9 @@ private void setupCloseKeyHandler(Scene scene) { } }); } + + private void openTxInBlockExplorer(VoteListItem item) { + if (item.getBlindVoteTxId() != null) + GUIUtil.openWebPage(preferences.getBsqBlockChainExplorer().txUrl + item.getBlindVoteTxId(), false); + } } From dbc202215c978f9b25c7cf4a1793fe912b7e284b Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Thu, 28 Mar 2019 15:37:48 +0100 Subject: [PATCH 3/3] Improve bonded role display and linkage --- desktop/src/main/java/bisq/desktop/bisq.css | 1 + .../desktop/components/HyperlinkWithIcon.java | 4 ++ .../components/InfoAutoTooltipLabel.java | 24 +++++++---- .../main/dao/bonding/bonds/BondsView.java | 21 +++++++++- .../main/dao/governance/ProposalDisplay.java | 40 +++++++++---------- .../windows/SelectProposalWindow.java | 3 ++ 6 files changed, 64 insertions(+), 29 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/bisq.css b/desktop/src/main/java/bisq/desktop/bisq.css index 8f4f570725c..d7e626b97d0 100644 --- a/desktop/src/main/java/bisq/desktop/bisq.css +++ b/desktop/src/main/java/bisq/desktop/bisq.css @@ -952,6 +952,7 @@ textfield */ } .hyperlink, +.hyperlink.force-underline .text, .hyperlink:hover, .hyperlink:visited, .hyperlink:hover:visited, diff --git a/desktop/src/main/java/bisq/desktop/components/HyperlinkWithIcon.java b/desktop/src/main/java/bisq/desktop/components/HyperlinkWithIcon.java index 742cd51d31e..97e823d10db 100644 --- a/desktop/src/main/java/bisq/desktop/components/HyperlinkWithIcon.java +++ b/desktop/src/main/java/bisq/desktop/components/HyperlinkWithIcon.java @@ -62,6 +62,10 @@ public HyperlinkWithIcon(String text, GlyphIcons icon) { setIcon(textIcon); } + public void hideIcon() { + setGraphic(null); + } + private void setIcon(Node icon) { setGraphic(icon); diff --git a/desktop/src/main/java/bisq/desktop/components/InfoAutoTooltipLabel.java b/desktop/src/main/java/bisq/desktop/components/InfoAutoTooltipLabel.java index fe26b0ec9b7..3db6c9a7948 100644 --- a/desktop/src/main/java/bisq/desktop/components/InfoAutoTooltipLabel.java +++ b/desktop/src/main/java/bisq/desktop/components/InfoAutoTooltipLabel.java @@ -19,12 +19,14 @@ import bisq.common.UserThread; +import de.jensd.fx.fontawesome.AwesomeIcon; +import de.jensd.fx.glyphs.GlyphIcons; + import org.controlsfx.control.PopOver; import javafx.scene.Node; import javafx.scene.control.ContentDisplay; import javafx.scene.control.Label; -import javafx.scene.text.Text; import javafx.geometry.Insets; @@ -32,13 +34,9 @@ import static bisq.desktop.util.FormBuilder.getIcon; - - -import de.jensd.fx.glyphs.GlyphIcons; - public class InfoAutoTooltipLabel extends AutoTooltipLabel { - private Text textIcon; + private Node textIcon; private Boolean hidePopover; private PopOver infoPopover; @@ -46,12 +44,23 @@ public InfoAutoTooltipLabel(String text, GlyphIcons icon, ContentDisplay content super(text); textIcon = getIcon(icon); + addIcon(contentDisplay, info, 300); + } + + public InfoAutoTooltipLabel(String text, AwesomeIcon icon, ContentDisplay contentDisplay, String info, double width) { + super(text); + + textIcon = getIcon(icon); + addIcon(contentDisplay, info, width); + } + + private void addIcon(ContentDisplay contentDisplay, String info, double width) { textIcon.setOpacity(0.4); textIcon.setOnMouseEntered(e -> { hidePopover = false; final Label helpLabel = new Label(info); - helpLabel.setMaxWidth(300); + helpLabel.setMaxWidth(width); helpLabel.setWrapText(true); helpLabel.setPadding(new Insets(10)); showInfoPopOver(helpLabel); @@ -73,6 +82,7 @@ public InfoAutoTooltipLabel(String text, GlyphIcons icon, ContentDisplay content setContentDisplay(contentDisplay); } + private void showInfoPopOver(Node node) { node.getStyleClass().add("default-text"); diff --git a/desktop/src/main/java/bisq/desktop/main/dao/bonding/bonds/BondsView.java b/desktop/src/main/java/bisq/desktop/main/dao/bonding/bonds/BondsView.java index 39c38c715d1..81e210b4501 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/bonding/bonds/BondsView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/bonding/bonds/BondsView.java @@ -21,6 +21,7 @@ import bisq.desktop.common.view.FxmlView; import bisq.desktop.components.AutoTooltipTableColumn; import bisq.desktop.components.HyperlinkWithIcon; +import bisq.desktop.components.InfoAutoTooltipLabel; import bisq.desktop.util.FormBuilder; import bisq.desktop.util.GUIUtil; @@ -35,8 +36,10 @@ import javax.inject.Inject; +import de.jensd.fx.fontawesome.AwesomeIcon; import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon; +import javafx.scene.control.ContentDisplay; import javafx.scene.control.TableCell; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; @@ -253,14 +256,27 @@ public void updateItem(final BondListItem item, boolean empty) { @Override public TableCell call(TableColumn column) { return new TableCell<>() { + private InfoAutoTooltipLabel infoTextField; @Override public void updateItem(final BondListItem item, boolean empty) { super.updateItem(item, empty); if (item != null && !empty) { - setText(item.getBondDetails()); + String info = Res.get("shared.id") + ": " + item.getBond().getBondedAsset().getUid(); + + if (item.getBond() instanceof BondedRole) { + info = item.getBondDetails() + "\n" + info; + } + + infoTextField = new InfoAutoTooltipLabel(item.getBondDetails(), + AwesomeIcon.INFO_SIGN, + ContentDisplay.LEFT, + info, + 350 + ); + setGraphic(infoTextField); } else - setText(""); + setGraphic(null); } }; } @@ -308,6 +324,7 @@ public void updateItem(final BondListItem item, boolean empty) { hyperlinkWithIcon = new HyperlinkWithIcon(lockupTxId, MaterialDesignIcon.LINK); hyperlinkWithIcon.setOnAction(event -> GUIUtil.openTxInBsqBlockExplorer(lockupTxId, preferences)); hyperlinkWithIcon.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForTx", lockupTxId))); + if (item.getLockupDateString().equals("-")) hyperlinkWithIcon.hideIcon(); setGraphic(hyperlinkWithIcon); } else { setGraphic(null); diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/ProposalDisplay.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/ProposalDisplay.java index 3fd607f79f3..9b49c0155c3 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/ProposalDisplay.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/ProposalDisplay.java @@ -63,7 +63,6 @@ import bisq.asset.Asset; import bisq.common.util.Tuple3; -import bisq.common.util.Utilities; import org.bitcoinj.core.Coin; @@ -87,6 +86,7 @@ import java.util.Arrays; import java.util.List; import java.util.Objects; +import java.util.Optional; import java.util.stream.Collectors; import lombok.Getter; @@ -141,10 +141,11 @@ public class ProposalDisplay { private ChangeListener paramChangeListener; private ChangeListener requiredBondForRoleListener; private TitledGroupBg myVoteTitledGroup; - private int titledGroupBgRowSpan; private VBox linkWithIconContainer, comboBoxValueContainer, myVoteBox, voteResultBox; private int votingBoxRowSpan; + private Optional navigateHandlerOptional; + public ProposalDisplay(GridPane gridPane, BsqFormatter bsqFormatter, DaoFacade daoFacade, @@ -179,31 +180,27 @@ public void createAllFields(String title, int gridRowStartIndex, double top, Pro boolean isMakeProposalScreen) { createAllFields(title, gridRowStartIndex, top, proposalType, isMakeProposalScreen, null); } - + public void createAllFields(String title, int gridRowStartIndex, double top, ProposalType proposalType, boolean isMakeProposalScreen, String titledGroupStyle) { removeAllFields(); this.gridRowStartIndex = gridRowStartIndex; this.gridRow = gridRowStartIndex; - titledGroupBgRowSpan = 5; + int titledGroupBgRowSpan = 5; switch (proposalType) { case COMPENSATION_REQUEST: case REIMBURSEMENT_REQUEST: + case CONFISCATE_BOND: + case REMOVE_ASSET: break; case CHANGE_PARAM: - titledGroupBgRowSpan = 6; - break; case BONDED_ROLE: titledGroupBgRowSpan = 6; break; - case CONFISCATE_BOND: - break; case GENERIC: titledGroupBgRowSpan = 4; break; - case REMOVE_ASSET: - break; } TitledGroupBg titledGroupBg = addTitledGroupBg(gridPane, gridRow, titledGroupBgRowSpan, title, top); @@ -358,16 +355,13 @@ public BondedRoleType fromString(String string) { confiscateBondComboBox.setConverter(new StringConverter<>() { @Override public String toString(Bond bond) { - String bondType; String bondDetails; if (bond instanceof BondedRole) { - bondType = Res.get("dao.bond.bondedRoles"); bondDetails = bond.getBondedAsset().getDisplayString(); } else { - bondType = Res.get("dao.bond.bondedReputation"); - bondDetails = Utilities.bytesAsHexString(bond.getBondedAsset().getHash()); + bondDetails = Res.get("dao.bond.bondedReputation"); } - return bondType + ": " + bondDetails; + return bondDetails + " (" + Res.get("shared.id") + ": " + bond.getBondedAsset().getUid() + ")"; } @Override @@ -414,7 +408,6 @@ public Asset fromString(String string) { if (isMakeProposalScreen) { proposalFeeTextField = addTopLabelTextField(gridPane, ++gridRow, Res.get("dao.proposal.display.proposalFee")).second; - //noinspection ConstantConditions proposalFeeTextField.setText(bsqFormatter.formatCoinWithCode(daoFacade.getProposalFee(daoFacade.getChainHeight()))); } @@ -553,10 +546,13 @@ public void applyProposalPayload(Proposal proposal) { .ifPresent(bond -> { confiscateBondComboBox.getSelectionModel().select(bond); comboBoxValueTextField.setText(confiscateBondComboBox.getConverter().toString(bond)); - comboBoxValueTextField.setOnMouseClicked(e -> - navigation.navigateToWithData(bond, MainView.class, DaoView.class, BondingView.class, - BondsView.class)); - comboBoxValueTextField.getStyleClass().addAll("hyperlink", "show-hand"); + comboBoxValueTextField.setOnMouseClicked(e -> { + navigateHandlerOptional.ifPresent(Runnable::run); + navigation.navigateToWithData(bond, MainView.class, DaoView.class, BondingView.class, + BondsView.class); + }); + + comboBoxValueTextField.getStyleClass().addAll("hyperlink", "force-underline", "show-hand"); }); } else if (proposal instanceof GenericProposal) { // do nothing @@ -651,6 +647,10 @@ public void removeAllFields() { comboBoxes.clear(); } + public void onNavigate(Runnable navigateHandler) { + this.navigateHandlerOptional = Optional.of(navigateHandler); + } + public int incrementAndGetGridRow() { return ++gridRow; } diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/SelectProposalWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/SelectProposalWindow.java index 43449220df7..e7f464e7226 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/SelectProposalWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/SelectProposalWindow.java @@ -128,6 +128,9 @@ protected void addMessage() { private void addContent(Proposal proposal, EvaluatedProposal evaluatedProposal, Ballot ballot) { ProposalDisplay proposalDisplay = new ProposalDisplay(gridPane, bsqFormatter, daoFacade, changeParamValidator, navigation, preferences); + + proposalDisplay.onNavigate(this::doClose); + proposalDisplay.createAllFields("", rowIndex, -Layout.FIRST_ROW_DISTANCE, proposal.getType(), false, "last"); proposalDisplay.setEditable(false);