Skip to content

Commit

Permalink
Merge pull request #2419 from ripcurlx/improve-governance-layout
Browse files Browse the repository at this point in the history
Improve governance layout
  • Loading branch information
ManfredKarrer authored Feb 13, 2019
2 parents 2cbcf77 + d392067 commit bd1e23e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@

import javax.annotation.Nullable;

import static bisq.desktop.util.FormBuilder.addInputTextField;
import static bisq.desktop.util.FormBuilder.addTitledGroupBg;
import static bisq.desktop.util.FormBuilder.addTopLabelTextField;
import static bisq.desktop.util.FormBuilder.*;
import static com.google.common.base.Preconditions.checkNotNull;

@SuppressWarnings("ConstantConditions")
Expand All @@ -113,7 +111,6 @@ public class ProposalDisplay {
@Nullable
private TextField proposalFeeTextField, comboBoxValueTextField, requiredBondForRoleTextField;
private TextField proposalTypeTextField, myVoteTextField, voteResultTextField;
private Label myVoteLabel, voteResultLabel;
public InputTextField nameTextField;
public InputTextField linkInputTextField;
@Nullable
Expand Down Expand Up @@ -142,8 +139,7 @@ public class ProposalDisplay {
private ChangeListener<BondedRoleType> requiredBondForRoleListener;
private TitledGroupBg titledGroupBg;
private int titledGroupBgRowSpan;
private VBox linkWithIconContainer;
private VBox comboBoxValueContainer;
private VBox linkWithIconContainer, comboBoxValueContainer, myVoteBox, voteResultBox;

public ProposalDisplay(GridPane gridPane, BsqFormatter bsqFormatter, DaoFacade daoFacade,
@Nullable ChangeParamValidator changeParamValidator, Navigation navigation) {
Expand Down Expand Up @@ -213,7 +209,7 @@ public void createAllFields(String title, int gridRowStartIndex, double top, Pro
linkInputTextField.setValidator(new UrlInputValidator());
inputControls.add(linkInputTextField);

Tuple3<Label, HyperlinkWithIcon, VBox> tuple = FormBuilder.addTopLabelHyperlinkWithIcon(gridPane, gridRow,
Tuple3<Label, HyperlinkWithIcon, VBox> tuple = addTopLabelHyperlinkWithIcon(gridPane, gridRow,
Res.get("dao.proposal.display.link"), "", "", 0);
linkHyperlinkWithIcon = tuple.second;
linkWithIconContainer = tuple.third;
Expand Down Expand Up @@ -370,7 +366,7 @@ public Asset fromString(String string) {
}

if (comboBoxValueTextFieldIndex > -1) {
Tuple3<Label, TextField, VBox> tuple3 = FormBuilder.addTopLabelReadOnlyTextField(gridPane, comboBoxValueTextFieldIndex,
Tuple3<Label, TextField, VBox> tuple3 = addTopLabelReadOnlyTextField(gridPane, comboBoxValueTextFieldIndex,
Res.get("dao.proposal.display.option"));
comboBoxValueTextField = tuple3.second;
comboBoxValueContainer = tuple3.third;
Expand All @@ -385,20 +381,20 @@ public Asset fromString(String string) {
}

Tuple3<Label, TextField, VBox> tuple3 = addTopLabelTextField(gridPane, ++gridRow, Res.get("dao.proposal.display.myVote"));
myVoteLabel = tuple3.first;
myVoteLabel.setVisible(false);
myVoteLabel.setManaged(false);

myVoteBox = tuple3.third;
myVoteBox.setVisible(false);
myVoteBox.setManaged(false);

myVoteTextField = tuple3.second;
myVoteTextField.setVisible(false);
myVoteTextField.setManaged(false);

tuple3 = addTopLabelTextField(gridPane, ++gridRow, Res.get("dao.proposal.display.voteResult"));
voteResultLabel = tuple3.first;
voteResultLabel.setVisible(false);
voteResultLabel.setManaged(false);

voteResultBox = tuple3.third;
voteResultBox.setVisible(false);
voteResultBox.setManaged(false);

voteResultTextField = tuple3.second;
voteResultTextField.setVisible(false);
voteResultTextField.setManaged(false);

addListeners();
}
Expand All @@ -413,10 +409,8 @@ public void applyBallot(@Nullable Ballot ballot) {
}
myVoteTextField.setText(myVote);

myVoteLabel.setVisible(isNotNull);
myVoteLabel.setManaged(isNotNull);
myVoteTextField.setVisible(isNotNull);
myVoteTextField.setManaged(isNotNull);
myVoteBox.setVisible(isNotNull);
myVoteBox.setManaged(isNotNull);
}

public void applyEvaluatedProposal(@Nullable EvaluatedProposal evaluatedProposal) {
Expand All @@ -435,10 +429,8 @@ public void applyEvaluatedProposal(@Nullable EvaluatedProposal evaluatedProposal
threshold, requiredThreshold, quorum, requiredQuorum);
voteResultTextField.setText(summary);
}
voteResultLabel.setVisible(isEvaluatedProposalNotNull);
voteResultLabel.setManaged(isEvaluatedProposalNotNull);
voteResultTextField.setVisible(isEvaluatedProposalNotNull);
voteResultTextField.setManaged(isEvaluatedProposalNotNull);
voteResultBox.setVisible(isEvaluatedProposalNotNull);
voteResultBox.setManaged(isEvaluatedProposalNotNull);
}

public void applyBallotAndVoteWeight(@Nullable Ballot ballot, long merit, long stake) {
Expand All @@ -461,10 +453,8 @@ public void applyBallotAndVoteWeight(@Nullable Ballot ballot, long merit, long s
}

boolean show = ballotIsNotNull && hasVoted;
myVoteLabel.setVisible(show);
myVoteLabel.setManaged(show);
myVoteTextField.setVisible(show);
myVoteTextField.setManaged(show);
myVoteBox.setVisible(show);
myVoteBox.setManaged(show);
}

public void setIsVoteIncludedInResult(boolean isVoteIncludedInResult) {
Expand Down Expand Up @@ -639,10 +629,10 @@ public ScrollPane getView() {

gridPane.getColumnConstraints().addAll(columnConstraints1);

AnchorPane.setBottomAnchor(gridPane, 20d);
AnchorPane.setBottomAnchor(gridPane, 10d);
AnchorPane.setRightAnchor(gridPane, 10d);
AnchorPane.setLeftAnchor(gridPane, 10d);
AnchorPane.setTopAnchor(gridPane, 20d);
AnchorPane.setTopAnchor(gridPane, 10d);
anchorPane.getChildren().add(gridPane);

return scrollPane;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

import javax.annotation.Nullable;

import static bisq.desktop.util.FormBuilder.addButtonBusyAnimationLabel;
import static bisq.desktop.util.FormBuilder.addButtonBusyAnimationLabelAfterGroup;
import static bisq.desktop.util.FormBuilder.addComboBox;
import static bisq.desktop.util.FormBuilder.addTitledGroupBg;
import static bisq.desktop.util.FormBuilder.addTopLabelReadOnlyTextField;
Expand Down Expand Up @@ -437,8 +437,8 @@ private void addProposalDisplay() {
proposalDisplay.createAllFields(Res.get("dao.proposal.create.new"), alwaysVisibleGridRowIndex, Layout.GROUP_DISTANCE,
selectedProposalType, true);

final Tuple4<Button, BusyAnimation, Label, HBox> makeProposalTuple = addButtonBusyAnimationLabel(root,
proposalDisplay.getGridRow(), 0, Res.get("dao.proposal.create.button"), 0);
final Tuple4<Button, BusyAnimation, Label, HBox> makeProposalTuple = addButtonBusyAnimationLabelAfterGroup(root,
proposalDisplay.getGridRow(), 0, Res.get("dao.proposal.create.button"));
makeProposalButton = makeProposalTuple.first;

busyAnimation = makeProposalTuple.second;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ private void createVoteView() {
meritTextField.setText(bsqFormatter.formatCoinWithCode(Coin.ZERO));
voteFields.add(meritLabel);
voteFields.add(meritTextField);
voteFields.add(meritTuple.third);

stakeInputTextField = addInputTextField(root, ++gridRow,
Res.get("dao.proposal.myVote.stake"));
Expand All @@ -721,6 +722,7 @@ private void createVoteView() {
Res.get("dao.proposal.myVote.button"));
voteButton = voteButtonTuple.first;
voteButtons.add(voteButton);
voteFields.add(voteButtonTuple.forth);
voteButtonBusyAnimation = voteButtonTuple.second;
voteButtonInfoLabel = voteButtonTuple.third;
}
Expand Down

0 comments on commit bd1e23e

Please sign in to comment.