From 85667659962187755360778d7e7cc6fa65e3256e Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Tue, 30 Oct 2018 01:06:59 -0500 Subject: [PATCH 1/3] Adjust layout with new design (WIP) - on css there are some changes marked with MK. @Christoph - please check if those are ok for you, otherwise lets discuss... - in Formbuilder there is removed the automatic setting of the column span and index - Add support for columnIndex as parameter - setMouseTransparent for addTopLabelTextField is removed (we want that user can copy text) - Adjustments in the DAO code are WIP and can be ignored by @Christoph --- .../resources/i18n/displayStrings.properties | 4 -- desktop/src/main/java/bisq/desktop/bisq.css | 44 +++++++++++- .../dashboard/BondingDashboardView.fxml | 5 +- .../dashboard/BondingDashboardView.java | 6 +- .../main/dao/bonding/lockup/LockupView.fxml | 3 +- .../dao/bonding/roles/BondedRolesView.fxml | 3 +- .../main/dao/bonding/unlock/UnlockView.fxml | 3 +- .../main/dao/governance/PhasesView.java | 4 +- .../dashboard/ProposalDashboardView.fxml | 3 +- .../dashboard/ProposalDashboardView.java | 20 +++--- .../dao/governance/make/MakeProposalView.fxml | 3 +- .../dao/governance/make/MakeProposalView.java | 1 + .../governance/proposals/ProposalsView.fxml | 3 +- .../dao/governance/result/VoteResultView.fxml | 3 +- .../main/dao/wallet/BsqBalanceUtil.java | 51 ++++++-------- .../wallet/dashboard/BsqDashboardView.fxml | 5 +- .../wallet/dashboard/BsqDashboardView.java | 67 +++++++++++-------- .../dao/wallet/receive/BsqReceiveView.fxml | 3 +- .../main/dao/wallet/send/BsqSendView.fxml | 3 +- .../desktop/main/dao/wallet/tx/BsqTxView.fxml | 3 +- .../java/bisq/desktop/util/FormBuilder.java | 59 ++++++++++++++-- 21 files changed, 189 insertions(+), 107 deletions(-) diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index db1176f5fe..f5e0be6c3e 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -1185,10 +1185,6 @@ dao.cycle.voteReveal=Vote reveal phase dao.cycle.voteResult=Vote result 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.table.header.cycle=Cycle dao.results.cycles.table.header.numProposals=Proposals diff --git a/desktop/src/main/java/bisq/desktop/bisq.css b/desktop/src/main/java/bisq/desktop/bisq.css index c514204a69..ee592d7ede 100644 --- a/desktop/src/main/java/bisq/desktop/bisq.css +++ b/desktop/src/main/java/bisq/desktop/bisq.css @@ -342,9 +342,32 @@ bg color of non edit textFields: fafafa -fx-background-radius: 3 3 0 0; } +/* MK: add grey bg, hide line, add padding, use same style for hyperlink-with-icon */ +/* .jfx-text-field:readonly { -fx-background-color: transparent; } +*/ + +.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; +} + +.jfx-text-field:readonly > .input-focused-line { + -fx-background-color: transparent; +} + +.hyperlink-with-icon { + -fx-background-color: -bs-rd-grey-medium-light; + -fx-padding: 0.333333em 0.333333em 0.333333em 0.333333em; +} + +/* MK end */ #info-field { -fx-prompt-text-fill: -bs-rd-black; @@ -1345,20 +1368,39 @@ textfield */ } /* TitledGroupBg */ + +/* MK: change font size of group header to 1.3em*/ +/* .titled-group-bg-label { -fx-font-size: 1.077em; -fx-font-family: "IBM Plex Sans Medium"; -fx-text-fill: -bs-rd-black; -fx-background-color: transparent; } +.titled-group-bg-label { + -fx-font-size: 1.077em; + -fx-font-family: "IBM Plex Sans Medium"; + -fx-text-fill: -bs-rd-black; + -fx-background-color: transparent; +} +*/ + +.titled-group-bg-label { + -fx-font-size: 1.3em; + -fx-font-family: "IBM Plex Sans Medium"; + -fx-text-fill: -bs-rd-black; + -fx-background-color: transparent; +} .titled-group-bg-label-active { -fx-font-weight: normal; - -fx-font-size: 1.077em; + -fx-font-size: 1.3em; -fx-text-fill: -bs-rd-black; -fx-background-color: transparent; } +/* MK end */ + .titled-group-bg, .titled-group-bg-active { -fx-body-color: -bs-rd-grey-background; -fx-border-color: -bs-rd-separator; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/bonding/dashboard/BondingDashboardView.fxml b/desktop/src/main/java/bisq/desktop/main/dao/bonding/dashboard/BondingDashboardView.fxml index 48d8c4cd00..31a852c68f 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/bonding/dashboard/BondingDashboardView.fxml +++ b/desktop/src/main/java/bisq/desktop/main/dao/bonding/dashboard/BondingDashboardView.fxml @@ -26,7 +26,8 @@ AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" xmlns:fx="http://javafx.com/fxml"> - - + + + diff --git a/desktop/src/main/java/bisq/desktop/main/dao/bonding/dashboard/BondingDashboardView.java b/desktop/src/main/java/bisq/desktop/main/dao/bonding/dashboard/BondingDashboardView.java index 1d0ae8ea84..685af55c85 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/bonding/dashboard/BondingDashboardView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/bonding/dashboard/BondingDashboardView.java @@ -30,6 +30,7 @@ public class BondingDashboardView extends ActivatableView { private final BsqBalanceUtil bsqBalanceUtil; private int gridRow = 0; + private int startRow; /////////////////////////////////////////////////////////////////////////////////////////// // Constructor, lifecycle @@ -41,8 +42,11 @@ public class BondingDashboardView extends ActivatableView { } public void initialize() { + startRow = gridRow; gridRow = bsqBalanceUtil.addGroup(root, gridRow); - gridRow = bsqBalanceUtil.addBondBalanceGroup(root, gridRow); + gridRow = startRow; + int columnIndex = 2; + gridRow = bsqBalanceUtil.addBondBalanceGroup(root, gridRow, columnIndex); } @Override diff --git a/desktop/src/main/java/bisq/desktop/main/dao/bonding/lockup/LockupView.fxml b/desktop/src/main/java/bisq/desktop/main/dao/bonding/lockup/LockupView.fxml index 0129e40e85..1038ed74a2 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/bonding/lockup/LockupView.fxml +++ b/desktop/src/main/java/bisq/desktop/main/dao/bonding/lockup/LockupView.fxml @@ -27,8 +27,7 @@ AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" xmlns:fx="http://javafx.com/fxml"> - - + diff --git a/desktop/src/main/java/bisq/desktop/main/dao/bonding/roles/BondedRolesView.fxml b/desktop/src/main/java/bisq/desktop/main/dao/bonding/roles/BondedRolesView.fxml index 987214b490..e5233b4dc4 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/bonding/roles/BondedRolesView.fxml +++ b/desktop/src/main/java/bisq/desktop/main/dao/bonding/roles/BondedRolesView.fxml @@ -27,8 +27,7 @@ AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" xmlns:fx="http://javafx.com/fxml"> - - + diff --git a/desktop/src/main/java/bisq/desktop/main/dao/bonding/unlock/UnlockView.fxml b/desktop/src/main/java/bisq/desktop/main/dao/bonding/unlock/UnlockView.fxml index 025947f64c..ebb2acd157 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/bonding/unlock/UnlockView.fxml +++ b/desktop/src/main/java/bisq/desktop/main/dao/bonding/unlock/UnlockView.fxml @@ -27,8 +27,7 @@ AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" xmlns:fx="http://javafx.com/fxml"> - - + diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/PhasesView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/PhasesView.java index bc0c9ecce2..b68e9d82ab 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/PhasesView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/PhasesView.java @@ -57,9 +57,7 @@ public class PhasesView implements DaoStateListener { public int addGroup(GridPane gridPane, int gridRow) { addTitledGroupBg(gridPane, gridRow, 1, Res.get("dao.cycle.headline")); separatedPhaseBars = createSeparatedPhaseBars(); - GridPane.setColumnSpan(separatedPhaseBars, 2); - GridPane.setColumnIndex(separatedPhaseBars, 0); - GridPane.setMargin(separatedPhaseBars, new Insets(Layout.FIRST_ROW_DISTANCE - 6, 0, 0, 0)); + GridPane.setMargin(separatedPhaseBars, new Insets(Layout.FIRST_ROW_DISTANCE + 5, 0, 0, 0)); GridPane.setRowIndex(separatedPhaseBars, gridRow); gridPane.getChildren().add(separatedPhaseBars); return gridRow; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/dashboard/ProposalDashboardView.fxml b/desktop/src/main/java/bisq/desktop/main/dao/governance/dashboard/ProposalDashboardView.fxml index 55ecbbb045..26e8905363 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/dashboard/ProposalDashboardView.fxml +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/dashboard/ProposalDashboardView.fxml @@ -26,7 +26,6 @@ AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" xmlns:fx="http://javafx.com/fxml"> - - + diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/dashboard/ProposalDashboardView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/dashboard/ProposalDashboardView.java index 841d8460c0..49c7c70104 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/dashboard/ProposalDashboardView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/dashboard/ProposalDashboardView.java @@ -40,9 +40,8 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; -import static bisq.desktop.util.FormBuilder.addMultilineLabel; 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 // block. The event from the ChainHeightListener is sent before parsing starts. @@ -73,16 +72,13 @@ public class ProposalDashboardView extends ActivatableView imple gridRow = phasesView.addGroup(root, gridRow); addTitledGroupBg(root, ++gridRow, 6, Res.get("dao.cycle.overview.headline"), Layout.GROUP_DISTANCE); - currentBlockHeightTextField = addTopLabelTextField(root, gridRow, Res.get("dao.cycle.currentBlockHeight"), - "", Layout.FIRST_ROW_AND_GROUP_DISTANCE).second; - currentPhaseTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.cycle.currentPhase"), "").second; - proposalTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.cycle.proposal"), "").second; - blindVoteTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.cycle.blindVote"), "").second; - voteRevealTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.cycle.voteReveal"), "").second; - voteResultTextField = FormBuilder.addTopLabelTextField(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); + currentBlockHeightTextField = addTopLabelReadOnlyTextField(root, gridRow, Res.get("dao.cycle.currentBlockHeight"), + Layout.FIRST_ROW_AND_GROUP_DISTANCE).second; + currentPhaseTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, Res.get("dao.cycle.currentPhase")).second; + proposalTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, Res.get("dao.cycle.proposal")).second; + blindVoteTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, Res.get("dao.cycle.blindVote")).second; + voteRevealTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, Res.get("dao.cycle.voteReveal")).second; + voteResultTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, Res.get("dao.cycle.voteResult")).second; } @Override diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.fxml b/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.fxml index 5d2df74234..d5d6c8d287 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.fxml +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.fxml @@ -26,7 +26,6 @@ AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" xmlns:fx="http://javafx.com/fxml"> - - + diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java index 2cea9e3d45..4b09b3d297 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java @@ -131,6 +131,7 @@ public class MakeProposalView extends ActivatableView implements addTitledGroupBg(root, ++gridRow, 1, Res.get("dao.proposal.create.selectProposalType"), Layout.GROUP_DISTANCE); proposalTypeComboBox = FormBuilder.addComboBox(root, gridRow, Res.getWithCol("dao.proposal.create.proposalType"), Layout.FIRST_ROW_AND_GROUP_DISTANCE); + proposalTypeComboBox.setMaxWidth(300); proposalTypeComboBox.setConverter(new StringConverter<>() { @Override public String toString(ProposalType proposalType) { diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.fxml b/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.fxml index 68e0bdfc40..c056ac3b60 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.fxml +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.fxml @@ -27,7 +27,6 @@ AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" xmlns:fx="http://javafx.com/fxml"> - - + diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.fxml b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.fxml index 7bb8596c65..091800d848 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.fxml +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.fxml @@ -27,7 +27,6 @@ AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" xmlns:fx="http://javafx.com/fxml"> - - + diff --git a/desktop/src/main/java/bisq/desktop/main/dao/wallet/BsqBalanceUtil.java b/desktop/src/main/java/bisq/desktop/main/dao/wallet/BsqBalanceUtil.java index 54f2fbb87b..3f3e7e38cc 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/wallet/BsqBalanceUtil.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/wallet/BsqBalanceUtil.java @@ -63,53 +63,44 @@ public class BsqBalanceUtil implements BsqBalanceListener { } public int addGroup(GridPane gridPane, int gridRow) { - titledGroupBg = addTitledGroupBg(gridPane, gridRow, 5, Res.get("dao.wallet.dashboard.myBalance")); - availableBalanceTextField = FormBuilder.addTopLabelTextField(gridPane, gridRow, - Res.getWithCol("dao.availableBsqBalance"), - Layout.FIRST_ROW_DISTANCE).second; - availableBalanceTextField.setMouseTransparent(false); + titledGroupBg = addTitledGroupBg(gridPane, gridRow, 6, Res.get("dao.wallet.dashboard.myBalance")); - unverifiedBalanceTextField = FormBuilder.addTopLabelTextField(gridPane, ++gridRow, - Res.getWithCol("dao.unverifiedBsqBalance")).second; - unverifiedBalanceTextField.setMouseTransparent(false); + availableBalanceTextField = FormBuilder.addTopLabelReadOnlyTextField(gridPane, gridRow, + Res.get("dao.availableBsqBalance"), Layout.FIRST_ROW_DISTANCE).second; - lockedForVoteBalanceTextField = FormBuilder.addTopLabelTextField(gridPane, ++gridRow, - Res.getWithCol("dao.lockedForVoteBalance")).second; - lockedForVoteBalanceTextField.setMouseTransparent(false); + unverifiedBalanceTextField = FormBuilder.addTopLabelReadOnlyTextField(gridPane, ++gridRow, + Res.get("dao.unverifiedBsqBalance")).second; - lockedInBondsBalanceTextField = FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.getWithCol( - "dao.lockedInBonds")).second; - lockedInBondsBalanceTextField.setMouseTransparent(false); + lockedForVoteBalanceTextField = FormBuilder.addTopLabelReadOnlyTextField(gridPane, ++gridRow, + Res.get("dao.lockedForVoteBalance")).second; + + lockedInBondsBalanceTextField = FormBuilder.addTopLabelReadOnlyTextField(gridPane, ++gridRow, + Res.get("dao.lockedInBonds")).second; // TODO add unlockingBondsBalanceTextField - totalBalanceTextField = FormBuilder.addTopLabelTextField(gridPane, ++gridRow, - Res.getWithCol("dao.totalBsqBalance")).second; - totalBalanceTextField.setMouseTransparent(false); + totalBalanceTextField = FormBuilder.addTopLabelReadOnlyTextField(gridPane, ++gridRow, + Res.get("dao.totalBsqBalance")).second; - Tuple3 tuple3 = FormBuilder.addTopLabelTextField(gridPane, ++gridRow, - Res.getWithCol("dao.availableNonBsqBalance")); + Tuple3 tuple3 = FormBuilder.addTopLabelReadOnlyTextField(gridPane, ++gridRow, + Res.get("dao.availableNonBsqBalance")); availableNonBsqBalanceLabel = tuple3.first; availableNonBsqBalanceTextField = tuple3.second; - availableNonBsqBalanceTextField.setMouseTransparent(false); availableNonBsqBalanceTextField.setVisible(false); availableNonBsqBalanceTextField.setManaged(false); return gridRow; } - public int addBondBalanceGroup(GridPane gridPane, int gridRow) { - addTitledGroupBg(gridPane, ++gridRow, 2, - Res.get("dao.bonding.dashboard.bondsHeadline"), Layout.GROUP_DISTANCE); + public int addBondBalanceGroup(GridPane gridPane, int gridRow, int columnIndex) { + addTitledGroupBg(gridPane, gridRow, columnIndex, 6, + Res.get("dao.bonding.dashboard.bondsHeadline")); - lockupAmountTextField = FormBuilder.addTopLabelTextField(gridPane, gridRow, + lockupAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(gridPane, gridRow, columnIndex, Res.get("dao.bonding.dashboard.lockupAmount"), - Layout.FIRST_ROW_DISTANCE + Layout.GROUP_DISTANCE).second; - lockupAmountTextField.setMouseTransparent(false); - - unlockingAmountTextField = FormBuilder.addTopLabelTextField(gridPane, ++gridRow, + Layout.FIRST_ROW_DISTANCE).second; + unlockingAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(gridPane, ++gridRow, columnIndex, Res.get("dao.bonding.dashboard.unlockingAmount")).second; - unlockingAmountTextField.setMouseTransparent(false); return gridRow; } @@ -138,8 +129,6 @@ public class BsqBalanceUtil implements BsqBalanceListener { Coin unlockingBondsBalance) { boolean isNonBsqBalanceAvailable = availableNonBsqBalance.value > 0; - int rowSpan = isNonBsqBalanceAvailable ? 6 : 5; - GridPane.setRowSpan(titledGroupBg, rowSpan); availableBalanceTextField.setText(bsqFormatter.formatCoinWithCode(availableBalance)); unverifiedBalanceTextField.setText(bsqFormatter.formatCoinWithCode(unverifiedBalance)); diff --git a/desktop/src/main/java/bisq/desktop/main/dao/wallet/dashboard/BsqDashboardView.fxml b/desktop/src/main/java/bisq/desktop/main/dao/wallet/dashboard/BsqDashboardView.fxml index 7ee966a25b..35a2a682fc 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/wallet/dashboard/BsqDashboardView.fxml +++ b/desktop/src/main/java/bisq/desktop/main/dao/wallet/dashboard/BsqDashboardView.fxml @@ -26,7 +26,8 @@ AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" xmlns:fx="http://javafx.com/fxml"> - - + + + diff --git a/desktop/src/main/java/bisq/desktop/main/dao/wallet/dashboard/BsqDashboardView.java b/desktop/src/main/java/bisq/desktop/main/dao/wallet/dashboard/BsqDashboardView.java index 4ad6f6d2e4..b912ec5e61 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/wallet/dashboard/BsqDashboardView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/wallet/dashboard/BsqDashboardView.java @@ -48,9 +48,8 @@ import javafx.scene.layout.GridPane; 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.addTopLabelTextField; +import static bisq.desktop.util.FormBuilder.addTopLabelReadOnlyTextField; @FxmlView public class BsqDashboardView extends ActivatableView implements DaoStateListener { @@ -89,38 +88,52 @@ public class BsqDashboardView extends ActivatableView implements @Override public void initialize() { + int startRow = gridRow; gridRow = bsqBalanceUtil.addGroup(root, gridRow); - addTitledGroupBg(root, ++gridRow, 5, Res.get("dao.wallet.dashboard.distribution"), Layout.GROUP_DISTANCE); - - genesisIssueAmountTextField = FormBuilder.addTopLabelTextField(root, gridRow, Res.get("dao.wallet.dashboard.genesisIssueAmount"), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second; - compRequestIssueAmountTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.compRequestIssueAmount")).second; - reimbursementAmountTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.reimbursementAmount")).second; - burntAmountTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.burntAmount")).second; - availableAmountTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.availableAmount")).second; - + gridRow = startRow; + int columnIndex = 2; + addTitledGroupBg(root, gridRow, columnIndex, 6, Res.get("dao.wallet.dashboard.distribution")); + genesisIssueAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(root, gridRow, columnIndex, Res.get("dao.wallet.dashboard.genesisIssueAmount"), Layout.FIRST_ROW_DISTANCE).second; + compRequestIssueAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, columnIndex, Res.get("dao.wallet.dashboard.compRequestIssueAmount")).second; + reimbursementAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, columnIndex, Res.get("dao.wallet.dashboard.reimbursementAmount")).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); - totalLockedUpAmountTextField = FormBuilder.addTopLabelTextField(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; - totalUnlockedAmountTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.totalUnlockedAmount")).second; + totalLockedUpAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(root, gridRow, Res.get("dao.wallet.dashboard.totalLockedUpAmount"), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second; + totalUnlockingAmountTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.totalUnlockingAmount")).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); - priceTextField = FormBuilder.addTopLabelTextField(root, gridRow, Res.get("dao.wallet.dashboard.price"), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second; - marketCapTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.marketCap")).second; + gridRow = startRow; + addTitledGroupBg(root, ++gridRow, columnIndex, 3, Res.get("dao.wallet.dashboard.market"), Layout.GROUP_DISTANCE); + 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); - addTopLabelTextField(root, gridRow, Res.get("dao.wallet.dashboard.genesisBlockHeight"), - String.valueOf(daoFacade.getGenesisBlockHeight()), Layout.FIRST_ROW_AND_GROUP_DISTANCE); - hyperlinkWithIcon = addLabelHyperlinkWithIcon(root, ++gridRow, Res.get("dao.wallet.dashboard.genesisTxId"), - daoFacade.getGenesisTxId(), preferences.getBsqBlockChainExplorer().txUrl + daoFacade.getGenesisTxId()).second; - hyperlinkWithIcon.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForTx", daoFacade.getGenesisTxId()))); - allTxTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.allTx")).second; - utxoTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.utxo")).second; - compensationIssuanceTxTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.compensationIssuanceTx")).second; - reimbursementIssuanceTxTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.reimbursementIssuanceTx")).second; - burntTxTextField = FormBuilder.addTopLabelTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.burntTx")).second; + addTitledGroupBg(root, ++gridRow, 4, Res.get("dao.wallet.dashboard.txDetails"), Layout.GROUP_DISTANCE); + + String genTxHeight = String.valueOf(daoFacade.getGenesisBlockHeight()); + String genesisTxId = daoFacade.getGenesisTxId(); + String url = preferences.getBsqBlockChainExplorer().txUrl + genesisTxId; + + addTopLabelReadOnlyTextField(root, gridRow, Res.get("dao.wallet.dashboard.genesisBlockHeight"), genTxHeight, Layout.FIRST_ROW_AND_GROUP_DISTANCE); + hyperlinkWithIcon = FormBuilder.addTopLabelHyperlinkWithIcon(root, ++gridRow, Res.get("dao.wallet.dashboard.genesisTxId"), genesisTxId, url, 0).second; + hyperlinkWithIcon.setTooltip(new Tooltip(Res.get("tooltip.openBlockchainForTx", genesisTxId))); + allTxTextField = FormBuilder.addTopLabelReadOnlyTextField(root, ++gridRow, Res.get("dao.wallet.dashboard.allTx")).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(); } diff --git a/desktop/src/main/java/bisq/desktop/main/dao/wallet/receive/BsqReceiveView.fxml b/desktop/src/main/java/bisq/desktop/main/dao/wallet/receive/BsqReceiveView.fxml index 541c78debb..648b189400 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/wallet/receive/BsqReceiveView.fxml +++ b/desktop/src/main/java/bisq/desktop/main/dao/wallet/receive/BsqReceiveView.fxml @@ -27,8 +27,7 @@ AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" xmlns:fx="http://javafx.com/fxml"> - - + diff --git a/desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.fxml b/desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.fxml index dd2f73cc71..6f60c7563b 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.fxml +++ b/desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.fxml @@ -27,7 +27,6 @@ AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" xmlns:fx="http://javafx.com/fxml"> - - + diff --git a/desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxView.fxml b/desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxView.fxml index f91d65a273..13caf449e2 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxView.fxml +++ b/desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxView.fxml @@ -26,8 +26,7 @@ AnchorPane.rightAnchor="25.0" AnchorPane.topAnchor="20.0" xmlns:fx="http://javafx.com/fxml"> - - + diff --git a/desktop/src/main/java/bisq/desktop/util/FormBuilder.java b/desktop/src/main/java/bisq/desktop/util/FormBuilder.java index 292f167dce..5e21f5143b 100644 --- a/desktop/src/main/java/bisq/desktop/util/FormBuilder.java +++ b/desktop/src/main/java/bisq/desktop/util/FormBuilder.java @@ -128,13 +128,24 @@ public class FormBuilder { 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) { TitledGroupBg titledGroupBg = new TitledGroupBg(); titledGroupBg.setText(title); titledGroupBg.prefWidthProperty().bind(gridPane.widthProperty()); GridPane.setRowIndex(titledGroupBg, rowIndex); GridPane.setRowSpan(titledGroupBg, rowSpan); - GridPane.setColumnSpan(titledGroupBg, 2); GridPane.setMargin(titledGroupBg, new Insets(top, -10, -10, -10)); gridPane.getChildren().add(titledGroupBg); return titledGroupBg; @@ -212,6 +223,30 @@ public class FormBuilder { // Label + TextField /////////////////////////////////////////////////////////////////////////////////////////// + public static Tuple3 addTopLabelReadOnlyTextField(GridPane gridPane, int rowIndex, String title) { + return addTopLabelTextField(gridPane, rowIndex, title, "", -15); + } + + public static Tuple3 addTopLabelReadOnlyTextField(GridPane gridPane, int rowIndex, int columnIndex, String title) { + Tuple3 tuple = addTopLabelTextField(gridPane, rowIndex, title, "", -15); + GridPane.setColumnIndex(tuple.third, columnIndex); + return tuple; + } + + public static Tuple3 addTopLabelReadOnlyTextField(GridPane gridPane, int rowIndex, String title, double top) { + return addTopLabelTextField(gridPane, rowIndex, title, "", top - 15); + } + + public static Tuple3 addTopLabelReadOnlyTextField(GridPane gridPane, int rowIndex, int columnIndex, String title, double top) { + Tuple3 tuple = addTopLabelTextField(gridPane, rowIndex, title, "", top - 15); + GridPane.setColumnIndex(tuple.third, columnIndex); + return tuple; + } + + public static Tuple3 addTopLabelReadOnlyTextField(GridPane gridPane, int rowIndex, String title, String value, double top) { + return addTopLabelTextField(gridPane, rowIndex, title, value, top - 15); + } + public static Tuple3 addTopLabelTextField(GridPane gridPane, int rowIndex, String title) { return addTopLabelTextField(gridPane, rowIndex, title, "", 0); } @@ -227,7 +262,10 @@ public class FormBuilder { public static Tuple3 addTopLabelTextField(GridPane gridPane, int rowIndex, String title, String value, double top) { TextField textField = new JFXTextField(value); 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); final Tuple2 topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, textField, top); @@ -300,12 +338,26 @@ public class FormBuilder { HyperlinkWithIcon hyperlinkWithIcon = new HyperlinkWithIcon(title, AwesomeIcon.EXTERNAL_LINK); hyperlinkWithIcon.setOnAction(e -> GUIUtil.openWebPage(url)); GridPane.setRowIndex(hyperlinkWithIcon, rowIndex); - GridPane.setColumnIndex(hyperlinkWithIcon, 1); GridPane.setMargin(hyperlinkWithIcon, new Insets(top, 0, 0, -4)); gridPane.getChildren().add(hyperlinkWithIcon); return new Tuple2<>(label, hyperlinkWithIcon); } + + public static Tuple3 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 topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, hyperlinkWithIcon, top - 15); + return new Tuple3<>(topLabelWithVBox.first, hyperlinkWithIcon, topLabelWithVBox.second); + } + /////////////////////////////////////////////////////////////////////////////////////////// // TextArea /////////////////////////////////////////////////////////////////////////////////////////// @@ -1018,7 +1070,6 @@ public class FormBuilder { BsqAddressTextField addressTextField = new BsqAddressTextField(); GridPane.setRowIndex(addressTextField, rowIndex); - GridPane.setColumnIndex(addressTextField, 1); GridPane.setMargin(addressTextField, new Insets(top, 0, 0, 0)); gridPane.getChildren().add(addressTextField); From 6902f9aa0d7da553442d65edd70902e84e04ad5f Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Tue, 30 Oct 2018 13:14:01 -0500 Subject: [PATCH 2/3] Use 1.231em for group header font size --- desktop/src/main/java/bisq/desktop/bisq.css | 32 +++------------------ 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/bisq.css b/desktop/src/main/java/bisq/desktop/bisq.css index ee592d7ede..f9dfbb3a9a 100644 --- a/desktop/src/main/java/bisq/desktop/bisq.css +++ b/desktop/src/main/java/bisq/desktop/bisq.css @@ -342,13 +342,6 @@ bg color of non edit textFields: fafafa -fx-background-radius: 3 3 0 0; } -/* MK: add grey bg, hide line, add padding, use same style for hyperlink-with-icon */ -/* -.jfx-text-field:readonly { - -fx-background-color: transparent; -} -*/ - .jfx-text-field:readonly { -fx-background-color: -bs-rd-grey-medium-light; -fx-padding: 0.333333em 0.333333em 0.333333em 0.333333em; @@ -362,12 +355,13 @@ bg color of non edit textFields: fafafa -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; } -/* MK end */ #info-field { -fx-prompt-text-fill: -bs-rd-black; @@ -1369,24 +1363,8 @@ textfield */ /* TitledGroupBg */ -/* MK: change font size of group header to 1.3em*/ -/* .titled-group-bg-label { - -fx-font-size: 1.077em; - -fx-font-family: "IBM Plex Sans Medium"; - -fx-text-fill: -bs-rd-black; - -fx-background-color: transparent; -} -.titled-group-bg-label { - -fx-font-size: 1.077em; - -fx-font-family: "IBM Plex Sans Medium"; - -fx-text-fill: -bs-rd-black; - -fx-background-color: transparent; -} -*/ - -.titled-group-bg-label { - -fx-font-size: 1.3em; + -fx-font-size: 1.231em; -fx-font-family: "IBM Plex Sans Medium"; -fx-text-fill: -bs-rd-black; -fx-background-color: transparent; @@ -1394,13 +1372,11 @@ textfield */ .titled-group-bg-label-active { -fx-font-weight: normal; - -fx-font-size: 1.3em; + -fx-font-size: 1.231em; -fx-text-fill: -bs-rd-black; -fx-background-color: transparent; } -/* MK end */ - .titled-group-bg, .titled-group-bg-active { -fx-body-color: -bs-rd-grey-background; -fx-border-color: -bs-rd-separator; From ef3e4ba9050d29c9daf8a9d487014773f8654842 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Tue, 30 Oct 2018 13:14:19 -0500 Subject: [PATCH 3/3] Fix issue with not applied error msg in validator --- .../main/java/bisq/desktop/components/InputTextField.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/components/InputTextField.java b/desktop/src/main/java/bisq/desktop/components/InputTextField.java index 347200b24b..bb1e0246ff 100644 --- a/desktop/src/main/java/bisq/desktop/components/InputTextField.java +++ b/desktop/src/main/java/bisq/desktop/components/InputTextField.java @@ -78,8 +78,12 @@ public class InputTextField extends JFXTextField { }); focusedProperty().addListener((o, oldValue, newValue) -> { - if (oldValue && !newValue && validator != null) - validationResult.set(validator.validate(getText())); + if (oldValue && !newValue && validator != null) { + // 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())); + } }); }