mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Adapt ComboBox and CheckBox positioning and layout
This commit is contained in:
parent
fbb5b8e8d2
commit
ad4b52f92a
@ -274,6 +274,11 @@ bg color of non edit textFields: fafafa
|
||||
-jfx-unfocus-color: -bs-rd-grey-line;
|
||||
}
|
||||
|
||||
.jfx-combo-box > .list-cell {
|
||||
-fx-text-fill: -bs-rd-black;
|
||||
-fx-font-family: "IBM Plex Sans Medium";
|
||||
}
|
||||
|
||||
.jfx-combo-box > .arrow-button > .arrow {
|
||||
-fx-background-color: null;
|
||||
-fx-border-color: -jfx-unfocus-color;
|
||||
|
@ -432,8 +432,7 @@ public class MobileNotificationsView extends ActivatableView<GridPane, Void> {
|
||||
|
||||
useSoundCheckBox = FormBuilder.addLabelCheckBox(root, gridRow,
|
||||
Res.get("account.notifications.useSound.label"),
|
||||
"",
|
||||
Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
|
||||
Layout.FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
useSoundCheckBox.setSelected(preferences.isUseSoundForMobileNotifications());
|
||||
useSoundCheckBoxListener = (observable, oldValue, newValue) -> {
|
||||
mobileNotificationService.getUseSoundProperty().set(newValue);
|
||||
@ -441,7 +440,7 @@ public class MobileNotificationsView extends ActivatableView<GridPane, Void> {
|
||||
};
|
||||
|
||||
tradeCheckBox = FormBuilder.addLabelCheckBox(root, ++gridRow,
|
||||
Res.get("account.notifications.trade.label")).second;
|
||||
Res.get("account.notifications.trade.label"));
|
||||
tradeCheckBox.setSelected(preferences.isUseTradeNotifications());
|
||||
tradeCheckBoxListener = (observable, oldValue, newValue) -> {
|
||||
mobileNotificationService.getUseTradeNotificationsProperty().set(newValue);
|
||||
@ -449,7 +448,7 @@ public class MobileNotificationsView extends ActivatableView<GridPane, Void> {
|
||||
};
|
||||
|
||||
marketCheckBox = FormBuilder.addLabelCheckBox(root, ++gridRow,
|
||||
Res.get("account.notifications.market.label")).second;
|
||||
Res.get("account.notifications.market.label"));
|
||||
marketCheckBox.setSelected(preferences.isUseMarketNotifications());
|
||||
marketCheckBoxListener = (observable, oldValue, newValue) -> {
|
||||
mobileNotificationService.getUseMarketNotificationsProperty().set(newValue);
|
||||
@ -457,7 +456,7 @@ public class MobileNotificationsView extends ActivatableView<GridPane, Void> {
|
||||
updateMarketAlertFields();
|
||||
};
|
||||
priceCheckBox = FormBuilder.addLabelCheckBox(root, ++gridRow,
|
||||
Res.get("account.notifications.price.label")).second;
|
||||
Res.get("account.notifications.price.label"));
|
||||
priceCheckBox.setSelected(preferences.isUsePriceNotifications());
|
||||
priceCheckBoxListener = (observable, oldValue, newValue) -> {
|
||||
mobileNotificationService.getUsePriceNotificationsProperty().set(newValue);
|
||||
|
@ -135,7 +135,7 @@ public class FilterWindow extends Overlay<FilterWindow> {
|
||||
InputTextField seedNodesInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.seedNode")).second;
|
||||
InputTextField priceRelayNodesInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.priceRelayNode")).second;
|
||||
InputTextField btcNodesInputTextField = addLabelInputTextField(gridPane, ++rowIndex, Res.get("filterWindow.btcNode")).second;
|
||||
CheckBox preventPublicBtcNetworkCheckBox = addLabelCheckBox(gridPane, ++rowIndex, Res.get("filterWindow.preventPublicBtcNetwork")).second;
|
||||
CheckBox preventPublicBtcNetworkCheckBox = addLabelCheckBox(gridPane, ++rowIndex, Res.get("filterWindow.preventPublicBtcNetwork"));
|
||||
|
||||
final Filter filter = filterManager.getDevelopersFilter();
|
||||
if (filter != null) {
|
||||
|
@ -122,7 +122,7 @@ public class SendAlertMessageWindow extends Overlay<SendAlertMessageWindow> {
|
||||
Label first = labelTextAreaTuple2.first;
|
||||
first.setMinWidth(150);
|
||||
CheckBox isUpdateCheckBox = addLabelCheckBox(gridPane, ++rowIndex,
|
||||
Res.get("sendAlertMessageWindow.isUpdate"), "").second;
|
||||
Res.get("sendAlertMessageWindow.isUpdate"));
|
||||
isUpdateCheckBox.setSelected(true);
|
||||
|
||||
InputTextField versionInputTextField = addLabelInputTextField(gridPane, ++rowIndex,
|
||||
|
@ -85,7 +85,7 @@ public class ShowWalletDataWindow extends Overlay<ShowWalletDataWindow> {
|
||||
textArea.setPrefHeight(500);
|
||||
textArea.getStyleClass().add("small-text");
|
||||
CheckBox isUpdateCheckBox = addLabelCheckBox(gridPane, ++rowIndex,
|
||||
Res.get("showWalletDataWindow.includePrivKeys"), "").second;
|
||||
Res.get("showWalletDataWindow.includePrivKeys"));
|
||||
isUpdateCheckBox.setSelected(false);
|
||||
|
||||
isUpdateCheckBox.selectedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
|
@ -189,9 +189,8 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
GridPane.setColumnSpan(titledGroupBg, 4);
|
||||
|
||||
// selectBaseCurrencyNetwork
|
||||
selectBaseCurrencyNetworkComboBox = FormBuilder.<BaseCurrencyNetwork>addComboBox(root, gridRow,
|
||||
selectBaseCurrencyNetworkComboBox = FormBuilder.addComboBox(root, gridRow,
|
||||
Res.get("settings.preferences.selectCurrencyNetwork"), Layout.FIRST_ROW_DISTANCE);
|
||||
|
||||
selectBaseCurrencyNetworkComboBox.setConverter(new StringConverter<>() {
|
||||
@Override
|
||||
public String toString(BaseCurrencyNetwork baseCurrencyNetwork) {
|
||||
@ -206,11 +205,11 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
}
|
||||
});
|
||||
|
||||
userLanguageComboBox = FormBuilder.<String>addComboBox(root, ++gridRow,
|
||||
userLanguageComboBox = FormBuilder.addComboBox(root, ++gridRow,
|
||||
Res.get("shared.language"));
|
||||
userCountryComboBox = FormBuilder.<Country>addComboBox(root, ++gridRow,
|
||||
userCountryComboBox = FormBuilder.addComboBox(root, ++gridRow,
|
||||
Res.get("shared.country"));
|
||||
blockChainExplorerComboBox = FormBuilder.<BlockChainExplorer>addComboBox(root, ++gridRow,
|
||||
blockChainExplorerComboBox = FormBuilder.addComboBox(root, ++gridRow,
|
||||
Res.get("setting.preferences.explorer"));
|
||||
|
||||
Tuple3<Label, InputTextField, CheckBox> tuple = addLabelInputTextFieldCheckBox(root, ++gridRow,
|
||||
@ -289,7 +288,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
|
||||
// autoSelectArbitrators
|
||||
autoSelectArbitratorsCheckBox = addLabelCheckBox(root, ++gridRow,
|
||||
Res.get("setting.preferences.autoSelectArbitrators"), "").second;
|
||||
Res.get("setting.preferences.autoSelectArbitrators"));
|
||||
|
||||
// ignoreTraders
|
||||
ignoreTradersListInputTextField = addLabelInputTextField(root, ++gridRow,
|
||||
@ -308,7 +307,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
|
||||
// AvoidStandbyModeService
|
||||
avoidStandbyModeCheckBox = addLabelCheckBox(root, ++gridRow,
|
||||
Res.get("setting.preferences.avoidStandbyMode"), "").second;
|
||||
Res.get("setting.preferences.avoidStandbyMode"));
|
||||
}
|
||||
|
||||
private void initializeDisplayCurrencies() {
|
||||
@ -317,7 +316,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
GridPane.setColumnSpan(titledGroupBg, 4);
|
||||
|
||||
|
||||
preferredTradeCurrencyComboBox = FormBuilder.<TradeCurrency>addComboBox(root, gridRow, Res.get("setting.preferences.prefCurrency"),
|
||||
preferredTradeCurrencyComboBox = FormBuilder.addComboBox(root, gridRow, Res.get("setting.preferences.prefCurrency"),
|
||||
Layout.FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
preferredTradeCurrencyComboBox.setConverter(new StringConverter<TradeCurrency>() {
|
||||
@Override
|
||||
@ -433,7 +432,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
}
|
||||
});
|
||||
|
||||
fiatCurrenciesComboBox = FormBuilder.<FiatCurrency>addComboBox(root, ++gridRow);
|
||||
fiatCurrenciesComboBox = FormBuilder.addComboBox(root, ++gridRow);
|
||||
fiatCurrenciesComboBox.setPromptText(Res.get("setting.preferences.addFiat"));
|
||||
fiatCurrenciesComboBox.setButtonCell(new ListCell<FiatCurrency>() {
|
||||
@Override
|
||||
@ -495,10 +494,10 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
|
||||
TitledGroupBg titledGroupBg = addTitledGroupBg(root, ++gridRow, 4, Res.get("setting.preferences.displayOptions"), Layout.GROUP_DISTANCE);
|
||||
GridPane.setColumnSpan(titledGroupBg, 4);
|
||||
|
||||
showOwnOffersInOfferBook = addLabelCheckBox(root, gridRow, Res.get("setting.preferences.showOwnOffers"), "", Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
|
||||
useAnimationsCheckBox = addLabelCheckBox(root, ++gridRow, Res.get("setting.preferences.useAnimations"), "").second;
|
||||
showOwnOffersInOfferBook = addLabelCheckBox(root, gridRow, Res.get("setting.preferences.showOwnOffers"), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
useAnimationsCheckBox = addLabelCheckBox(root, ++gridRow, Res.get("setting.preferences.useAnimations"));
|
||||
// useStickyMarketPriceCheckBox = addLabelCheckBox(root, ++gridRow, "Use sticky market price:", "").second;
|
||||
sortMarketCurrenciesNumericallyCheckBox = addLabelCheckBox(root, ++gridRow, Res.get("setting.preferences.sortWithNumOffers"), "").second;
|
||||
sortMarketCurrenciesNumericallyCheckBox = addLabelCheckBox(root, ++gridRow, Res.get("setting.preferences.sortWithNumOffers"));
|
||||
resetDontShowAgainButton = addLabelButton(root, ++gridRow, Res.get("setting.preferences.resetAllFlags"),
|
||||
Res.get("setting.preferences.reset"), 0).second;
|
||||
}
|
||||
|
@ -436,19 +436,19 @@ public class FormBuilder {
|
||||
// Label + InputTextField + CheckBox
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static Tuple3<Label, InputTextField, CheckBox> addLabelInputTextFieldCheckBox(GridPane gridPane, int rowIndex, String title, String checkBoxTitle) {
|
||||
Label label = addLabel(gridPane, rowIndex, title, 0);
|
||||
public static Tuple3<Label, InputTextField, CheckBox> addTopLabelInputTextFieldCheckBox(GridPane gridPane, int rowIndex, String title, String checkBoxTitle) {
|
||||
Label label = getTopLabel(title);
|
||||
|
||||
InputTextField inputTextField = new InputTextField();
|
||||
CheckBox checkBox = new AutoTooltipCheckBox(checkBoxTitle);
|
||||
HBox.setMargin(checkBox, new Insets(4, 0, 0, 0));
|
||||
VBox.setMargin(checkBox, new Insets(4, 0, 0, 0));
|
||||
|
||||
HBox hBox = new HBox();
|
||||
hBox.setSpacing(10);
|
||||
hBox.getChildren().addAll(inputTextField, checkBox);
|
||||
GridPane.setRowIndex(hBox, rowIndex);
|
||||
GridPane.setColumnIndex(hBox, 1);
|
||||
gridPane.getChildren().add(hBox);
|
||||
VBox vBox = getTopLabelVBox(0);
|
||||
|
||||
vBox.getChildren().addAll(label, inputTextField, checkBox);
|
||||
GridPane.setRowIndex(vBox, rowIndex);
|
||||
GridPane.setColumnIndex(vBox, 0);
|
||||
gridPane.getChildren().add(vBox);
|
||||
|
||||
return new Tuple3<>(label, inputTextField, checkBox);
|
||||
}
|
||||
@ -616,25 +616,6 @@ public class FormBuilder {
|
||||
return radioButton;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Label + RadioButton
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static Tuple2<Label, RadioButton> addLabelRadioButton(GridPane gridPane, int rowIndex, ToggleGroup toggleGroup, String title, String
|
||||
radioButtonTitle) {
|
||||
Label label = addLabel(gridPane, rowIndex, title, 0);
|
||||
|
||||
RadioButton radioButton = new AutoTooltipRadioButton(radioButtonTitle);
|
||||
radioButton.setToggleGroup(toggleGroup);
|
||||
radioButton.setPadding(new Insets(6, 0, 0, 0));
|
||||
GridPane.setRowIndex(radioButton, rowIndex);
|
||||
GridPane.setColumnIndex(radioButton, 1);
|
||||
gridPane.getChildren().add(radioButton);
|
||||
|
||||
return new Tuple2<>(label, radioButton);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Label + RadioButton + RadioButton
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -672,25 +653,18 @@ public class FormBuilder {
|
||||
// Label + CheckBox
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static Tuple2<Label, CheckBox> addLabelCheckBox(GridPane gridPane, int rowIndex, String title) {
|
||||
return addLabelCheckBox(gridPane, rowIndex, title, "", 0);
|
||||
public static CheckBox addLabelCheckBox(GridPane gridPane, int rowIndex, String title) {
|
||||
return addLabelCheckBox(gridPane, rowIndex, title, 0);
|
||||
}
|
||||
|
||||
public static Tuple2<Label, CheckBox> addLabelCheckBox(GridPane gridPane, int rowIndex, String title, String checkBoxTitle) {
|
||||
return addLabelCheckBox(gridPane, rowIndex, title, checkBoxTitle, 0);
|
||||
}
|
||||
|
||||
public static Tuple2<Label, CheckBox> addLabelCheckBox(GridPane gridPane, int rowIndex, String title, String checkBoxTitle, double top) {
|
||||
Label label = addLabel(gridPane, rowIndex, title, -3);
|
||||
GridPane.setMargin(label, new Insets(top, 0, 0, 0));
|
||||
|
||||
CheckBox checkBox = new AutoTooltipCheckBox(checkBoxTitle);
|
||||
public static CheckBox addLabelCheckBox(GridPane gridPane, int rowIndex, String title, double top) {
|
||||
CheckBox checkBox = new AutoTooltipCheckBox(title);
|
||||
GridPane.setRowIndex(checkBox, rowIndex);
|
||||
GridPane.setColumnIndex(checkBox, 1);
|
||||
GridPane.setMargin(checkBox, new Insets(top, 0, 0, 0));
|
||||
GridPane.setColumnIndex(checkBox, 0);
|
||||
GridPane.setMargin(checkBox, new Insets(top + Layout.FLOATING_LABEL_DISTANCE, 0, 0, 0));
|
||||
gridPane.getChildren().add(checkBox);
|
||||
|
||||
return new Tuple2<>(label, checkBox);
|
||||
return checkBox;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -767,11 +741,10 @@ public class FormBuilder {
|
||||
}
|
||||
|
||||
public static <T> ComboBox<T> addComboBox(GridPane gridPane, int rowIndex, String title, double top) {
|
||||
Label label = null;
|
||||
|
||||
JFXComboBox<T> comboBox = new JFXComboBox<>();
|
||||
comboBox.setLabelFloat(true);
|
||||
comboBox.setPromptText(title);
|
||||
comboBox.setMaxWidth(Double.MAX_VALUE);
|
||||
|
||||
// Default ComboBox does not show promptText after clear selection.
|
||||
// https://stackoverflow.com/questions/50569330/how-to-reset-combobox-and-display-prompttext?noredirect=1&lq=1
|
||||
@ -789,9 +762,8 @@ public class FormBuilder {
|
||||
});
|
||||
|
||||
GridPane.setRowIndex(comboBox, rowIndex);
|
||||
GridPane.setHalignment(comboBox, HPos.LEFT);
|
||||
GridPane.setColumnIndex(comboBox, 0);
|
||||
GridPane.setMargin(comboBox, new Insets(top, 0, 0, 0));
|
||||
GridPane.setMargin(comboBox, new Insets(top + Layout.FLOATING_LABEL_DISTANCE, 0, 0, 0));
|
||||
gridPane.getChildren().add(comboBox);
|
||||
|
||||
return comboBox;
|
||||
@ -1051,7 +1023,7 @@ public class FormBuilder {
|
||||
BalanceTextField balanceTextField = new BalanceTextField(title);
|
||||
GridPane.setRowIndex(balanceTextField, rowIndex);
|
||||
GridPane.setColumnIndex(balanceTextField, 0);
|
||||
GridPane.setMargin(balanceTextField, new Insets(20, 0,0,0));
|
||||
GridPane.setMargin(balanceTextField, new Insets(20, 0, 0, 0));
|
||||
gridPane.getChildren().add(balanceTextField);
|
||||
|
||||
return balanceTextField;
|
||||
|
@ -21,6 +21,7 @@ public class Layout {
|
||||
public static final double INITIAL_SCENE_WIDTH = 1200;
|
||||
public static final double INITIAL_SCENE_HEIGHT = 710; //740
|
||||
public static final double FIRST_ROW_DISTANCE = 20d;
|
||||
public static final double FLOATING_LABEL_DISTANCE = 20d;
|
||||
public static final double GROUP_DISTANCE = 40d;
|
||||
public static final double FIRST_ROW_AND_GROUP_DISTANCE = GROUP_DISTANCE + FIRST_ROW_DISTANCE;
|
||||
public static final double PADDING_WINDOW = 20d;
|
||||
|
Loading…
Reference in New Issue
Block a user