Merge pull request #2519 from ben-kaufman/txid-proposal-display

Add txId to proposal display
This commit is contained in:
Christoph Atteneder 2019-03-08 17:51:23 +01:00 committed by GitHub
commit ced71361b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 4 deletions

View file

@ -55,6 +55,7 @@ import bisq.core.dao.state.model.governance.RoleProposal;
import bisq.core.dao.state.model.governance.Vote;
import bisq.core.locale.CurrencyUtil;
import bisq.core.locale.Res;
import bisq.core.user.Preferences;
import bisq.core.util.BsqFormatter;
import bisq.core.util.validation.InputValidator;
import bisq.core.util.validation.UrlInputValidator;
@ -107,6 +108,7 @@ public class ProposalDisplay {
@Nullable
private final ChangeParamValidator changeParamValidator;
private final Navigation navigation;
private final Preferences preferences;
@Nullable
private TextField proposalFeeTextField, comboBoxValueTextField, requiredBondForRoleTextField;
@ -127,6 +129,7 @@ public class ProposalDisplay {
@Getter
private int gridRow;
private HyperlinkWithIcon linkHyperlinkWithIcon;
private HyperlinkWithIcon txHyperlinkWithIcon;
private int gridRowStartIndex;
private final List<Runnable> inputChangedListeners = new ArrayList<>();
@Getter
@ -142,12 +145,13 @@ public class ProposalDisplay {
private VBox linkWithIconContainer, comboBoxValueContainer, myVoteBox, voteResultBox;
public ProposalDisplay(GridPane gridPane, BsqFormatter bsqFormatter, DaoFacade daoFacade,
@Nullable ChangeParamValidator changeParamValidator, Navigation navigation) {
@Nullable ChangeParamValidator changeParamValidator, Navigation navigation, @Nullable Preferences preferences) {
this.gridPane = gridPane;
this.bsqFormatter = bsqFormatter;
this.daoFacade = daoFacade;
this.changeParamValidator = changeParamValidator;
this.navigation = navigation;
this.preferences = preferences;
// focusOutListener = observable -> inputChangedListeners.forEach(Runnable::run);
@ -219,6 +223,14 @@ public class ProposalDisplay {
linkWithIconContainer.setVisible(false);
linkWithIconContainer.setManaged(false);
if (!isMakeProposalScreen) {
Tuple3<Label, HyperlinkWithIcon, VBox> uidTuple = addTopLabelHyperlinkWithIcon(gridPane, ++gridRow,
Res.get("dao.proposal.display.txId"), "", "", 0);
txHyperlinkWithIcon = uidTuple.second;
// TODO HyperlinkWithIcon does not scale automatically (button base, -> make anchorpane as base)
txHyperlinkWithIcon.prefWidthProperty().bind(nameTextField.widthProperty());
}
int comboBoxValueTextFieldIndex = -1;
switch (proposalType) {
case COMPENSATION_REQUEST:
@ -477,6 +489,12 @@ public class ProposalDisplay {
linkHyperlinkWithIcon.setOnAction(e -> GUIUtil.openWebPage(proposal.getLink()));
}
if (txHyperlinkWithIcon != null) {
txHyperlinkWithIcon.setText(proposal.getTxId());
txHyperlinkWithIcon.setOnAction(e ->
GUIUtil.openTxInBsqBlockExplorer(proposal.getTxId(), preferences));
}
if (proposal instanceof CompensationProposal) {
CompensationProposal compensationProposal = (CompensationProposal) proposal;
checkNotNull(requestedBsqTextField, "requestedBsqTextField must not be null");

View file

@ -432,7 +432,7 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> implements
private void addProposalDisplay() {
if (selectedProposalType != null) {
proposalDisplay = new ProposalDisplay(root, bsqFormatter, daoFacade, changeParamValidator, navigation);
proposalDisplay = new ProposalDisplay(root, bsqFormatter, daoFacade, changeParamValidator, navigation, null);
proposalDisplay.createAllFields(Res.get("dao.proposal.create.new"), alwaysVisibleGridRowIndex, Layout.GROUP_DISTANCE,
selectedProposalType, true);

View file

@ -683,7 +683,7 @@ public class ProposalsView extends ActivatableView<GridPane, Void> implements Bs
private void createEmptyProposalDisplay() {
proposalDisplay = new ProposalDisplay(proposalDisplayGridPane, bsqFormatter, daoFacade,
changeParamValidator, navigation);
changeParamValidator, navigation, preferences);
proposalDisplayView = proposalDisplay.getView();
GridPane.setMargin(proposalDisplayView, new Insets(0, -10, 0, -10));
GridPane.setRowIndex(proposalDisplayView, ++gridRow);

View file

@ -445,7 +445,7 @@ public class VoteResultView extends ActivatableView<GridPane, Void> implements D
private ProposalDisplay createProposalDisplay(EvaluatedProposal evaluatedProposal, Ballot ballot) {
Proposal proposal = evaluatedProposal.getProposal();
ProposalDisplay proposalDisplay = new ProposalDisplay(new GridPane(), bsqFormatter,
daoFacade, null, navigation);
daoFacade, null, navigation, preferences);
ScrollPane proposalDisplayView = proposalDisplay.getView();
GridPane.setMargin(proposalDisplayView, new Insets(0, -10, -15, -10));