Merge pull request #1842 from ManfredKarrer/fix-dao-layout-issues

Adjust layout with new design
This commit is contained in:
Manfred Karrer 2018-10-30 13:32:11 -05:00 committed by GitHub
commit 423ac38bd4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 172 additions and 110 deletions

View file

@ -1187,10 +1187,6 @@ dao.cycle.voteReveal=Vote reveal phase
dao.cycle.voteResult=Vote result dao.cycle.voteResult=Vote result
dao.cycle.phaseDuration={0} blocks (≈{1}); Block {2} - {3} (≈{4} - ≈{5}) dao.cycle.phaseDuration={0} blocks (≈{1}); Block {2} - {3} (≈{4} - ≈{5})
dao.cycle.info.headline=Information
dao.cycle.info.details=Please note:\n\
If you have voted in the blind vote phase you have to be at least once online during the vote reveal phase!
dao.results.cycles.header=Cycles dao.results.cycles.header=Cycles
dao.results.cycles.table.header.cycle=Cycle dao.results.cycles.table.header.cycle=Cycle
dao.results.cycles.table.header.numProposals=Proposals dao.results.cycles.table.header.numProposals=Proposals

View file

@ -343,9 +343,26 @@ bg color of non edit textFields: fafafa
} }
.jfx-text-field:readonly { .jfx-text-field:readonly {
-fx-background-color: -bs-rd-grey-medium-light;
-fx-padding: 0.333333em 0.333333em 0.333333em 0.333333em;
}
.jfx-text-field:readonly > .input-line {
-fx-background-color: transparent; -fx-background-color: transparent;
} }
.jfx-text-field:readonly > .input-focused-line {
-fx-background-color: transparent;
}
/* hyperlink-with-icon has same style as jfx-text-field:readonly */
.hyperlink-with-icon {
-fx-background-color: -bs-rd-grey-medium-light;
-fx-padding: 0.333333em 0.333333em 0.333333em 0.333333em;
}
#info-field { #info-field {
-fx-prompt-text-fill: -bs-rd-black; -fx-prompt-text-fill: -bs-rd-black;
} }
@ -1351,8 +1368,9 @@ textfield */
} }
/* TitledGroupBg */ /* TitledGroupBg */
.titled-group-bg-label { .titled-group-bg-label {
-fx-font-size: 1.077em; -fx-font-size: 1.231em;
-fx-font-family: "IBM Plex Sans Medium"; -fx-font-family: "IBM Plex Sans Medium";
-fx-text-fill: -bs-rd-black; -fx-text-fill: -bs-rd-black;
-fx-background-color: transparent; -fx-background-color: transparent;
@ -1360,7 +1378,7 @@ textfield */
.titled-group-bg-label-active { .titled-group-bg-label-active {
-fx-font-weight: normal; -fx-font-weight: normal;
-fx-font-size: 1.077em; -fx-font-size: 1.231em;
-fx-text-fill: -bs-rd-black; -fx-text-fill: -bs-rd-black;
-fx-background-color: transparent; -fx-background-color: transparent;
} }

View file

@ -78,8 +78,12 @@ public class InputTextField extends JFXTextField {
}); });
focusedProperty().addListener((o, oldValue, newValue) -> { focusedProperty().addListener((o, oldValue, newValue) -> {
if (oldValue && !newValue && validator != null) if (oldValue && !newValue && validator != null) {
validationResult.set(validator.validate(getText())); // Need to reset first otherwise jfxValidationWrapper is not reflecting new error message
this.validationResult.set(new InputValidator.ValidationResult(true));
this.validationResult.set(validator.validate(getText()));
}
}); });
} }

View file

@ -26,7 +26,8 @@
AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="160.0"/> <ColumnConstraints percentWidth="50"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/> <ColumnConstraints minWidth="10" maxWidth="5"/>
<ColumnConstraints percentWidth="50"/>
</columnConstraints> </columnConstraints>
</GridPane> </GridPane>

View file

@ -30,6 +30,7 @@ public class BondingDashboardView extends ActivatableView<GridPane, Void> {
private final BsqBalanceUtil bsqBalanceUtil; private final BsqBalanceUtil bsqBalanceUtil;
private int gridRow = 0; private int gridRow = 0;
private int startRow;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Constructor, lifecycle // Constructor, lifecycle
@ -41,8 +42,11 @@ public class BondingDashboardView extends ActivatableView<GridPane, Void> {
} }
public void initialize() { public void initialize() {
startRow = gridRow;
gridRow = bsqBalanceUtil.addGroup(root, gridRow); gridRow = bsqBalanceUtil.addGroup(root, gridRow);
gridRow = bsqBalanceUtil.addBondBalanceGroup(root, gridRow); gridRow = startRow;
int columnIndex = 2;
gridRow = bsqBalanceUtil.addBondBalanceGroup(root, gridRow, columnIndex);
} }
@Override @Override

View file

@ -27,8 +27,7 @@
AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="160.0"/> <ColumnConstraints percentWidth="100"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>
</columnConstraints> </columnConstraints>
</GridPane> </GridPane>

View file

@ -27,8 +27,7 @@
AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="160.0"/> <ColumnConstraints percentWidth="100"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>
</columnConstraints> </columnConstraints>
</GridPane> </GridPane>

View file

@ -27,8 +27,7 @@
AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="160.0"/> <ColumnConstraints percentWidth="100"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>
</columnConstraints> </columnConstraints>
</GridPane> </GridPane>

View file

@ -57,9 +57,7 @@ public class PhasesView implements DaoStateListener {
public int addGroup(GridPane gridPane, int gridRow) { public int addGroup(GridPane gridPane, int gridRow) {
addTitledGroupBg(gridPane, gridRow, 1, Res.get("dao.cycle.headline")); addTitledGroupBg(gridPane, gridRow, 1, Res.get("dao.cycle.headline"));
separatedPhaseBars = createSeparatedPhaseBars(); separatedPhaseBars = createSeparatedPhaseBars();
GridPane.setColumnSpan(separatedPhaseBars, 2); GridPane.setMargin(separatedPhaseBars, new Insets(Layout.FIRST_ROW_DISTANCE + 5, 0, 0, 0));
GridPane.setColumnIndex(separatedPhaseBars, 0);
GridPane.setMargin(separatedPhaseBars, new Insets(Layout.FIRST_ROW_DISTANCE - 6, 0, 0, 0));
GridPane.setRowIndex(separatedPhaseBars, gridRow); GridPane.setRowIndex(separatedPhaseBars, gridRow);
gridPane.getChildren().add(separatedPhaseBars); gridPane.getChildren().add(separatedPhaseBars);
return gridRow; return gridRow;

View file

@ -26,7 +26,6 @@
AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="160.0"/> <ColumnConstraints percentWidth="100"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>
</columnConstraints> </columnConstraints>
</GridPane> </GridPane>

View file

@ -40,9 +40,8 @@ import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Locale; import java.util.Locale;
import static bisq.desktop.util.FormBuilder.addMultilineLabel;
import static bisq.desktop.util.FormBuilder.addTitledGroupBg; import static bisq.desktop.util.FormBuilder.addTitledGroupBg;
import static bisq.desktop.util.FormBuilder.addTopLabelTextField; import static bisq.desktop.util.FormBuilder.addTopLabelReadOnlyTextField;
// We use here ChainHeightListener because we are interested in period changes not in the result of a completed // We use here ChainHeightListener because we are interested in period changes not in the result of a completed
// block. The event from the ChainHeightListener is sent before parsing starts. // block. The event from the ChainHeightListener is sent before parsing starts.
@ -73,16 +72,13 @@ public class ProposalDashboardView extends ActivatableView<GridPane, Void> imple
gridRow = phasesView.addGroup(root, gridRow); gridRow = phasesView.addGroup(root, gridRow);
addTitledGroupBg(root, ++gridRow, 6, Res.get("dao.cycle.overview.headline"), Layout.GROUP_DISTANCE); addTitledGroupBg(root, ++gridRow, 6, Res.get("dao.cycle.overview.headline"), Layout.GROUP_DISTANCE);
currentBlockHeightTextField = addTopLabelTextField(root, gridRow, Res.get("dao.cycle.currentBlockHeight"), currentBlockHeightTextField = addTopLabelReadOnlyTextField(root, gridRow, Res.get("dao.cycle.currentBlockHeight"),
"", Layout.FIRST_ROW_AND_GROUP_DISTANCE).second; Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
currentPhaseTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.cycle.currentPhase"), "").second; currentPhaseTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, Res.get("dao.cycle.currentPhase")).second;
proposalTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.cycle.proposal"), "").second; proposalTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, Res.get("dao.cycle.proposal")).second;
blindVoteTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.cycle.blindVote"), "").second; blindVoteTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, Res.get("dao.cycle.blindVote")).second;
voteRevealTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.cycle.voteReveal"), "").second; voteRevealTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, Res.get("dao.cycle.voteReveal")).second;
voteResultTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.cycle.voteResult"), "").second; voteResultTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, Res.get("dao.cycle.voteResult")).second;
addTitledGroupBg(root, ++gridRow, 1, Res.get("dao.cycle.info.headline"), Layout.GROUP_DISTANCE);
addMultilineLabel(root, gridRow, Res.get("dao.cycle.info.details"), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
} }
@Override @Override

View file

@ -26,7 +26,6 @@
AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="160.0"/> <ColumnConstraints percentWidth="100"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>
</columnConstraints> </columnConstraints>
</GridPane> </GridPane>

View file

@ -131,6 +131,7 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> implements
addTitledGroupBg(root, ++gridRow, 1, Res.get("dao.proposal.create.selectProposalType"), Layout.GROUP_DISTANCE); addTitledGroupBg(root, ++gridRow, 1, Res.get("dao.proposal.create.selectProposalType"), Layout.GROUP_DISTANCE);
proposalTypeComboBox = FormBuilder.<ProposalType>addComboBox(root, gridRow, proposalTypeComboBox = FormBuilder.<ProposalType>addComboBox(root, gridRow,
Res.getWithCol("dao.proposal.create.proposalType"), Layout.FIRST_ROW_AND_GROUP_DISTANCE); Res.getWithCol("dao.proposal.create.proposalType"), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
proposalTypeComboBox.setMaxWidth(300);
proposalTypeComboBox.setConverter(new StringConverter<>() { proposalTypeComboBox.setConverter(new StringConverter<>() {
@Override @Override
public String toString(ProposalType proposalType) { public String toString(ProposalType proposalType) {

View file

@ -27,7 +27,6 @@
AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="160.0"/> <ColumnConstraints percentWidth="100"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>
</columnConstraints> </columnConstraints>
</GridPane> </GridPane>

View file

@ -27,7 +27,6 @@
AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="160.0"/> <ColumnConstraints percentWidth="100"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>
</columnConstraints> </columnConstraints>
</GridPane> </GridPane>

View file

@ -63,53 +63,44 @@ public class BsqBalanceUtil implements BsqBalanceListener {
} }
public int addGroup(GridPane gridPane, int gridRow) { public int addGroup(GridPane gridPane, int gridRow) {
titledGroupBg = addTitledGroupBg(gridPane, gridRow, 5, Res.get("dao.wallet.dashboard.myBalance")); titledGroupBg = addTitledGroupBg(gridPane, gridRow, 6, Res.get("dao.wallet.dashboard.myBalance"));
availableBalanceTextField = FormBuilder.addTopLabelTextField(gridPane, gridRow,
Res.getWithCol("dao.availableBsqBalance"),
Layout.FIRST_ROW_DISTANCE).second;
availableBalanceTextField.setMouseTransparent(false);
unverifiedBalanceTextField = FormBuilder.addTopLabelTextField(gridPane, ++gridRow, availableBalanceTextField = FormBuilder.addTopLabelReadOnlyTextField(gridPane, gridRow,
Res.getWithCol("dao.unverifiedBsqBalance")).second; Res.get("dao.availableBsqBalance"), Layout.FIRST_ROW_DISTANCE).second;
unverifiedBalanceTextField.setMouseTransparent(false);
lockedForVoteBalanceTextField = FormBuilder.addTopLabelTextField(gridPane, ++gridRow, unverifiedBalanceTextField = FormBuilder.addTopLabelReadOnlyTextField(gridPane, ++gridRow,
Res.getWithCol("dao.lockedForVoteBalance")).second; Res.get("dao.unverifiedBsqBalance")).second;
lockedForVoteBalanceTextField.setMouseTransparent(false);
lockedInBondsBalanceTextField = FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.getWithCol( lockedForVoteBalanceTextField = FormBuilder.addTopLabelReadOnlyTextField(gridPane, ++gridRow,
"dao.lockedInBonds")).second; Res.get("dao.lockedForVoteBalance")).second;
lockedInBondsBalanceTextField.setMouseTransparent(false);
lockedInBondsBalanceTextField = FormBuilder.addTopLabelReadOnlyTextField(gridPane, ++gridRow,
Res.get("dao.lockedInBonds")).second;
// TODO add unlockingBondsBalanceTextField // TODO add unlockingBondsBalanceTextField
totalBalanceTextField = FormBuilder.addTopLabelTextField(gridPane, ++gridRow, totalBalanceTextField = FormBuilder.addTopLabelReadOnlyTextField(gridPane, ++gridRow,
Res.getWithCol("dao.totalBsqBalance")).second; Res.get("dao.totalBsqBalance")).second;
totalBalanceTextField.setMouseTransparent(false);
Tuple3<Label, TextField, VBox> tuple3 = FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Tuple3<Label, TextField, VBox> tuple3 = FormBuilder.addTopLabelReadOnlyTextField(gridPane, ++gridRow,
Res.getWithCol("dao.availableNonBsqBalance")); Res.get("dao.availableNonBsqBalance"));
availableNonBsqBalanceLabel = tuple3.first; availableNonBsqBalanceLabel = tuple3.first;
availableNonBsqBalanceTextField = tuple3.second; availableNonBsqBalanceTextField = tuple3.second;
availableNonBsqBalanceTextField.setMouseTransparent(false);
availableNonBsqBalanceTextField.setVisible(false); availableNonBsqBalanceTextField.setVisible(false);
availableNonBsqBalanceTextField.setManaged(false); availableNonBsqBalanceTextField.setManaged(false);
return gridRow; return gridRow;
} }
public int addBondBalanceGroup(GridPane gridPane, int gridRow) { public int addBondBalanceGroup(GridPane gridPane, int gridRow, int columnIndex) {
addTitledGroupBg(gridPane, ++gridRow, 2, addTitledGroupBg(gridPane, gridRow, columnIndex, 6,
Res.get("dao.bonding.dashboard.bondsHeadline"), Layout.GROUP_DISTANCE); Res.get("dao.bonding.dashboard.bondsHeadline"));
lockupAmountTextField = FormBuilder.addTopLabelTextField(gridPane, gridRow, lockupAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(gridPane, gridRow, columnIndex,
Res.get("dao.bonding.dashboard.lockupAmount"), Res.get("dao.bonding.dashboard.lockupAmount"),
Layout.FIRST_ROW_DISTANCE + Layout.GROUP_DISTANCE).second; Layout.FIRST_ROW_DISTANCE).second;
lockupAmountTextField.setMouseTransparent(false); unlockingAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(gridPane, ++gridRow, columnIndex,
unlockingAmountTextField = FormBuilder.addTopLabelTextField(gridPane, ++gridRow,
Res.get("dao.bonding.dashboard.unlockingAmount")).second; Res.get("dao.bonding.dashboard.unlockingAmount")).second;
unlockingAmountTextField.setMouseTransparent(false);
return gridRow; return gridRow;
} }
@ -138,8 +129,6 @@ public class BsqBalanceUtil implements BsqBalanceListener {
Coin unlockingBondsBalance) { Coin unlockingBondsBalance) {
boolean isNonBsqBalanceAvailable = availableNonBsqBalance.value > 0; boolean isNonBsqBalanceAvailable = availableNonBsqBalance.value > 0;
int rowSpan = isNonBsqBalanceAvailable ? 6 : 5;
GridPane.setRowSpan(titledGroupBg, rowSpan);
availableBalanceTextField.setText(bsqFormatter.formatCoinWithCode(availableBalance)); availableBalanceTextField.setText(bsqFormatter.formatCoinWithCode(availableBalance));
unverifiedBalanceTextField.setText(bsqFormatter.formatCoinWithCode(unverifiedBalance)); unverifiedBalanceTextField.setText(bsqFormatter.formatCoinWithCode(unverifiedBalance));

View file

@ -26,7 +26,8 @@
AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="160.0"/> <ColumnConstraints percentWidth="50"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/> <ColumnConstraints minWidth="10" maxWidth="5"/>
<ColumnConstraints percentWidth="50"/>
</columnConstraints> </columnConstraints>
</GridPane> </GridPane>

View file

@ -48,9 +48,8 @@ import javafx.scene.layout.GridPane;
import javafx.beans.value.ChangeListener; import javafx.beans.value.ChangeListener;
import static bisq.desktop.util.FormBuilder.addLabelHyperlinkWithIcon;
import static bisq.desktop.util.FormBuilder.addTitledGroupBg; import static bisq.desktop.util.FormBuilder.addTitledGroupBg;
import static bisq.desktop.util.FormBuilder.addTopLabelTextField; import static bisq.desktop.util.FormBuilder.addTopLabelReadOnlyTextField;
@FxmlView @FxmlView
public class BsqDashboardView extends ActivatableView<GridPane, Void> implements DaoStateListener { public class BsqDashboardView extends ActivatableView<GridPane, Void> implements DaoStateListener {
@ -89,38 +88,52 @@ public class BsqDashboardView extends ActivatableView<GridPane, Void> implements
@Override @Override
public void initialize() { public void initialize() {
int startRow = gridRow;
gridRow = bsqBalanceUtil.addGroup(root, gridRow); gridRow = bsqBalanceUtil.addGroup(root, gridRow);
addTitledGroupBg(root, ++gridRow, 5, Res.get("dao.wallet.dashboard.distribution"), Layout.GROUP_DISTANCE); gridRow = startRow;
int columnIndex = 2;
genesisIssueAmountTextField = FormBuilder.addTopLabelTextField(root, gridRow, Res.get("dao.wallet.dashboard.genesisIssueAmount"), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second; addTitledGroupBg(root, gridRow, columnIndex, 6, Res.get("dao.wallet.dashboard.distribution"));
compRequestIssueAmountTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.compRequestIssueAmount")).second; genesisIssueAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(root, gridRow, columnIndex, Res.get("dao.wallet.dashboard.genesisIssueAmount"), Layout.FIRST_ROW_DISTANCE).second;
reimbursementAmountTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.reimbursementAmount")).second; compRequestIssueAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, columnIndex, Res.get("dao.wallet.dashboard.compRequestIssueAmount")).second;
burntAmountTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.burntAmount")).second; reimbursementAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, columnIndex, Res.get("dao.wallet.dashboard.reimbursementAmount")).second;
availableAmountTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.availableAmount")).second; burntAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, columnIndex, Res.get("dao.wallet.dashboard.burntAmount")).second;
availableAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, columnIndex, Res.get("dao.wallet.dashboard.availableAmount")).second;
++gridRow; // we need 6 rows as well (availableNonBsqBalanceTextField can be invisible but we need so support it)
startRow = gridRow;
addTitledGroupBg(root, ++gridRow, 3, Res.get("dao.wallet.dashboard.locked"), Layout.GROUP_DISTANCE); addTitledGroupBg(root, ++gridRow, 3, Res.get("dao.wallet.dashboard.locked"), Layout.GROUP_DISTANCE);
totalLockedUpAmountTextField = FormBuilder.addTopLabelTextField(root, gridRow, Res.get("dao.wallet.dashboard.totalLockedUpAmount"), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second; totalLockedUpAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(root, gridRow, Res.get("dao.wallet.dashboard.totalLockedUpAmount"), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
totalUnlockingAmountTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.totalUnlockingAmount")).second; totalUnlockingAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.totalUnlockingAmount")).second;
totalUnlockedAmountTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.totalUnlockedAmount")).second; totalUnlockedAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.totalUnlockedAmount")).second;
addTitledGroupBg(root, ++gridRow, 2, Res.get("dao.wallet.dashboard.market"), Layout.GROUP_DISTANCE); gridRow = startRow;
priceTextField = FormBuilder.addTopLabelTextField(root, gridRow, Res.get("dao.wallet.dashboard.price"), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second; addTitledGroupBg(root, ++gridRow, columnIndex, 3, Res.get("dao.wallet.dashboard.market"), Layout.GROUP_DISTANCE);
marketCapTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.marketCap")).second; priceTextField = FormBuilder.addTopLabelReadOnlyTextField(root, gridRow, columnIndex, Res.get("dao.wallet.dashboard.price"), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
marketCapTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, columnIndex, Res.get("dao.wallet.dashboard.marketCap")).second;
++gridRow; // we need 3 rows as well
startRow = gridRow;
addTitledGroupBg(root, ++gridRow, 6, Res.get("dao.wallet.dashboard.txDetails"), Layout.GROUP_DISTANCE); addTitledGroupBg(root, ++gridRow, 4, Res.get("dao.wallet.dashboard.txDetails"), Layout.GROUP_DISTANCE);
addTopLabelTextField(root, gridRow, Res.get("dao.wallet.dashboard.genesisBlockHeight"),
String.valueOf(daoFacade.getGenesisBlockHeight()), Layout.FIRST_ROW_AND_GROUP_DISTANCE); String genTxHeight = String.valueOf(daoFacade.getGenesisBlockHeight());
hyperlinkWithIcon = addLabelHyperlinkWithIcon(root, ++gridRow, Res.get("dao.wallet.dashboard.genesisTxId"), String genesisTxId = daoFacade.getGenesisTxId();
daoFacade.getGenesisTxId(), preferences.getBsqBlockChainExplorer().txUrl + daoFacade.getGenesisTxId()).second; String url = preferences.getBsqBlockChainExplorer().txUrl + genesisTxId;
hyperlinkWithIcon.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForTx", daoFacade.getGenesisTxId())));
allTxTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.allTx")).second; addTopLabelReadOnlyTextField(root, gridRow, Res.get("dao.wallet.dashboard.genesisBlockHeight"), genTxHeight, Layout.FIRST_ROW_AND_GROUP_DISTANCE);
utxoTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.utxo")).second; hyperlinkWithIcon = FormBuilder.addTopLabelHyperlinkWithIcon(root, ++gridRow, Res.get("dao.wallet.dashboard.genesisTxId"), genesisTxId, url, 0).second;
compensationIssuanceTxTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.compensationIssuanceTx")).second; hyperlinkWithIcon.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForTx", genesisTxId)));
reimbursementIssuanceTxTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.reimbursementIssuanceTx")).second; allTxTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.allTx")).second;
burntTxTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.burntTx")).second; utxoTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.utxo")).second;
gridRow = startRow;
// We want closing line, so we add an invisible dummy group header
addTitledGroupBg(root, ++gridRow, columnIndex, 4, "", Layout.GROUP_DISTANCE);
compensationIssuanceTxTextField = FormBuilder.addTopLabelReadOnlyTextField(root, gridRow, columnIndex, Res.get("dao.wallet.dashboard.compensationIssuanceTx"), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
reimbursementIssuanceTxTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, columnIndex, Res.get("dao.wallet.dashboard.reimbursementIssuanceTx")).second;
burntTxTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, columnIndex, Res.get("dao.wallet.dashboard.burntTx")).second;
++gridRow; // we need 4 rows as well
priceChangeListener = (observable, oldValue, newValue) -> updatePrice(); priceChangeListener = (observable, oldValue, newValue) -> updatePrice();
} }

View file

@ -27,8 +27,7 @@
AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="160.0"/> <ColumnConstraints percentWidth="100"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>
</columnConstraints> </columnConstraints>
</GridPane> </GridPane>

View file

@ -27,7 +27,6 @@
AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="160.0"/> <ColumnConstraints percentWidth="100"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>
</columnConstraints> </columnConstraints>
</GridPane> </GridPane>

View file

@ -26,8 +26,7 @@
AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0"
xmlns:fx="http://javafx.com/fxml"> xmlns:fx="http://javafx.com/fxml">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="160.0"/> <ColumnConstraints percentWidth="100"/>
<ColumnConstraints hgrow="ALWAYS" minWidth="300.0"/>
</columnConstraints> </columnConstraints>
</GridPane> </GridPane>

View file

@ -128,13 +128,24 @@ public class FormBuilder {
return addTitledGroupBg(gridPane, rowIndex, rowSpan, title, 0); return addTitledGroupBg(gridPane, rowIndex, rowSpan, title, 0);
} }
public static TitledGroupBg addTitledGroupBg(GridPane gridPane, int rowIndex, int columnIndex, int rowSpan, String title) {
TitledGroupBg titledGroupBg = addTitledGroupBg(gridPane, rowIndex, rowSpan, title, 0);
GridPane.setColumnIndex(titledGroupBg, columnIndex);
return titledGroupBg;
}
public static TitledGroupBg addTitledGroupBg(GridPane gridPane, int rowIndex, int columnIndex, int rowSpan, String title, double top) {
TitledGroupBg titledGroupBg = addTitledGroupBg(gridPane, rowIndex, rowSpan, title, top);
GridPane.setColumnIndex(titledGroupBg, columnIndex);
return titledGroupBg;
}
public static TitledGroupBg addTitledGroupBg(GridPane gridPane, int rowIndex, int rowSpan, String title, double top) { public static TitledGroupBg addTitledGroupBg(GridPane gridPane, int rowIndex, int rowSpan, String title, double top) {
TitledGroupBg titledGroupBg = new TitledGroupBg(); TitledGroupBg titledGroupBg = new TitledGroupBg();
titledGroupBg.setText(title); titledGroupBg.setText(title);
titledGroupBg.prefWidthProperty().bind(gridPane.widthProperty()); titledGroupBg.prefWidthProperty().bind(gridPane.widthProperty());
GridPane.setRowIndex(titledGroupBg, rowIndex); GridPane.setRowIndex(titledGroupBg, rowIndex);
GridPane.setRowSpan(titledGroupBg, rowSpan); GridPane.setRowSpan(titledGroupBg, rowSpan);
GridPane.setColumnSpan(titledGroupBg, 2);
GridPane.setMargin(titledGroupBg, new Insets(top, -10, -10, -10)); GridPane.setMargin(titledGroupBg, new Insets(top, -10, -10, -10));
gridPane.getChildren().add(titledGroupBg); gridPane.getChildren().add(titledGroupBg);
return titledGroupBg; return titledGroupBg;
@ -212,6 +223,30 @@ public class FormBuilder {
// Label + TextField // Label + TextField
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
public static Tuple3<Label, TextField, VBox> addTopLabelReadOnlyTextField(GridPane gridPane, int rowIndex, String title) {
return addTopLabelTextField(gridPane, rowIndex, title, "", -15);
}
public static Tuple3<Label, TextField, VBox> addTopLabelReadOnlyTextField(GridPane gridPane, int rowIndex, int columnIndex, String title) {
Tuple3<Label, TextField, VBox> tuple = addTopLabelTextField(gridPane, rowIndex, title, "", -15);
GridPane.setColumnIndex(tuple.third, columnIndex);
return tuple;
}
public static Tuple3<Label, TextField, VBox> addTopLabelReadOnlyTextField(GridPane gridPane, int rowIndex, String title, double top) {
return addTopLabelTextField(gridPane, rowIndex, title, "", top - 15);
}
public static Tuple3<Label, TextField, VBox> addTopLabelReadOnlyTextField(GridPane gridPane, int rowIndex, int columnIndex, String title, double top) {
Tuple3<Label, TextField, VBox> tuple = addTopLabelTextField(gridPane, rowIndex, title, "", top - 15);
GridPane.setColumnIndex(tuple.third, columnIndex);
return tuple;
}
public static Tuple3<Label, TextField, VBox> addTopLabelReadOnlyTextField(GridPane gridPane, int rowIndex, String title, String value, double top) {
return addTopLabelTextField(gridPane, rowIndex, title, value, top - 15);
}
public static Tuple3<Label, TextField, VBox> addTopLabelTextField(GridPane gridPane, int rowIndex, String title) { public static Tuple3<Label, TextField, VBox> addTopLabelTextField(GridPane gridPane, int rowIndex, String title) {
return addTopLabelTextField(gridPane, rowIndex, title, "", 0); return addTopLabelTextField(gridPane, rowIndex, title, "", 0);
} }
@ -227,7 +262,10 @@ public class FormBuilder {
public static Tuple3<Label, TextField, VBox> addTopLabelTextField(GridPane gridPane, int rowIndex, String title, String value, double top) { public static Tuple3<Label, TextField, VBox> addTopLabelTextField(GridPane gridPane, int rowIndex, String title, String value, double top) {
TextField textField = new JFXTextField(value); TextField textField = new JFXTextField(value);
textField.setEditable(false); textField.setEditable(false);
textField.setMouseTransparent(true);
// MK: basically we want that text is copyable, not sure if it breaks anything if mouseTransparent is not set
//textField.setMouseTransparent(true);
textField.setFocusTraversable(false); textField.setFocusTraversable(false);
final Tuple2<Label, VBox> topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, textField, top); final Tuple2<Label, VBox> topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, textField, top);
@ -300,12 +338,26 @@ public class FormBuilder {
HyperlinkWithIcon hyperlinkWithIcon = new HyperlinkWithIcon(title, AwesomeIcon.EXTERNAL_LINK); HyperlinkWithIcon hyperlinkWithIcon = new HyperlinkWithIcon(title, AwesomeIcon.EXTERNAL_LINK);
hyperlinkWithIcon.setOnAction(e -> GUIUtil.openWebPage(url)); hyperlinkWithIcon.setOnAction(e -> GUIUtil.openWebPage(url));
GridPane.setRowIndex(hyperlinkWithIcon, rowIndex); GridPane.setRowIndex(hyperlinkWithIcon, rowIndex);
GridPane.setColumnIndex(hyperlinkWithIcon, 1);
GridPane.setMargin(hyperlinkWithIcon, new Insets(top, 0, 0, -4)); GridPane.setMargin(hyperlinkWithIcon, new Insets(top, 0, 0, -4));
gridPane.getChildren().add(hyperlinkWithIcon); gridPane.getChildren().add(hyperlinkWithIcon);
return new Tuple2<>(label, hyperlinkWithIcon); return new Tuple2<>(label, hyperlinkWithIcon);
} }
public static Tuple3<Label, HyperlinkWithIcon, VBox> addTopLabelHyperlinkWithIcon(GridPane gridPane,
int rowIndex,
String title,
String value,
String url,
double top) {
HyperlinkWithIcon hyperlinkWithIcon = new HyperlinkWithIcon(value, AwesomeIcon.EXTERNAL_LINK);
hyperlinkWithIcon.setOnAction(e -> GUIUtil.openWebPage(url));
hyperlinkWithIcon.getStyleClass().add("hyperlink-with-icon");
GridPane.setRowIndex(hyperlinkWithIcon, rowIndex);
Tuple2<Label, VBox> topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, hyperlinkWithIcon, top - 15);
return new Tuple3<>(topLabelWithVBox.first, hyperlinkWithIcon, topLabelWithVBox.second);
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// TextArea // TextArea
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@ -1018,7 +1070,6 @@ public class FormBuilder {
BsqAddressTextField addressTextField = new BsqAddressTextField(); BsqAddressTextField addressTextField = new BsqAddressTextField();
GridPane.setRowIndex(addressTextField, rowIndex); GridPane.setRowIndex(addressTextField, rowIndex);
GridPane.setColumnIndex(addressTextField, 1);
GridPane.setMargin(addressTextField, new Insets(top, 0, 0, 0)); GridPane.setMargin(addressTextField, new Insets(top, 0, 0, 0));
gridPane.getChildren().add(addressTextField); gridPane.getChildren().add(addressTextField);