Improve layout

This commit is contained in:
Christoph Atteneder 2019-03-27 15:06:39 +01:00
parent 4c46b3865b
commit ff21c916fa
No known key found for this signature in database
GPG key ID: CD5DC1C529CDFD3B
4 changed files with 50 additions and 15 deletions

View file

@ -2075,6 +2075,17 @@ textfield */
-fx-text-fill: -bs-rd-error-red; -fx-text-fill: -bs-rd-error-red;
} }
.dao-kpi-big {
-fx-font-size: 1.923em;
-fx-text-fill: -bs-rd-black;
-fx-font-family: "IBM Plex Sans Light";
}
.dao-kpi-subtext {
-fx-text-fill: -bs-rd-font-light;
-fx-font-size: 0.923em;
}
/******************************************************************************************************************** /********************************************************************************************************************
* * * *
* Notifications * * Notifications *

View file

@ -19,7 +19,6 @@ package bisq.desktop.main.dao.economy.dashboard;
import bisq.desktop.common.view.ActivatableView; import bisq.desktop.common.view.ActivatableView;
import bisq.desktop.common.view.FxmlView; import bisq.desktop.common.view.FxmlView;
import bisq.desktop.components.TitledGroupBg;
import bisq.desktop.util.FormBuilder; import bisq.desktop.util.FormBuilder;
import bisq.core.dao.DaoFacade; import bisq.core.dao.DaoFacade;
@ -75,9 +74,8 @@ import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static bisq.desktop.util.FormBuilder.addTitledGroupBg; import static bisq.desktop.util.FormBuilder.addLabelWithSubText;
import static bisq.desktop.util.FormBuilder.addTopLabelReadOnlyTextField; import static bisq.desktop.util.FormBuilder.addTopLabelReadOnlyTextField;
import static bisq.desktop.util.Layout.FIRST_ROW_DISTANCE;
@ -103,7 +101,8 @@ public class BsqDashboardView extends ActivatableView<GridPane, Void> implements
private XYChart.Series<Number, Number> seriesBSQAdded, seriesBSQBurnt; private XYChart.Series<Number, Number> seriesBSQAdded, seriesBSQBurnt;
private XYChart.Series<Number, Number> seriesBSQPrice; private XYChart.Series<Number, Number> seriesBSQPrice;
private TextField marketCapTextField, priceTextField, availableAmountTextField; private TextField marketCapTextField, availableAmountTextField;
private Label marketPriceLabel;
private Coin availableAmount; private Coin availableAmount;
@ -143,14 +142,11 @@ public class BsqDashboardView extends ActivatableView<GridPane, Void> implements
private void createKPIs() { private void createKPIs() {
TitledGroupBg titledGroupBg = addTitledGroupBg(root, gridRow, 5, Res.get("dao.factsAndFigures.dashboard.marketPrice")); Tuple3<Label, Label, VBox> marketPriceBox = addLabelWithSubText(root, gridRow++, "0.004000 BSQ/BTC", "Latest BSQ/BTC trade price (in Bisq)");
titledGroupBg.getStyleClass().add("last"); marketPriceLabel = marketPriceBox.first;
marketPriceLabel.getStyleClass().add("dao-kpi-big");
Tuple3<Label, TextField, VBox> marketPriceTuple = addTopLabelReadOnlyTextField(root, gridRow, Res.get("dao.factsAndFigures.dashboard.price"), marketPriceBox.second.getStyleClass().add("dao-kpi-subtext");
FIRST_ROW_DISTANCE);
priceTextField = marketPriceTuple.second;
GridPane.setColumnSpan(marketPriceTuple.third, 2);
marketCapTextField = addTopLabelReadOnlyTextField(root, ++gridRow, marketCapTextField = addTopLabelReadOnlyTextField(root, ++gridRow,
Res.get("dao.factsAndFigures.dashboard.marketCap")).second; Res.get("dao.factsAndFigures.dashboard.marketCap")).second;
@ -258,6 +254,7 @@ public class BsqDashboardView extends ActivatableView<GridPane, Void> implements
GridPane.setRowIndex(chartPane, ++gridRow); GridPane.setRowIndex(chartPane, ++gridRow);
GridPane.setColumnSpan(chartPane, 2); GridPane.setColumnSpan(chartPane, 2);
GridPane.setMargin(chartPane, new Insets(10, 0, 0, 0));
root.getChildren().addAll(chartPane); root.getChildren().addAll(chartPane);
} }
@ -310,13 +307,16 @@ public class BsqDashboardView extends ActivatableView<GridPane, Void> implements
Optional<Price> optionalBsqPrice = priceFeedService.getBsqPrice(); Optional<Price> optionalBsqPrice = priceFeedService.getBsqPrice();
if (optionalBsqPrice.isPresent()) { if (optionalBsqPrice.isPresent()) {
Price bsqPrice = optionalBsqPrice.get(); Price bsqPrice = optionalBsqPrice.get();
priceTextField.setText(bsqFormatter.formatPrice(bsqPrice) + " BSQ/BTC"); marketPriceLabel.setText(bsqFormatter.formatPrice(bsqPrice) + " BSQ/BTC");
marketCapTextField.setText(bsqFormatter.formatMarketCap(priceFeedService.getMarketPrice("BSQ"), marketCapTextField.setText(bsqFormatter.formatMarketCap(priceFeedService.getMarketPrice("BSQ"),
priceFeedService.getMarketPrice(preferences.getPreferredTradeCurrency().getCode()), priceFeedService.getMarketPrice(preferences.getPreferredTradeCurrency().getCode()),
availableAmount)); availableAmount));
updateChartData();
} else { } else {
priceTextField.setText(Res.get("shared.na")); marketPriceLabel.setText(Res.get("shared.na"));
marketCapTextField.setText(Res.get("shared.na")); marketCapTextField.setText(Res.get("shared.na"));
} }
} }

View file

@ -122,7 +122,6 @@ public class SupplyView extends ActivatableView<GridPane, Void> implements DaoSt
daoFacade.addBsqStateListener(this); daoFacade.addBsqStateListener(this);
updateWithBsqBlockChainData(); updateWithBsqBlockChainData();
updateBSQTokenData();
} }
@Override @Override
@ -258,6 +257,7 @@ public class SupplyView extends ActivatableView<GridPane, Void> implements DaoSt
GridPane.setColumnSpan(chartPane, 2); GridPane.setColumnSpan(chartPane, 2);
GridPane.setRowIndex(chartPane, ++gridRow); GridPane.setRowIndex(chartPane, ++gridRow);
GridPane.setMargin(chartPane, new Insets(10, 0, 0, 0));
root.getChildren().add(chartPane); root.getChildren().add(chartPane);
} }
@ -282,9 +282,11 @@ public class SupplyView extends ActivatableView<GridPane, Void> implements DaoSt
totalUnlockingAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalUnlockingAmount)); totalUnlockingAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalUnlockingAmount));
totalUnlockedAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalUnlockedAmount)); totalUnlockedAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalUnlockedAmount));
totalConfiscatedAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalConfiscatedAmount)); totalConfiscatedAmountTextField.setText(bsqFormatter.formatAmountWithGroupSeparatorAndCode(totalConfiscatedAmount));
updateCharts();
} }
private void updateBSQTokenData() { private void updateCharts() {
seriesBSQIssued.getData().clear(); seriesBSQIssued.getData().clear();
seriesBSQBurnt.getData().clear(); seriesBSQBurnt.getData().clear();

View file

@ -141,6 +141,28 @@ public class FormBuilder {
return label; return label;
} }
///////////////////////////////////////////////////////////////////////////////////////////
// Label + Subtext
///////////////////////////////////////////////////////////////////////////////////////////
public static Tuple3<Label, Label, VBox> addLabelWithSubText(GridPane gridPane, int rowIndex, String title, String description) {
return addLabelWithSubText(gridPane, rowIndex, title, description, 0);
}
public static Tuple3<Label, Label, VBox> addLabelWithSubText(GridPane gridPane, int rowIndex, String title, String description, double top) {
Label label = new AutoTooltipLabel(title);
Label subText = new AutoTooltipLabel(description);
VBox vBox = new VBox();
vBox.getChildren().setAll(label, subText);
GridPane.setRowIndex(vBox, rowIndex);
GridPane.setMargin(vBox, new Insets(top, 0, 0, 0));
gridPane.getChildren().add(vBox);
return new Tuple3<>(label, subText, vBox);
}
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Multiline Label // Multiline Label