mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Fix layout for governance screens
This commit is contained in:
parent
090199c0c2
commit
944acc9e93
6 changed files with 70 additions and 70 deletions
|
@ -1457,6 +1457,7 @@ dao.proposal.display.voteResult=Vote result summary
|
|||
dao.proposal.display.bondedRoleComboBox.label=Bonded role type
|
||||
dao.proposal.display.requiredBondForRole.label=Required bond for role
|
||||
dao.proposal.display.tickerSymbol.label=Ticker Symbol
|
||||
dao.proposal.display.option=Option
|
||||
|
||||
dao.proposal.table.header.proposalType=Proposal type
|
||||
dao.proposal.table.header.link=Link
|
||||
|
|
|
@ -65,12 +65,8 @@ import javafx.scene.control.TextInputControl;
|
|||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.ColumnConstraints;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.VBox;
|
||||
|
||||
import javafx.geometry.HPos;
|
||||
import javafx.geometry.Insets;
|
||||
|
||||
import javafx.beans.value.ChangeListener;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
|
@ -89,7 +85,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import javax.annotation.Nullable;
|
||||
|
||||
import static bisq.desktop.util.FormBuilder.addInputTextField;
|
||||
import static bisq.desktop.util.FormBuilder.addLabelHyperlinkWithIcon;
|
||||
import static bisq.desktop.util.FormBuilder.addTitledGroupBg;
|
||||
import static bisq.desktop.util.FormBuilder.addTopLabelTextField;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
@ -191,7 +186,7 @@ public class ProposalDisplay {
|
|||
titledGroupBg = addTitledGroupBg(gridPane, gridRow, titledGroupBgRowSpan, title, top);
|
||||
double proposalTypeTop = top == Layout.GROUP_DISTANCE ? Layout.FIRST_ROW_AND_GROUP_DISTANCE : Layout.FIRST_ROW_DISTANCE;
|
||||
proposalTypeTextField = FormBuilder.addTopLabelTextField(gridPane, gridRow,
|
||||
Res.getWithCol("dao.proposal.display.type"), proposalType.getDisplayName(), proposalTypeTop).second;
|
||||
Res.get("dao.proposal.display.type"), proposalType.getDisplayName(), proposalTypeTop).second;
|
||||
|
||||
nameTextField = addInputTextField(gridPane, ++gridRow, Res.get("dao.proposal.display.name"));
|
||||
nameTextField.setValidator(new InputValidator());
|
||||
|
@ -203,8 +198,11 @@ public class ProposalDisplay {
|
|||
linkInputTextField.setValidator(new InputValidator());
|
||||
inputControls.add(linkInputTextField);
|
||||
|
||||
linkHyperlinkWithIcon = addLabelHyperlinkWithIcon(gridPane, gridRow,
|
||||
"", "", "").second;
|
||||
linkHyperlinkWithIcon = FormBuilder.addTopLabelHyperlinkWithIcon(gridPane, gridRow,
|
||||
Res.get("dao.proposal.display.link"), "", "", 0).second;
|
||||
// TODO HyperlinkWithIcon does not scale automatically (button base, -> make anchorpane as base)
|
||||
linkHyperlinkWithIcon.prefWidthProperty().bind(nameTextField.widthProperty());
|
||||
|
||||
linkHyperlinkWithIcon.setVisible(false);
|
||||
linkHyperlinkWithIcon.setManaged(false);
|
||||
|
||||
|
@ -230,7 +228,7 @@ public class ProposalDisplay {
|
|||
case CHANGE_PARAM:
|
||||
checkNotNull(gridPane, "gridPane must not be null");
|
||||
paramComboBox = FormBuilder.<Param>addComboBox(gridPane, ++gridRow,
|
||||
Res.getWithCol("dao.proposal.display.paramComboBox.label"));
|
||||
Res.get("dao.proposal.display.paramComboBox.label"));
|
||||
comboBoxValueTextFieldIndex = gridRow;
|
||||
checkNotNull(paramComboBox, "paramComboBox must not be null");
|
||||
List<Param> list = Arrays.stream(Param.values())
|
||||
|
@ -269,7 +267,7 @@ public class ProposalDisplay {
|
|||
break;
|
||||
case BONDED_ROLE:
|
||||
bondedRoleTypeComboBox = FormBuilder.<BondedRoleType>addComboBox(gridPane, ++gridRow,
|
||||
Res.getWithCol("dao.proposal.display.bondedRoleComboBox.label"));
|
||||
Res.get("dao.proposal.display.bondedRoleComboBox.label"));
|
||||
comboBoxValueTextFieldIndex = gridRow;
|
||||
checkNotNull(bondedRoleTypeComboBox, "bondedRoleTypeComboBox must not be null");
|
||||
bondedRoleTypeComboBox.setItems(FXCollections.observableArrayList(BondedRoleType.values()));
|
||||
|
@ -286,7 +284,7 @@ public class ProposalDisplay {
|
|||
});
|
||||
comboBoxes.add(bondedRoleTypeComboBox);
|
||||
requiredBondForRoleTextField = addTopLabelTextField(gridPane, ++gridRow,
|
||||
Res.getWithCol("dao.proposal.display.requiredBondForRole.label")).second;
|
||||
Res.get("dao.proposal.display.requiredBondForRole.label")).second;
|
||||
|
||||
requiredBondForRoleListener = (observable, oldValue, newValue) -> {
|
||||
if (newValue != null) {
|
||||
|
@ -298,7 +296,7 @@ public class ProposalDisplay {
|
|||
break;
|
||||
case CONFISCATE_BOND:
|
||||
confiscateBondComboBox = FormBuilder.<BondedRole>addComboBox(gridPane, ++gridRow,
|
||||
Res.getWithCol("dao.proposal.display.confiscateBondComboBox.label"));
|
||||
Res.get("dao.proposal.display.confiscateBondComboBox.label"));
|
||||
comboBoxValueTextFieldIndex = gridRow;
|
||||
checkNotNull(confiscateBondComboBox, "confiscateBondComboBox must not be null");
|
||||
confiscateBondComboBox.setItems(FXCollections.observableArrayList(daoFacade.getValidBondedRoleList()));
|
||||
|
@ -319,7 +317,7 @@ public class ProposalDisplay {
|
|||
break;
|
||||
case REMOVE_ASSET:
|
||||
assetComboBox = FormBuilder.<Asset>addComboBox(gridPane, ++gridRow,
|
||||
Res.getWithCol("dao.proposal.display.assetComboBox.label"));
|
||||
Res.get("dao.proposal.display.assetComboBox.label"));
|
||||
comboBoxValueTextFieldIndex = gridRow;
|
||||
checkNotNull(assetComboBox, "assetComboBox must not be null");
|
||||
List<Asset> assetList = CurrencyUtil.getAssetRegistry().stream()
|
||||
|
@ -344,16 +342,10 @@ public class ProposalDisplay {
|
|||
}
|
||||
|
||||
if (comboBoxValueTextFieldIndex > -1) {
|
||||
comboBoxValueTextField = new TextField("");
|
||||
comboBoxValueTextField.setEditable(false);
|
||||
comboBoxValueTextField.setMouseTransparent(true);
|
||||
comboBoxValueTextField.setFocusTraversable(false);
|
||||
comboBoxValueTextField = FormBuilder.addTopLabelReadOnlyTextField(gridPane, comboBoxValueTextFieldIndex,
|
||||
Res.get("dao.proposal.display.option")).second;
|
||||
comboBoxValueTextField.setVisible(false);
|
||||
comboBoxValueTextField.setManaged(false);
|
||||
GridPane.setRowIndex(comboBoxValueTextField, comboBoxValueTextFieldIndex);
|
||||
GridPane.setColumnIndex(comboBoxValueTextField, 1);
|
||||
GridPane.setMargin(comboBoxValueTextField, new Insets(top, 0, 0, 0));
|
||||
gridPane.getChildren().add(comboBoxValueTextField);
|
||||
}
|
||||
|
||||
if (isMakeProposalScreen) {
|
||||
|
@ -575,6 +567,10 @@ public class ProposalDisplay {
|
|||
GUIUtil.removeChildrenFromGridPaneRows(gridPane, gridRowStartIndex, gridRow);
|
||||
gridRow = gridRowStartIndex;
|
||||
}
|
||||
|
||||
if (linkHyperlinkWithIcon != null)
|
||||
linkHyperlinkWithIcon.prefWidthProperty().unbind();
|
||||
|
||||
inputControls.clear();
|
||||
comboBoxes.clear();
|
||||
}
|
||||
|
@ -588,22 +584,18 @@ public class ProposalDisplay {
|
|||
ScrollPane scrollPane = new ScrollPane();
|
||||
scrollPane.setFitToWidth(true);
|
||||
scrollPane.setFitToHeight(true);
|
||||
//scrollPane.setMinHeight(280); // just enough to display overview at voting without scroller
|
||||
|
||||
AnchorPane anchorPane = new AnchorPane();
|
||||
scrollPane.setContent(anchorPane);
|
||||
|
||||
gridPane.setHgap(5);
|
||||
gridPane.setVgap(5);
|
||||
ColumnConstraints columnConstraints1 = new ColumnConstraints();
|
||||
columnConstraints1.setHalignment(HPos.RIGHT);
|
||||
columnConstraints1.setHgrow(Priority.SOMETIMES);
|
||||
columnConstraints1.setMinWidth(140);
|
||||
ColumnConstraints columnConstraints2 = new ColumnConstraints();
|
||||
columnConstraints2.setHgrow(Priority.ALWAYS);
|
||||
columnConstraints2.setMinWidth(300);
|
||||
|
||||
gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
|
||||
ColumnConstraints columnConstraints1 = new ColumnConstraints();
|
||||
columnConstraints1.setPercentWidth(100);
|
||||
|
||||
gridPane.getColumnConstraints().addAll(columnConstraints1);
|
||||
|
||||
AnchorPane.setBottomAnchor(gridPane, 20d);
|
||||
AnchorPane.setRightAnchor(gridPane, 10d);
|
||||
AnchorPane.setLeftAnchor(gridPane, 10d);
|
||||
|
|
|
@ -117,9 +117,10 @@ public class ProposalsView extends ActivatableView<GridPane, Void> implements Bs
|
|||
|
||||
private TableView<ProposalsListItem> tableView;
|
||||
private TitledGroupBg voteTitledGroupBg;
|
||||
private Label revealTxIdLabel, blindVoteTxIdLabel, voteButtonInfoLabel;
|
||||
private Label voteButtonInfoLabel;
|
||||
private TxIdTextField revealTxIdTextField, blindVoteTxIdTextField;
|
||||
private TextField meritTextField;
|
||||
private VBox blindVoteTxIdContainer, revealTxIdContainer;
|
||||
private Button removeProposalButton, acceptButton, rejectButton, ignoreButton, voteButton;
|
||||
private InputTextField stakeInputTextField;
|
||||
private ScrollPane proposalDisplayView;
|
||||
|
@ -570,14 +571,10 @@ public class ProposalsView extends ActivatableView<GridPane, Void> implements Bs
|
|||
blindVoteTxIdTextField.setup("");
|
||||
revealTxIdTextField.setup("");
|
||||
|
||||
blindVoteTxIdLabel.setVisible(false);
|
||||
blindVoteTxIdLabel.setManaged(false);
|
||||
blindVoteTxIdTextField.setVisible(false);
|
||||
blindVoteTxIdTextField.setManaged(false);
|
||||
revealTxIdLabel.setVisible(false);
|
||||
revealTxIdLabel.setManaged(false);
|
||||
revealTxIdTextField.setVisible(false);
|
||||
revealTxIdTextField.setManaged(false);
|
||||
blindVoteTxIdContainer.setVisible(false);
|
||||
blindVoteTxIdContainer.setManaged(false);
|
||||
revealTxIdContainer.setVisible(false);
|
||||
revealTxIdContainer.setManaged(false);
|
||||
|
||||
if (hasAlreadyVoted) {
|
||||
voteTitledGroupBg.setText(Res.get("dao.proposal.votes.header.voted"));
|
||||
|
@ -592,18 +589,14 @@ public class ProposalsView extends ActivatableView<GridPane, Void> implements Bs
|
|||
|
||||
if (myVote.getTxId() != null) {
|
||||
blindVoteTxIdTextField.setup(myVote.getTxId());
|
||||
blindVoteTxIdLabel.setVisible(true);
|
||||
blindVoteTxIdLabel.setManaged(true);
|
||||
blindVoteTxIdTextField.setVisible(true);
|
||||
blindVoteTxIdTextField.setManaged(true);
|
||||
blindVoteTxIdContainer.setVisible(true);
|
||||
blindVoteTxIdContainer.setManaged(true);
|
||||
}
|
||||
|
||||
if (myVote.getRevealTxId() != null) {
|
||||
revealTxIdTextField.setup(myVote.getRevealTxId());
|
||||
revealTxIdLabel.setVisible(true);
|
||||
revealTxIdLabel.setManaged(true);
|
||||
revealTxIdTextField.setVisible(true);
|
||||
revealTxIdTextField.setManaged(true);
|
||||
revealTxIdContainer.setVisible(true);
|
||||
revealTxIdContainer.setManaged(true);
|
||||
}
|
||||
} else {
|
||||
stakeInputTextField.clear();
|
||||
|
@ -638,7 +631,6 @@ public class ProposalsView extends ActivatableView<GridPane, Void> implements Bs
|
|||
TableGroupHeadline proposalsHeadline = new TableGroupHeadline(Res.get("dao.proposal.active.header"));
|
||||
GridPane.setRowIndex(proposalsHeadline, ++gridRow);
|
||||
GridPane.setMargin(proposalsHeadline, new Insets(Layout.GROUP_DISTANCE, -10, -10, -10));
|
||||
GridPane.setColumnSpan(proposalsHeadline, 2);
|
||||
root.getChildren().add(proposalsHeadline);
|
||||
|
||||
tableView = new TableView<>();
|
||||
|
@ -649,7 +641,6 @@ public class ProposalsView extends ActivatableView<GridPane, Void> implements Bs
|
|||
GridPane.setRowIndex(tableView, gridRow);
|
||||
GridPane.setHgrow(tableView, Priority.ALWAYS);
|
||||
GridPane.setMargin(tableView, new Insets(Layout.FIRST_ROW_AND_GROUP_DISTANCE, -10, 5, -10));
|
||||
GridPane.setColumnSpan(tableView, 2);
|
||||
root.getChildren().add(tableView);
|
||||
|
||||
tableView.setItems(sortedList);
|
||||
|
@ -660,7 +651,6 @@ public class ProposalsView extends ActivatableView<GridPane, Void> implements Bs
|
|||
proposalDisplayView = proposalDisplay.getView();
|
||||
GridPane.setMargin(proposalDisplayView, new Insets(0, -10, 0, -10));
|
||||
GridPane.setRowIndex(proposalDisplayView, ++gridRow);
|
||||
GridPane.setColumnSpan(proposalDisplayView, 2);
|
||||
GridPane.setHgrow(proposalDisplayView, Priority.ALWAYS);
|
||||
root.getChildren().add(proposalDisplayView);
|
||||
}
|
||||
|
@ -683,21 +673,19 @@ public class ProposalsView extends ActivatableView<GridPane, Void> implements Bs
|
|||
stakeInputTextField.setValidator(new BsqValidator(bsqFormatter));
|
||||
voteFields.add(stakeInputTextField);
|
||||
|
||||
Tuple2<Label, TxIdTextField> blindVoteTxIdTuple = addLabelTxIdTextField(root, ++gridRow,
|
||||
Res.getWithCol("dao.proposal.myVote.blindVoteTxId"));
|
||||
blindVoteTxIdLabel = blindVoteTxIdTuple.first;
|
||||
blindVoteTxIdTextField = blindVoteTxIdTuple.second;
|
||||
Tuple3<Label, TxIdTextField, VBox> tuple = addTopLabelTxIdTextField(root, ++gridRow,
|
||||
Res.getWithCol("dao.proposal.myVote.blindVoteTxId"), 0);
|
||||
blindVoteTxIdTextField = tuple.second;
|
||||
blindVoteTxIdContainer = tuple.third;
|
||||
blindVoteTxIdTextField.setBsq(true);
|
||||
voteFields.add(blindVoteTxIdLabel);
|
||||
voteFields.add(blindVoteTxIdTextField);
|
||||
voteFields.add(blindVoteTxIdContainer);
|
||||
|
||||
Tuple2<Label, TxIdTextField> revealTxIdTuple = addLabelTxIdTextField(root, ++gridRow,
|
||||
Res.getWithCol("dao.proposal.myVote.revealTxId"));
|
||||
revealTxIdLabel = revealTxIdTuple.first;
|
||||
revealTxIdTextField = revealTxIdTuple.second;
|
||||
tuple = addTopLabelTxIdTextField(root, ++gridRow,
|
||||
Res.getWithCol("dao.proposal.myVote.revealTxId"), 0);
|
||||
revealTxIdTextField = tuple.second;
|
||||
revealTxIdTextField.setBsq(true);
|
||||
voteFields.add(revealTxIdLabel);
|
||||
voteFields.add(revealTxIdTextField);
|
||||
revealTxIdContainer = tuple.third;
|
||||
voteFields.add(revealTxIdContainer);
|
||||
|
||||
Tuple3<Button, BusyAnimation, Label> voteButtonTuple = addButtonBusyAnimationLabelAfterGroup(root, ++gridRow,
|
||||
Res.get("dao.proposal.myVote.button"));
|
||||
|
|
|
@ -122,6 +122,8 @@ public class BsqDashboardView extends ActivatableView<GridPane, Void> implements
|
|||
String url = preferences.getBsqBlockChainExplorer().txUrl + genesisTxId;
|
||||
addTopLabelReadOnlyTextField(root, gridRow, columnIndex, Res.get("dao.wallet.dashboard.genesisBlockHeight"),
|
||||
genTxHeight, Layout.FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
|
||||
// TODO use addTopLabelTxIdTextField
|
||||
Tuple3<Label, HyperlinkWithIcon, VBox> tuple = FormBuilder.addTopLabelHyperlinkWithIcon(root, ++gridRow, columnIndex,
|
||||
Res.get("dao.wallet.dashboard.genesisTxId"), genesisTxId, url, 0);
|
||||
hyperlinkWithIcon = tuple.second;
|
||||
|
|
|
@ -185,8 +185,10 @@ public abstract class TradeStepView extends AnchorPane {
|
|||
}
|
||||
|
||||
protected void addTradeInfoBlock() {
|
||||
tradeInfoTitledGroupBg = FormBuilder.addTitledGroupBg(gridPane, gridRow, 4, Res.get("portfolio.pending.tradeInformation"));
|
||||
txIdTextField = FormBuilder.addLabelTxIdTextField(gridPane, gridRow, Res.getWithCol("shared.depositTransactionId"), Layout.FIRST_ROW_DISTANCE).second;
|
||||
tradeInfoTitledGroupBg = FormBuilder.addTitledGroupBg(gridPane, gridRow, 4,
|
||||
Res.get("portfolio.pending.tradeInformation"));
|
||||
txIdTextField = FormBuilder.addLabelTxIdTextField(gridPane, gridRow, 1,
|
||||
Res.getWithCol("shared.depositTransactionId"), Layout.FIRST_ROW_DISTANCE).second;
|
||||
String id = model.dataModel.txId.get();
|
||||
if (!id.isEmpty())
|
||||
txIdTextField.setup(id);
|
||||
|
@ -194,11 +196,13 @@ public abstract class TradeStepView extends AnchorPane {
|
|||
txIdTextField.cleanup();
|
||||
|
||||
if (model.dataModel.getTrade() != null) {
|
||||
InfoTextField infoTextField = PaymentMethodForm.addOpenTradeDuration(gridPane, ++gridRow, model.dataModel.getTrade().getOffer());
|
||||
InfoTextField infoTextField = PaymentMethodForm.addOpenTradeDuration(gridPane, ++gridRow,
|
||||
model.dataModel.getTrade().getOffer());
|
||||
infoTextField.setContentForInfoPopOver(createInfoPopover());
|
||||
}
|
||||
|
||||
timeLeftTextField = FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.getWithCol("portfolio.pending.remainingTime")).second;
|
||||
timeLeftTextField = FormBuilder.addTopLabelTextField(gridPane, ++gridRow,
|
||||
Res.getWithCol("portfolio.pending.remainingTime")).second;
|
||||
|
||||
timeLeftProgressBar = new ProgressBar(0);
|
||||
timeLeftProgressBar.setOpacity(0.7);
|
||||
|
|
|
@ -1001,16 +1001,16 @@ public class FormBuilder {
|
|||
// Label + TxIdTextField
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static Tuple2<Label, TxIdTextField> addLabelTxIdTextField(GridPane gridPane, int rowIndex, String title) {
|
||||
return addLabelTxIdTextField(gridPane, rowIndex, title, 0);
|
||||
public static Tuple2<Label, TxIdTextField> addLabelTxIdTextField(GridPane gridPane, int rowIndex, int columnIndex, String title) {
|
||||
return addLabelTxIdTextField(gridPane, rowIndex, columnIndex, title, 0);
|
||||
}
|
||||
|
||||
public static Tuple2<Label, TxIdTextField> addLabelTxIdTextField(GridPane gridPane, int rowIndex, String title, double top) {
|
||||
public static Tuple2<Label, TxIdTextField> addLabelTxIdTextField(GridPane gridPane, int rowIndex, int columnIndex, String title, double top) {
|
||||
Label label = addLabel(gridPane, rowIndex, title, top);
|
||||
|
||||
TxIdTextField txIdTextField = new TxIdTextField();
|
||||
GridPane.setRowIndex(txIdTextField, rowIndex);
|
||||
GridPane.setColumnIndex(txIdTextField, 1);
|
||||
GridPane.setColumnIndex(txIdTextField, columnIndex);
|
||||
GridPane.setMargin(txIdTextField, new Insets(top, 0, 0, 0));
|
||||
gridPane.getChildren().add(txIdTextField);
|
||||
|
||||
|
@ -1018,6 +1018,19 @@ public class FormBuilder {
|
|||
}
|
||||
|
||||
|
||||
public static Tuple3<Label, TxIdTextField, VBox> addTopLabelTxIdTextField(GridPane gridPane, int rowIndex, String title, double top) {
|
||||
TxIdTextField textField = new TxIdTextField();
|
||||
textField.setFocusTraversable(false);
|
||||
|
||||
final Tuple2<Label, VBox> topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, textField, top);
|
||||
|
||||
// TOD not 100% sure if that is a good idea....
|
||||
//topLabelWithVBox.first.getStyleClass().add("jfx-text-field-top-label");
|
||||
|
||||
return new Tuple3<>(topLabelWithVBox.first, textField, topLabelWithVBox.second);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Label + TextFieldWithCopyIcon
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Reference in a new issue