diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/AliPayForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/AliPayForm.java index 2650a67ed3..6ae3aba993 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/AliPayForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/AliPayForm.java @@ -17,12 +17,9 @@ package bisq.desktop.components.paymentmethods; -import bisq.desktop.components.InputTextField; -import bisq.desktop.util.FormBuilder; import bisq.desktop.util.validation.AliPayValidator; import bisq.core.locale.Res; -import bisq.core.locale.TradeCurrency; import bisq.core.payment.AccountAgeWitnessService; import bisq.core.payment.AliPayAccount; import bisq.core.payment.PaymentAccount; @@ -31,21 +28,13 @@ import bisq.core.payment.payload.PaymentAccountPayload; import bisq.core.util.BSFormatter; import bisq.core.util.validation.InputValidator; -import org.apache.commons.lang3.StringUtils; - import javafx.scene.layout.GridPane; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import static bisq.desktop.util.FormBuilder.addTopLabelTextFieldWithCopyIcon; -public class AliPayForm extends PaymentMethodForm { - private static final Logger log = LoggerFactory.getLogger(AliPayForm.class); +public class AliPayForm extends GeneralAccountNumberForm { private final AliPayAccount aliPayAccount; - private final AliPayValidator aliPayValidator; - private InputTextField accountNrInputTextField; public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) { addTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.account.no"), ((AliPayAccountPayload) paymentAccountPayload).getAccountNr()); @@ -55,49 +44,15 @@ public class AliPayForm extends PaymentMethodForm { public AliPayForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, AliPayValidator aliPayValidator, InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.aliPayAccount = (AliPayAccount) paymentAccount; - this.aliPayValidator = aliPayValidator; } @Override - public void addFormForAddAccount() { - gridRowFrom = gridRow + 1; - - accountNrInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.account.no")); - accountNrInputTextField.setValidator(aliPayValidator); - accountNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { - aliPayAccount.setAccountNr(newValue); - updateFromInputs(); - }); - - final TradeCurrency singleTradeCurrency = aliPayAccount.getSingleTradeCurrency(); - final String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : ""; - FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"), nameAndCode); - addLimitations(); - addAccountNameTextFieldWithAutoFillToggleButton(); + void setAccountNumber(String newValue) { + aliPayAccount.setAccountNr(newValue); } @Override - protected void autoFillNameTextField() { - if (useCustomAccountNameToggleButton != null && !useCustomAccountNameToggleButton.isSelected()) { - String accountNr = accountNrInputTextField.getText(); - accountNr = StringUtils.abbreviate(accountNr, 9); - String method = Res.get(paymentAccount.getPaymentMethod().getId()); - accountNameTextField.setText(method.concat(": ").concat(accountNr)); - } + String getAccountNr() { + return aliPayAccount.getAccountNr(); } - - @Override - public void addFormForDisplayAccount() { - addFormForAccountNumberDisplayAccount(aliPayAccount.getAccountName(), - aliPayAccount.getPaymentMethod(), aliPayAccount.getAccountNr(), - aliPayAccount.getSingleTradeCurrency()); - } - - @Override - public void updateAllInputsValid() { - allInputsValid.set(isAccountNameValid() - && aliPayValidator.validate(aliPayAccount.getAccountNr()).isValid - && aliPayAccount.getTradeCurrencies().size() > 0); - } - } diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/ClearXchangeForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/ClearXchangeForm.java index 882f8c3c58..d561346a34 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/ClearXchangeForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/ClearXchangeForm.java @@ -32,8 +32,6 @@ import bisq.core.payment.payload.PaymentAccountPayload; import bisq.core.util.BSFormatter; import bisq.core.util.validation.InputValidator; -import org.apache.commons.lang3.StringUtils; - import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; @@ -85,12 +83,7 @@ public class ClearXchangeForm extends PaymentMethodForm { @Override protected void autoFillNameTextField() { - if (useCustomAccountNameToggleButton != null && !useCustomAccountNameToggleButton.isSelected()) { - String mobileNr = mobileNrInputTextField.getText(); - mobileNr = StringUtils.abbreviate(mobileNr, 9); - String method = Res.get(paymentAccount.getPaymentMethod().getId()); - accountNameTextField.setText(method.concat(": ").concat(mobileNr)); - } + setAccountNameWithString(mobileNrInputTextField.getText()); } @Override diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/GeneralAccountNumberForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/GeneralAccountNumberForm.java new file mode 100644 index 0000000000..c54a5495e4 --- /dev/null +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/GeneralAccountNumberForm.java @@ -0,0 +1,67 @@ +package bisq.desktop.components.paymentmethods; + +import bisq.desktop.components.InputTextField; +import bisq.desktop.util.FormBuilder; + +import bisq.core.locale.Res; +import bisq.core.locale.TradeCurrency; +import bisq.core.payment.AccountAgeWitnessService; +import bisq.core.payment.PaymentAccount; +import bisq.core.util.BSFormatter; +import bisq.core.util.validation.InputValidator; + +import javafx.scene.layout.GridPane; + +abstract public class GeneralAccountNumberForm extends PaymentMethodForm { + + private InputTextField accountNrInputTextField; + + public GeneralAccountNumberForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) { + super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); + } + + @Override + public void addFormForAddAccount() { + gridRowFrom = gridRow + 1; + + accountNrInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.account.no")); + accountNrInputTextField.setValidator(inputValidator); + accountNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { + setAccountNumber(newValue); + updateFromInputs(); + }); + + addTradeCurrency(); + + addLimitations(); + addAccountNameTextFieldWithAutoFillToggleButton(); + } + + public void addTradeCurrency() { + final TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency(); + final String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : ""; + FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"), nameAndCode); + } + + @Override + protected void autoFillNameTextField() { + setAccountNameWithString(accountNrInputTextField.getText()); + } + + @Override + public void addFormForDisplayAccount() { + addFormForAccountNumberDisplayAccount(paymentAccount.getAccountName(), paymentAccount.getPaymentMethod(), getAccountNr(), + paymentAccount.getSingleTradeCurrency()); + } + + @Override + public void updateAllInputsValid() { + allInputsValid.set(isAccountNameValid() + && inputValidator.validate(getAccountNr()).isValid + && paymentAccount.getTradeCurrencies().size() > 0); + } + + abstract void setAccountNumber(String newValue); + + abstract String getAccountNr(); +} diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/GeneralSepaForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/GeneralSepaForm.java new file mode 100644 index 0000000000..f7d468de3b --- /dev/null +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/GeneralSepaForm.java @@ -0,0 +1,171 @@ +package bisq.desktop.components.paymentmethods; + +import bisq.desktop.components.InputTextField; +import bisq.desktop.util.FormBuilder; + +import bisq.core.locale.Country; +import bisq.core.locale.CurrencyUtil; +import bisq.core.locale.Res; +import bisq.core.locale.TradeCurrency; +import bisq.core.payment.AccountAgeWitnessService; +import bisq.core.payment.CountryBasedPaymentAccount; +import bisq.core.payment.PaymentAccount; +import bisq.core.util.BSFormatter; +import bisq.core.util.validation.InputValidator; + +import org.apache.commons.lang3.StringUtils; + +import com.jfoenix.controls.JFXComboBox; +import com.jfoenix.controls.JFXTextField; + +import javafx.scene.control.CheckBox; +import javafx.scene.control.ComboBox; +import javafx.scene.control.TextField; +import javafx.scene.layout.FlowPane; +import javafx.scene.layout.GridPane; +import javafx.scene.layout.HBox; + +import javafx.collections.FXCollections; + +import javafx.util.StringConverter; + +import java.util.ArrayList; +import java.util.List; + +import static bisq.desktop.util.FormBuilder.addTopLabelWithVBox; + +public abstract class GeneralSepaForm extends PaymentMethodForm { + + static final String BIC = "BIC"; + static final String IBAN = "IBAN"; + + final List euroCountryCheckBoxes = new ArrayList<>(); + final List nonEuroCountryCheckBoxes = new ArrayList<>(); + private TextField currencyTextField; + private ComboBox currencyComboBox; + InputTextField ibanInputTextField; + + GeneralSepaForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) { + super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); + } + + @Override + protected void autoFillNameTextField() { + if (useCustomAccountNameToggleButton != null && !useCustomAccountNameToggleButton.isSelected()) { + TradeCurrency singleTradeCurrency = this.paymentAccount.getSingleTradeCurrency(); + String currency = singleTradeCurrency != null ? singleTradeCurrency.getCode() : null; + if (currency != null) { + String iban = ibanInputTextField.getText(); + if (iban.length() > 9) + iban = StringUtils.abbreviate(iban, 9); + String method = Res.get(paymentAccount.getPaymentMethod().getId()); + CountryBasedPaymentAccount countryBasedPaymentAccount = (CountryBasedPaymentAccount) this.paymentAccount; + String country = countryBasedPaymentAccount.getCountry() != null ? + countryBasedPaymentAccount.getCountry().code : null; + if (country != null) + accountNameTextField.setText(method.concat(" (").concat(currency).concat("/").concat(country) + .concat("): ").concat(iban)); + } + } + } + + void setCountryComboBoxAction(ComboBox countryComboBox, CountryBasedPaymentAccount paymentAccount) { + countryComboBox.setOnAction(e -> { + Country selectedItem = countryComboBox.getSelectionModel().getSelectedItem(); + paymentAccount.setCountry(selectedItem); + TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(selectedItem.code); + setupCurrency(selectedItem, currency); + + updateCountriesSelection(euroCountryCheckBoxes); + updateCountriesSelection(nonEuroCountryCheckBoxes); + updateFromInputs(); + }); + } + + void updateCurrencyFormElements(TradeCurrency currency, boolean isSepaCountry, CountryBasedPaymentAccount paymentAccount) { + if (isSepaCountry) { + currencyTextField.setVisible(true); + currencyTextField.setManaged(true); + currencyComboBox.setVisible(false); + currencyComboBox.setManaged(false); + paymentAccount.setSingleTradeCurrency(currency); + currencyTextField.setText(Res.get("payment.currencyWithSymbol", currency.getNameAndCode())); + } else { + currencyComboBox.setVisible(true); + currencyComboBox.setManaged(true); + currencyTextField.setVisible(false); + currencyTextField.setManaged(false); + currencyComboBox.setItems(FXCollections.observableArrayList(currency, + CurrencyUtil.getFiatCurrency("EUR").get())); + currencyComboBox.setOnAction(e2 -> { + paymentAccount.setSingleTradeCurrency(currencyComboBox.getSelectionModel().getSelectedItem()); + updateCountriesSelection(euroCountryCheckBoxes); + autoFillNameTextField(); + }); + currencyComboBox.setConverter(new StringConverter<>() { + @Override + public String toString(TradeCurrency currency) { + return currency.getNameAndCode(); + } + + @Override + public TradeCurrency fromString(String string) { + return null; + } + }); + currencyComboBox.getSelectionModel().select(0); + } + } + + void addCountriesGrid(String title, List checkBoxList, + List dataProvider) { + FlowPane flowPane = FormBuilder.addTopLabelFlowPane(gridPane, ++gridRow, title, 0).second; + + flowPane.setId("flow-pane-checkboxes-bg"); + + dataProvider.forEach(country -> + fillUpFlowPaneWithCountries(checkBoxList, flowPane, country)); + updateCountriesSelection(checkBoxList); + } + + ComboBox addCountrySelection() { + HBox hBox = new HBox(); + + hBox.setSpacing(10); + ComboBox countryComboBox = new JFXComboBox<>(); + currencyComboBox = new JFXComboBox<>(); + currencyTextField = new JFXTextField(""); + currencyTextField.setEditable(false); + currencyTextField.setMouseTransparent(true); + currencyTextField.setFocusTraversable(false); + currencyTextField.setMinWidth(300); + + currencyTextField.setVisible(false); + currencyTextField.setManaged(false); + currencyComboBox.setVisible(false); + currencyComboBox.setManaged(false); + + hBox.getChildren().addAll(countryComboBox, currencyTextField, currencyComboBox); + + addTopLabelWithVBox(gridPane, ++gridRow, Res.get("payment.bank.country"), hBox, 0); + + countryComboBox.setPromptText(Res.get("payment.select.bank.country")); + countryComboBox.setConverter(new StringConverter<>() { + @Override + public String toString(Country country) { + return country.name + " (" + country.code + ")"; + } + + @Override + public Country fromString(String s) { + return null; + } + }); + return countryComboBox; + } + + abstract void setupCurrency(Country country, TradeCurrency currency); + + abstract void updateCountriesSelection(List checkBoxList); + +} diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/PaymentMethodForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/PaymentMethodForm.java index 5ea70e35fb..f465a39892 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/PaymentMethodForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/PaymentMethodForm.java @@ -24,6 +24,7 @@ import bisq.desktop.main.overlays.popups.Popup; import bisq.desktop.util.FormBuilder; import bisq.desktop.util.Layout; +import bisq.core.locale.Country; import bisq.core.locale.CurrencyUtil; import bisq.core.locale.FiatCurrency; import bisq.core.locale.Res; @@ -59,6 +60,8 @@ import javafx.collections.FXCollections; import javafx.util.StringConverter; +import java.util.List; + import lombok.extern.slf4j.Slf4j; import static bisq.desktop.util.FormBuilder.*; @@ -89,10 +92,10 @@ public abstract class PaymentMethodForm { } protected void addTradeCurrencyComboBox() { - currencyComboBox = FormBuilder.addComboBox(gridPane, ++gridRow, Res.get("shared.currency")); + currencyComboBox = FormBuilder.addComboBox(gridPane, ++gridRow, Res.get("shared.currency")); currencyComboBox.setPromptText(Res.get("list.currency.select")); currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getMainFiatCurrencies())); - currencyComboBox.setConverter(new StringConverter() { + currencyComboBox.setConverter(new StringConverter<>() { @Override public String toString(TradeCurrency tradeCurrency) { return tradeCurrency.getNameAndCode(); @@ -249,6 +252,27 @@ public abstract class PaymentMethodForm { flowPane.getChildren().add(checkBox); } + void fillUpFlowPaneWithCountries(List checkBoxList, FlowPane flowPane, Country country) { + final String countryCode = country.code; + CheckBox checkBox = new AutoTooltipCheckBox(countryCode); + checkBox.setUserData(countryCode); + checkBoxList.add(checkBox); + checkBox.setMouseTransparent(false); + checkBox.setMinWidth(45); + checkBox.setMaxWidth(45); + checkBox.setTooltip(new Tooltip(country.name)); + checkBox.setOnAction(event -> { + if (checkBox.isSelected()) { + addAcceptedCountry(countryCode); + } else { + removeAcceptedCountry(countryCode); + } + + updateAllInputsValid(); + }); + flowPane.getChildren().add(checkBox); + } + void addFormForAccountNumberDisplayAccount(String accountName, PaymentMethod paymentMethod, String accountNr, TradeCurrency singleTradeCurrency) { gridRowFrom = gridRow; @@ -295,4 +319,10 @@ public abstract class PaymentMethodForm { public BooleanProperty allInputsValidProperty() { return allInputsValid; } + + void removeAcceptedCountry(String countryCode) { + } + + void addAcceptedCountry(String countryCode) { + } } diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/PerfectMoneyForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/PerfectMoneyForm.java index ddd0eefe57..b99a654d9c 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/PerfectMoneyForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/PerfectMoneyForm.java @@ -17,8 +17,6 @@ package bisq.desktop.components.paymentmethods; -import bisq.desktop.components.InputTextField; -import bisq.desktop.util.FormBuilder; import bisq.desktop.util.validation.PerfectMoneyValidator; import bisq.core.locale.FiatCurrency; @@ -37,11 +35,9 @@ import javafx.collections.FXCollections; import static bisq.desktop.util.FormBuilder.addTopLabelTextFieldWithCopyIcon; -public class PerfectMoneyForm extends PaymentMethodForm { +public class PerfectMoneyForm extends GeneralAccountNumberForm { private final PerfectMoneyAccount perfectMoneyAccount; - private final PerfectMoneyValidator perfectMoneyValidator; - private InputTextField accountNrInputTextField; public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) { addTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.account.no"), ((PerfectMoneyAccountPayload) paymentAccountPayload).getAccountNr()); @@ -52,44 +48,22 @@ public class PerfectMoneyForm extends PaymentMethodForm { gridRow, BSFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.perfectMoneyAccount = (PerfectMoneyAccount) paymentAccount; - this.perfectMoneyValidator = perfectMoneyValidator; } @Override - public void addFormForAddAccount() { - gridRowFrom = gridRow + 1; - - accountNrInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.account.no")); - accountNrInputTextField.setValidator(perfectMoneyValidator); - accountNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { - perfectMoneyAccount.setAccountNr(newValue); - updateFromInputs(); - }); - + public void addTradeCurrency() { addTradeCurrencyComboBox(); currencyComboBox.setItems(FXCollections.observableArrayList(new FiatCurrency("USD"), new FiatCurrency("EUR"))); currencyComboBox.getSelectionModel().select(0); - - addLimitations(); - addAccountNameTextFieldWithAutoFillToggleButton(); } @Override - protected void autoFillNameTextField() { - setAccountNameWithString(accountNrInputTextField.getText()); + void setAccountNumber(String newValue) { + perfectMoneyAccount.setAccountNr(newValue); } @Override - public void addFormForDisplayAccount() { - addFormForAccountNumberDisplayAccount(perfectMoneyAccount.getAccountName(), - perfectMoneyAccount.getPaymentMethod(), perfectMoneyAccount.getAccountNr(), - perfectMoneyAccount.getSingleTradeCurrency()); - } - - @Override - public void updateAllInputsValid() { - allInputsValid.set(isAccountNameValid() - && perfectMoneyValidator.validate(perfectMoneyAccount.getAccountNr()).isValid - && perfectMoneyAccount.getTradeCurrencies().size() > 0); + String getAccountNr() { + return perfectMoneyAccount.getAccountNr(); } } diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/SameBankForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/SameBankForm.java index 78fa3e7ad7..a6ca52f80b 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/SameBankForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/SameBankForm.java @@ -25,11 +25,7 @@ import bisq.core.util.validation.InputValidator; import javafx.scene.layout.GridPane; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - public class SameBankForm extends BankForm { - private static final Logger log = LoggerFactory.getLogger(SameBankForm.class); public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) { return BankForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload); diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/SepaForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/SepaForm.java index c03c4b42df..fd3f681d33 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/SepaForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/SepaForm.java @@ -17,7 +17,6 @@ package bisq.desktop.components.paymentmethods; -import bisq.desktop.components.AutoTooltipCheckBox; import bisq.desktop.components.InputTextField; import bisq.desktop.util.FormBuilder; import bisq.desktop.util.Layout; @@ -30,7 +29,6 @@ import bisq.core.locale.CurrencyUtil; import bisq.core.locale.Res; import bisq.core.locale.TradeCurrency; import bisq.core.payment.AccountAgeWitnessService; -import bisq.core.payment.CountryBasedPaymentAccount; import bisq.core.payment.PaymentAccount; import bisq.core.payment.SepaAccount; import bisq.core.payment.payload.PaymentAccountPayload; @@ -38,34 +36,20 @@ import bisq.core.payment.payload.SepaAccountPayload; import bisq.core.util.BSFormatter; import bisq.core.util.validation.InputValidator; -import org.apache.commons.lang3.StringUtils; - -import com.jfoenix.controls.JFXComboBox; - import javafx.scene.control.CheckBox; import javafx.scene.control.ComboBox; -import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.control.Tooltip; -import javafx.scene.layout.FlowPane; import javafx.scene.layout.GridPane; -import javafx.scene.layout.HBox; -import javafx.scene.text.TextAlignment; - -import javafx.geometry.HPos; -import javafx.geometry.Insets; -import javafx.geometry.VPos; import javafx.collections.FXCollections; -import javafx.util.StringConverter; - -import java.util.ArrayList; import java.util.List; import static bisq.desktop.util.FormBuilder.addTopLabelTextFieldWithCopyIcon; -public class SepaForm extends PaymentMethodForm { +public class SepaForm extends GeneralSepaForm { + public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) { SepaAccountPayload sepaAccountPayload = (SepaAccountPayload) paymentAccountPayload; @@ -78,19 +62,14 @@ public class SepaForm extends PaymentMethodForm { Res.get("payment.bank.country"), CountryUtil.getNameAndCode(sepaAccountPayload.getCountryCode())); // IBAN, BIC will not be translated - FormBuilder.addTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "IBAN:", sepaAccountPayload.getIban()); - FormBuilder.addTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "BIC:", sepaAccountPayload.getBic()); + FormBuilder.addTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, IBAN, sepaAccountPayload.getIban()); + FormBuilder.addTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, BIC, sepaAccountPayload.getBic()); return gridRow; } private final SepaAccount sepaAccount; private final IBANValidator ibanValidator; private final BICValidator bicValidator; - private InputTextField ibanInputTextField; - private TextField currencyTextField; - private final List euroCountryCheckBoxes = new ArrayList<>(); - private final List nonEuroCountryCheckBoxes = new ArrayList<>(); - private ComboBox currencyComboBox; public SepaForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, IBANValidator ibanValidator, BICValidator bicValidator, InputValidator inputValidator, @@ -113,14 +92,14 @@ public class SepaForm extends PaymentMethodForm { updateFromInputs(); }); - ibanInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, "IBAN:"); + ibanInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, IBAN); ibanInputTextField.setValidator(ibanValidator); ibanInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { sepaAccount.setIban(newValue); updateFromInputs(); }); - InputTextField bicInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, "BIC:"); + InputTextField bicInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, BIC); bicInputTextField.setValidator(bicValidator); bicInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { sepaAccount.setBic(newValue); @@ -128,54 +107,12 @@ public class SepaForm extends PaymentMethodForm { }); + ComboBox countryComboBox = addCountrySelection(); - FormBuilder.addLabel(gridPane, ++gridRow, Res.get("payment.bank.country")); - HBox hBox = new HBox(); - hBox.setSpacing(10); - ComboBox countryComboBox = new JFXComboBox<>(); - currencyComboBox = new JFXComboBox<>(); - currencyTextField = new TextField(""); - currencyTextField.setEditable(false); - currencyTextField.setMouseTransparent(true); - currencyTextField.setFocusTraversable(false); - currencyTextField.setMinWidth(300); + setCountryComboBoxAction(countryComboBox, sepaAccount); - currencyTextField.setVisible(false); - currencyTextField.setManaged(false); - currencyComboBox.setVisible(false); - currencyComboBox.setManaged(false); - - hBox.getChildren().addAll(countryComboBox, currencyTextField, currencyComboBox); - GridPane.setRowIndex(hBox, gridRow); - GridPane.setColumnIndex(hBox, 1); - gridPane.getChildren().add(hBox); - - - countryComboBox.setPromptText(Res.get("payment.select.bank.country")); - countryComboBox.setConverter(new StringConverter() { - @Override - public String toString(Country country) { - return country.name + " (" + country.code + ")"; - } - - @Override - public Country fromString(String s) { - return null; - } - }); - countryComboBox.setOnAction(e -> { - Country selectedItem = countryComboBox.getSelectionModel().getSelectedItem(); - sepaAccount.setCountry(selectedItem); - TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(selectedItem.code); - setupCurrency(selectedItem, currency); - - updateCountriesSelection(true, euroCountryCheckBoxes); - updateCountriesSelection(true, nonEuroCountryCheckBoxes); - updateFromInputs(); - }); - - addEuroCountriesGrid(true); - addNonEuroCountriesGrid(true); + addEuroCountriesGrid(); + addNonEuroCountriesGrid(); addLimitations(); addAccountNameTextFieldWithAutoFillToggleButton(); @@ -191,98 +128,26 @@ public class SepaForm extends PaymentMethodForm { updateFromInputs(); } - private void setupCurrency(Country country, TradeCurrency currency) { - if (CountryUtil.getAllSepaEuroCountries().contains(country)) { - currencyTextField.setVisible(true); - currencyTextField.setManaged(true); - currencyComboBox.setVisible(false); - currencyComboBox.setManaged(false); - sepaAccount.setSingleTradeCurrency(currency); - currencyTextField.setText(Res.get("payment.currencyWithSymbol", currency.getNameAndCode())); - } else { - currencyComboBox.setVisible(true); - currencyComboBox.setManaged(true); - currencyTextField.setVisible(false); - currencyTextField.setManaged(false); - currencyComboBox.setItems(FXCollections.observableArrayList(currency, - CurrencyUtil.getFiatCurrency("EUR").get())); - currencyComboBox.setOnAction(e2 -> { - sepaAccount.setSingleTradeCurrency(currencyComboBox.getSelectionModel().getSelectedItem()); - updateCountriesSelection(true, euroCountryCheckBoxes); - autoFillNameTextField(); - }); - currencyComboBox.setConverter(new StringConverter() { - @Override - public String toString(TradeCurrency currency) { - return currency.getNameAndCode(); - } + @Override + void setupCurrency(Country country, TradeCurrency currency) { + final boolean isSepaCountry = CountryUtil.getAllSepaEuroCountries().contains(country); - @Override - public TradeCurrency fromString(String string) { - return null; - } - }); - currencyComboBox.getSelectionModel().select(0); - } + updateCurrencyFormElements(currency, isSepaCountry, sepaAccount); } - private void addEuroCountriesGrid(boolean isEditable) { - addCountriesGrid(isEditable, Res.get("payment.accept.euro"), euroCountryCheckBoxes, + private void addEuroCountriesGrid() { + addCountriesGrid(Res.get("payment.accept.euro"), euroCountryCheckBoxes, CountryUtil.getAllSepaEuroCountries()); } - private void addNonEuroCountriesGrid(boolean isEditable) { - addCountriesGrid(isEditable, Res.get("payment.accept.nonEuro"), nonEuroCountryCheckBoxes, + private void addNonEuroCountriesGrid() { + addCountriesGrid(Res.get("payment.accept.nonEuro"), nonEuroCountryCheckBoxes, CountryUtil.getAllSepaNonEuroCountries()); } - private void addCountriesGrid(boolean isEditable, String title, List checkBoxList, List dataProvider) { - Label label = FormBuilder.addLabel(gridPane, ++gridRow, title, 0); - label.setWrapText(true); - label.setMaxWidth(180); - label.setTextAlignment(TextAlignment.RIGHT); - GridPane.setHalignment(label, HPos.RIGHT); - GridPane.setValignment(label, VPos.TOP); - FlowPane flowPane = new FlowPane(); - flowPane.setPadding(new Insets(10, 10, 10, 10)); - flowPane.setVgap(10); - flowPane.setHgap(10); - flowPane.setMinHeight(55); - - if (isEditable) - flowPane.setId("flow-pane-checkboxes-bg"); - else - flowPane.setId("flow-pane-checkboxes-non-editable-bg"); - - dataProvider.stream().forEach(country -> - { - final String countryCode = country.code; - CheckBox checkBox = new AutoTooltipCheckBox(countryCode); - checkBox.setUserData(countryCode); - checkBoxList.add(checkBox); - checkBox.setMouseTransparent(!isEditable); - checkBox.setMinWidth(45); - checkBox.setMaxWidth(45); - checkBox.setTooltip(new Tooltip(country.name)); - checkBox.setOnAction(event -> { - if (checkBox.isSelected()) - sepaAccount.addAcceptedCountry(countryCode); - else - sepaAccount.removeAcceptedCountry(countryCode); - - updateAllInputsValid(); - }); - flowPane.getChildren().add(checkBox); - }); - updateCountriesSelection(isEditable, checkBoxList); - - GridPane.setRowIndex(flowPane, gridRow); - GridPane.setColumnIndex(flowPane, 1); - gridPane.getChildren().add(flowPane); - } - - private void updateCountriesSelection(boolean isEditable, List checkBoxList) { - checkBoxList.stream().forEach(checkBox -> { + @Override + void updateCountriesSelection(List checkBoxList) { + checkBoxList.forEach(checkBox -> { String countryCode = (String) checkBox.getUserData(); TradeCurrency selectedCurrency = sepaAccount.getSelectedTradeCurrency(); if (selectedCurrency == null) { @@ -292,7 +157,7 @@ public class SepaForm extends PaymentMethodForm { } boolean selected; - if (isEditable && selectedCurrency != null) { + if (selectedCurrency != null) { selected = true; sepaAccount.addAcceptedCountry(countryCode); } else { @@ -302,26 +167,6 @@ public class SepaForm extends PaymentMethodForm { }); } - @Override - protected void autoFillNameTextField() { - if (useCustomAccountNameToggleButton != null && !useCustomAccountNameToggleButton.isSelected()) { - TradeCurrency singleTradeCurrency = this.paymentAccount.getSingleTradeCurrency(); - String currency = singleTradeCurrency != null ? singleTradeCurrency.getCode() : null; - if (currency != null) { - String iban = ibanInputTextField.getText(); - if (iban.length() > 9) - iban = StringUtils.abbreviate(iban, 9); - String method = Res.get(paymentAccount.getPaymentMethod().getId()); - CountryBasedPaymentAccount countryBasedPaymentAccount = (CountryBasedPaymentAccount) this.paymentAccount; - String country = countryBasedPaymentAccount.getCountry() != null ? - countryBasedPaymentAccount.getCountry().code : null; - if (country != null) - accountNameTextField.setText(method.concat(" (").concat(currency).concat("/").concat(country) - .concat("): ").concat(iban)); - } - } - } - @Override public void updateAllInputsValid() { allInputsValid.set(isAccountNameValid() @@ -340,8 +185,8 @@ public class SepaForm extends PaymentMethodForm { FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"), Res.get(sepaAccount.getPaymentMethod().getId())); FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.owner"), sepaAccount.getHolderName()); - FormBuilder.addTopLabelTextField(gridPane, ++gridRow, "IBAN:", sepaAccount.getIban()).second.setMouseTransparent(false); - FormBuilder.addTopLabelTextField(gridPane, ++gridRow, "BIC:", sepaAccount.getBic()).second.setMouseTransparent(false); + FormBuilder.addTopLabelTextField(gridPane, ++gridRow, IBAN, sepaAccount.getIban()).second.setMouseTransparent(false); + FormBuilder.addTopLabelTextField(gridPane, ++gridRow, BIC, sepaAccount.getBic()).second.setMouseTransparent(false); FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("payment.bank.country"), sepaAccount.getCountry() != null ? sepaAccount.getCountry().name : ""); TradeCurrency singleTradeCurrency = sepaAccount.getSingleTradeCurrency(); @@ -362,4 +207,14 @@ public class SepaForm extends PaymentMethodForm { } addLimitations(); } + + @Override + void removeAcceptedCountry(String countryCode) { + sepaAccount.removeAcceptedCountry(countryCode); + } + + @Override + void addAcceptedCountry(String countryCode) { + sepaAccount.addAcceptedCountry(countryCode); + } } diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/SepaInstantForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/SepaInstantForm.java index 4bd8ae6415..fe77e57971 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/SepaInstantForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/SepaInstantForm.java @@ -17,7 +17,6 @@ package bisq.desktop.components.paymentmethods; -import bisq.desktop.components.AutoTooltipCheckBox; import bisq.desktop.components.InputTextField; import bisq.desktop.util.FormBuilder; import bisq.desktop.util.Layout; @@ -30,7 +29,6 @@ import bisq.core.locale.CurrencyUtil; import bisq.core.locale.Res; import bisq.core.locale.TradeCurrency; import bisq.core.payment.AccountAgeWitnessService; -import bisq.core.payment.CountryBasedPaymentAccount; import bisq.core.payment.PaymentAccount; import bisq.core.payment.SepaInstantAccount; import bisq.core.payment.payload.PaymentAccountPayload; @@ -38,34 +36,20 @@ import bisq.core.payment.payload.SepaInstantAccountPayload; import bisq.core.util.BSFormatter; import bisq.core.util.validation.InputValidator; -import org.apache.commons.lang3.StringUtils; - -import com.jfoenix.controls.JFXComboBox; - import javafx.scene.control.CheckBox; import javafx.scene.control.ComboBox; -import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.control.Tooltip; -import javafx.scene.layout.FlowPane; import javafx.scene.layout.GridPane; -import javafx.scene.layout.HBox; -import javafx.scene.text.TextAlignment; - -import javafx.geometry.HPos; -import javafx.geometry.Insets; -import javafx.geometry.VPos; import javafx.collections.FXCollections; -import javafx.util.StringConverter; - -import java.util.ArrayList; import java.util.List; import static bisq.desktop.util.FormBuilder.addTopLabelTextFieldWithCopyIcon; -public class SepaInstantForm extends PaymentMethodForm { +public class SepaInstantForm extends GeneralSepaForm { + public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) { SepaInstantAccountPayload sepaInstantAccountPayload = (SepaInstantAccountPayload) paymentAccountPayload; @@ -78,19 +62,14 @@ public class SepaInstantForm extends PaymentMethodForm { Res.get("payment.bank.country"), CountryUtil.getNameAndCode(sepaInstantAccountPayload.getCountryCode())); // IBAN, BIC will not be translated - FormBuilder.addTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "IBAN:", sepaInstantAccountPayload.getIban()); - FormBuilder.addTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "BIC:", sepaInstantAccountPayload.getBic()); + FormBuilder.addTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, IBAN, sepaInstantAccountPayload.getIban()); + FormBuilder.addTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, BIC, sepaInstantAccountPayload.getBic()); return gridRow; } private final SepaInstantAccount sepaInstantAccount; private final IBANValidator ibanValidator; private final BICValidator bicValidator; - private InputTextField ibanInputTextField; - private TextField currencyTextField; - private final List euroCountryCheckBoxes = new ArrayList<>(); - private final List nonEuroCountryCheckBoxes = new ArrayList<>(); - private ComboBox currencyComboBox; public SepaInstantForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, IBANValidator ibanValidator, BICValidator bicValidator, InputValidator inputValidator, @@ -113,14 +92,14 @@ public class SepaInstantForm extends PaymentMethodForm { updateFromInputs(); }); - ibanInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, "IBAN:"); + ibanInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, IBAN); ibanInputTextField.setValidator(ibanValidator); ibanInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { sepaInstantAccount.setIban(newValue); updateFromInputs(); }); - InputTextField bicInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, "BIC:"); + InputTextField bicInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, BIC); bicInputTextField.setValidator(bicValidator); bicInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { sepaInstantAccount.setBic(newValue); @@ -128,54 +107,12 @@ public class SepaInstantForm extends PaymentMethodForm { }); + ComboBox countryComboBox = addCountrySelection(); - FormBuilder.addLabel(gridPane, ++gridRow, Res.get("payment.bank.country")); - HBox hBox = new HBox(); - hBox.setSpacing(10); - ComboBox countryComboBox = new JFXComboBox<>(); - currencyComboBox = new JFXComboBox<>(); - currencyTextField = new TextField(""); - currencyTextField.setEditable(false); - currencyTextField.setMouseTransparent(true); - currencyTextField.setFocusTraversable(false); - currencyTextField.setMinWidth(300); + setCountryComboBoxAction(countryComboBox, sepaInstantAccount); - currencyTextField.setVisible(false); - currencyTextField.setManaged(false); - currencyComboBox.setVisible(false); - currencyComboBox.setManaged(false); - - hBox.getChildren().addAll(countryComboBox, currencyTextField, currencyComboBox); - GridPane.setRowIndex(hBox, gridRow); - GridPane.setColumnIndex(hBox, 1); - gridPane.getChildren().add(hBox); - - - countryComboBox.setPromptText(Res.get("payment.select.bank.country")); - countryComboBox.setConverter(new StringConverter() { - @Override - public String toString(Country country) { - return country.name + " (" + country.code + ")"; - } - - @Override - public Country fromString(String s) { - return null; - } - }); - countryComboBox.setOnAction(e -> { - Country selectedItem = countryComboBox.getSelectionModel().getSelectedItem(); - sepaInstantAccount.setCountry(selectedItem); - TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(selectedItem.code); - setupCurrency(selectedItem, currency); - - updateCountriesSelection(true, euroCountryCheckBoxes); - updateCountriesSelection(true, nonEuroCountryCheckBoxes); - updateFromInputs(); - }); - - addEuroCountriesGrid(true); - addNonEuroCountriesGrid(true); + addEuroCountriesGrid(); + addNonEuroCountriesGrid(); addLimitations(); addAccountNameTextFieldWithAutoFillToggleButton(); @@ -191,98 +128,25 @@ public class SepaInstantForm extends PaymentMethodForm { updateFromInputs(); } - private void setupCurrency(Country country, TradeCurrency currency) { - if (CountryUtil.getAllSepaInstantEuroCountries().contains(country)) { - currencyTextField.setVisible(true); - currencyTextField.setManaged(true); - currencyComboBox.setVisible(false); - currencyComboBox.setManaged(false); - sepaInstantAccount.setSingleTradeCurrency(currency); - currencyTextField.setText(Res.get("payment.currencyWithSymbol", currency.getNameAndCode())); - } else { - currencyComboBox.setVisible(true); - currencyComboBox.setManaged(true); - currencyTextField.setVisible(false); - currencyTextField.setManaged(false); - currencyComboBox.setItems(FXCollections.observableArrayList(currency, - CurrencyUtil.getFiatCurrency("EUR").get())); - currencyComboBox.setOnAction(e2 -> { - sepaInstantAccount.setSingleTradeCurrency(currencyComboBox.getSelectionModel().getSelectedItem()); - updateCountriesSelection(true, euroCountryCheckBoxes); - autoFillNameTextField(); - }); - currencyComboBox.setConverter(new StringConverter() { - @Override - public String toString(TradeCurrency currency) { - return currency.getNameAndCode(); - } - - @Override - public TradeCurrency fromString(String string) { - return null; - } - }); - currencyComboBox.getSelectionModel().select(0); - } + @Override + void setupCurrency(Country country, TradeCurrency currency) { + final boolean isSepaInstantCountry = CountryUtil.getAllSepaInstantEuroCountries().contains(country); + updateCurrencyFormElements(currency, isSepaInstantCountry, sepaInstantAccount); } - private void addEuroCountriesGrid(boolean isEditable) { - addCountriesGrid(isEditable, Res.get("payment.accept.euro"), euroCountryCheckBoxes, + private void addEuroCountriesGrid() { + addCountriesGrid(Res.get("payment.accept.euro"), euroCountryCheckBoxes, CountryUtil.getAllSepaInstantEuroCountries()); } - private void addNonEuroCountriesGrid(boolean isEditable) { - addCountriesGrid(isEditable, Res.get("payment.accept.nonEuro"), nonEuroCountryCheckBoxes, + private void addNonEuroCountriesGrid() { + addCountriesGrid(Res.get("payment.accept.nonEuro"), nonEuroCountryCheckBoxes, CountryUtil.getAllSepaInstantNonEuroCountries()); } - private void addCountriesGrid(boolean isEditable, String title, List checkBoxList, List dataProvider) { - Label label = FormBuilder.addLabel(gridPane, ++gridRow, title, 0); - label.setWrapText(true); - label.setMaxWidth(180); - label.setTextAlignment(TextAlignment.RIGHT); - GridPane.setHalignment(label, HPos.RIGHT); - GridPane.setValignment(label, VPos.TOP); - FlowPane flowPane = new FlowPane(); - flowPane.setPadding(new Insets(10, 10, 10, 10)); - flowPane.setVgap(10); - flowPane.setHgap(10); - flowPane.setMinHeight(55); - - if (isEditable) - flowPane.setId("flow-pane-checkboxes-bg"); - else - flowPane.setId("flow-pane-checkboxes-non-editable-bg"); - - dataProvider.stream().forEach(country -> - { - final String countryCode = country.code; - CheckBox checkBox = new AutoTooltipCheckBox(countryCode); - checkBox.setUserData(countryCode); - checkBoxList.add(checkBox); - checkBox.setMouseTransparent(!isEditable); - checkBox.setMinWidth(45); - checkBox.setMaxWidth(45); - checkBox.setTooltip(new Tooltip(country.name)); - checkBox.setOnAction(event -> { - if (checkBox.isSelected()) - sepaInstantAccount.addAcceptedCountry(countryCode); - else - sepaInstantAccount.removeAcceptedCountry(countryCode); - - updateAllInputsValid(); - }); - flowPane.getChildren().add(checkBox); - }); - updateCountriesSelection(isEditable, checkBoxList); - - GridPane.setRowIndex(flowPane, gridRow); - GridPane.setColumnIndex(flowPane, 1); - gridPane.getChildren().add(flowPane); - } - - private void updateCountriesSelection(boolean isEditable, List checkBoxList) { - checkBoxList.stream().forEach(checkBox -> { + @Override + void updateCountriesSelection(List checkBoxList) { + checkBoxList.forEach(checkBox -> { String countryCode = (String) checkBox.getUserData(); TradeCurrency selectedCurrency = sepaInstantAccount.getSelectedTradeCurrency(); if (selectedCurrency == null) { @@ -292,7 +156,7 @@ public class SepaInstantForm extends PaymentMethodForm { } boolean selected; - if (isEditable && selectedCurrency != null) { + if (selectedCurrency != null) { selected = true; sepaInstantAccount.addAcceptedCountry(countryCode); } else { @@ -302,26 +166,6 @@ public class SepaInstantForm extends PaymentMethodForm { }); } - @Override - protected void autoFillNameTextField() { - if (useCustomAccountNameToggleButton != null && !useCustomAccountNameToggleButton.isSelected()) { - TradeCurrency singleTradeCurrency = this.paymentAccount.getSingleTradeCurrency(); - String currency = singleTradeCurrency != null ? singleTradeCurrency.getCode() : null; - if (currency != null) { - String iban = ibanInputTextField.getText(); - if (iban.length() > 9) - iban = StringUtils.abbreviate(iban, 9); - String method = Res.get(paymentAccount.getPaymentMethod().getId()); - CountryBasedPaymentAccount countryBasedPaymentAccount = (CountryBasedPaymentAccount) this.paymentAccount; - String country = countryBasedPaymentAccount.getCountry() != null ? - countryBasedPaymentAccount.getCountry().code : null; - if (country != null) - accountNameTextField.setText(method.concat(" (").concat(currency).concat("/").concat(country) - .concat("): ").concat(iban)); - } - } - } - @Override public void updateAllInputsValid() { allInputsValid.set(isAccountNameValid() @@ -340,8 +184,8 @@ public class SepaInstantForm extends PaymentMethodForm { FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"), Res.get(sepaInstantAccount.getPaymentMethod().getId())); FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.owner"), sepaInstantAccount.getHolderName()); - FormBuilder.addTopLabelTextField(gridPane, ++gridRow, "IBAN:", sepaInstantAccount.getIban()).second.setMouseTransparent(false); - FormBuilder.addTopLabelTextField(gridPane, ++gridRow, "BIC:", sepaInstantAccount.getBic()).second.setMouseTransparent(false); + FormBuilder.addTopLabelTextField(gridPane, ++gridRow, IBAN, sepaInstantAccount.getIban()).second.setMouseTransparent(false); + FormBuilder.addTopLabelTextField(gridPane, ++gridRow, BIC, sepaInstantAccount.getBic()).second.setMouseTransparent(false); FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("payment.bank.country"), sepaInstantAccount.getCountry() != null ? sepaInstantAccount.getCountry().name : ""); TradeCurrency singleTradeCurrency = sepaInstantAccount.getSingleTradeCurrency(); @@ -362,4 +206,14 @@ public class SepaInstantForm extends PaymentMethodForm { } addLimitations(); } + + @Override + void removeAcceptedCountry(String countryCode) { + sepaInstantAccount.removeAcceptedCountry(countryCode); + } + + @Override + void addAcceptedCountry(String countryCode) { + sepaInstantAccount.addAcceptedCountry(countryCode); + } } diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/SpecificBankForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/SpecificBankForm.java index 52c5a1ef23..cbcc30a4a1 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/SpecificBankForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/SpecificBankForm.java @@ -40,8 +40,8 @@ import javafx.scene.layout.GridPane; import javafx.beans.binding.Bindings; -import static bisq.desktop.util.FormBuilder.addLabelInputTextFieldButton; -import static bisq.desktop.util.FormBuilder.addLabelTextFieldButton; +import static bisq.desktop.util.FormBuilder.addTopLabelInputTextFieldButton; +import static bisq.desktop.util.FormBuilder.addTopLabelTextFieldButton; public class SpecificBankForm extends BankForm { private final SpecificBanksAccountPayload specificBanksAccountPayload; @@ -60,7 +60,7 @@ public class SpecificBankForm extends BankForm { @Override protected void addAcceptedBanksForAddAccount() { - Tuple3 addBankTuple = addLabelInputTextFieldButton(gridPane, ++gridRow, + Tuple3 addBankTuple = addTopLabelInputTextFieldButton(gridPane, ++gridRow, Res.get("payment.nameOfAcceptedBank"), Res.get("payment.addAcceptedBank")); InputTextField addBankInputTextField = addBankTuple.second; Button addButton = addBankTuple.third; @@ -68,7 +68,7 @@ public class SpecificBankForm extends BankForm { addButton.disableProperty().bind(Bindings.createBooleanBinding(() -> addBankInputTextField.getText().isEmpty(), addBankInputTextField.textProperty())); - Tuple3 acceptedBanksTuple = addLabelTextFieldButton(gridPane, ++gridRow, + Tuple3 acceptedBanksTuple = addTopLabelTextFieldButton(gridPane, ++gridRow, Res.get("payment.accepted.banks"), Res.get("payment.clearAcceptedBanks")); acceptedBanksTextField = acceptedBanksTuple.second; acceptedBanksTextField.setMouseTransparent(false); diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/SwishForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/SwishForm.java index 9b53e6e3a7..cb01146504 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/SwishForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/SwishForm.java @@ -32,8 +32,6 @@ import bisq.core.payment.payload.SwishAccountPayload; import bisq.core.util.BSFormatter; import bisq.core.util.validation.InputValidator; -import org.apache.commons.lang3.StringUtils; - import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; @@ -94,12 +92,7 @@ public class SwishForm extends PaymentMethodForm { @Override protected void autoFillNameTextField() { - if (useCustomAccountNameToggleButton != null && !useCustomAccountNameToggleButton.isSelected()) { - String mobileNr = mobileNrInputTextField.getText(); - mobileNr = StringUtils.abbreviate(mobileNr, 9); - String method = Res.get(paymentAccount.getPaymentMethod().getId()); - accountNameTextField.setText(method.concat(": ").concat(mobileNr)); - } + setAccountNameWithString(mobileNrInputTextField.getText()); } @Override diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/USPostalMoneyOrderForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/USPostalMoneyOrderForm.java index 77b10f1f3d..ed8de8e2a8 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/USPostalMoneyOrderForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/USPostalMoneyOrderForm.java @@ -32,8 +32,6 @@ import bisq.core.payment.payload.USPostalMoneyOrderAccountPayload; import bisq.core.util.BSFormatter; import bisq.core.util.validation.InputValidator; -import org.apache.commons.lang3.StringUtils; - import javafx.scene.control.TextArea; import javafx.scene.layout.GridPane; @@ -98,12 +96,7 @@ public class USPostalMoneyOrderForm extends PaymentMethodForm { @Override protected void autoFillNameTextField() { - if (useCustomAccountNameToggleButton != null && !useCustomAccountNameToggleButton.isSelected()) { - String postalAddress = postalAddressTextArea.getText(); - postalAddress = StringUtils.abbreviate(postalAddress, 9); - String method = Res.get(paymentAccount.getPaymentMethod().getId()); - accountNameTextField.setText(method.concat(": ").concat(postalAddress)); - } + setAccountNameWithString(postalAddressTextArea.getText()); } @Override diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/UpholdForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/UpholdForm.java index b37b43ae49..1473250577 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/UpholdForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/UpholdForm.java @@ -32,15 +32,10 @@ import bisq.core.payment.payload.UpholdAccountPayload; import bisq.core.util.BSFormatter; import bisq.core.util.validation.InputValidator; -import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.layout.FlowPane; import javafx.scene.layout.GridPane; -import javafx.geometry.Insets; -import javafx.geometry.VPos; - -import static bisq.desktop.util.FormBuilder.addLabel; import static bisq.desktop.util.FormBuilder.addTopLabelTextField; import static bisq.desktop.util.FormBuilder.addTopLabelTextFieldWithCopyIcon; @@ -81,24 +76,17 @@ public class UpholdForm extends PaymentMethodForm { } private void addCurrenciesGrid(boolean isEditable) { - Label label = addLabel(gridPane, ++gridRow, Res.get("payment.supportedCurrencies"), 0); - GridPane.setValignment(label, VPos.TOP); - FlowPane flowPane = new FlowPane(); - flowPane.setPadding(new Insets(10, 10, 10, 10)); - flowPane.setVgap(10); - flowPane.setHgap(10); + + FlowPane flowPane = FormBuilder.addTopLabelFlowPane(gridPane, ++gridRow, + Res.get("payment.supportedCurrencies"), 0).second; if (isEditable) flowPane.setId("flow-pane-checkboxes-bg"); else flowPane.setId("flow-pane-checkboxes-non-editable-bg"); - CurrencyUtil.getAllUpholdCurrencies().stream().forEach(e -> + CurrencyUtil.getAllUpholdCurrencies().forEach(e -> fillUpFlowPaneWithCurrencies(isEditable, flowPane, e, upholdAccount)); - - GridPane.setRowIndex(flowPane, gridRow); - GridPane.setColumnIndex(flowPane, 1); - gridPane.getChildren().add(flowPane); } @Override diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/WeChatPayForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/WeChatPayForm.java index d70c071cd0..5a0db878bf 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/WeChatPayForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/WeChatPayForm.java @@ -17,13 +17,9 @@ package bisq.desktop.components.paymentmethods; -import bisq.desktop.components.InputTextField; -import bisq.desktop.util.FormBuilder; -import bisq.desktop.util.Layout; import bisq.desktop.util.validation.WeChatPayValidator; import bisq.core.locale.Res; -import bisq.core.locale.TradeCurrency; import bisq.core.payment.AccountAgeWitnessService; import bisq.core.payment.PaymentAccount; import bisq.core.payment.WeChatPayAccount; @@ -32,19 +28,13 @@ import bisq.core.payment.payload.WeChatPayAccountPayload; import bisq.core.util.BSFormatter; import bisq.core.util.validation.InputValidator; -import org.apache.commons.lang3.StringUtils; - -import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; -import static bisq.desktop.util.FormBuilder.addTopLabelTextField; import static bisq.desktop.util.FormBuilder.addTopLabelTextFieldWithCopyIcon; -public class WeChatPayForm extends PaymentMethodForm { +public class WeChatPayForm extends GeneralAccountNumberForm { private final WeChatPayAccount weChatPayAccount; - private final WeChatPayValidator weChatPayValidator; - private InputTextField accountNrInputTextField; public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) { addTopLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.get("payment.account.no"), ((WeChatPayAccountPayload) paymentAccountPayload).getAccountNr()); @@ -54,54 +44,15 @@ public class WeChatPayForm extends PaymentMethodForm { public WeChatPayForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, WeChatPayValidator weChatPayValidator, InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.weChatPayAccount = (WeChatPayAccount) paymentAccount; - this.weChatPayValidator = weChatPayValidator; } @Override - public void addFormForAddAccount() { - gridRowFrom = gridRow + 1; - - accountNrInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.account.no")); - accountNrInputTextField.setValidator(weChatPayValidator); - accountNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { - weChatPayAccount.setAccountNr(newValue); - updateFromInputs(); - }); - - final TradeCurrency singleTradeCurrency = weChatPayAccount.getSingleTradeCurrency(); - final String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : ""; - FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"), nameAndCode); - addLimitations(); - addAccountNameTextFieldWithAutoFillToggleButton(); + void setAccountNumber(String newValue) { + weChatPayAccount.setAccountNr(newValue); } @Override - protected void autoFillNameTextField() { - if (useCustomAccountNameToggleButton != null && !useCustomAccountNameToggleButton.isSelected()) { - String accountNr = accountNrInputTextField.getText(); - accountNr = StringUtils.abbreviate(accountNr, 9); - String method = Res.get(paymentAccount.getPaymentMethod().getId()); - accountNameTextField.setText(method.concat(": ").concat(accountNr)); - } - } - - @Override - public void addFormForDisplayAccount() { - gridRowFrom = gridRow; - addTopLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), weChatPayAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE); - FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"), Res.get(weChatPayAccount.getPaymentMethod().getId())); - TextField field = FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.no"), weChatPayAccount.getAccountNr()).second; - field.setMouseTransparent(false); - final TradeCurrency singleTradeCurrency = weChatPayAccount.getSingleTradeCurrency(); - final String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : ""; - FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"), nameAndCode); - addLimitations(); - } - - @Override - public void updateAllInputsValid() { - allInputsValid.set(isAccountNameValid() - && weChatPayValidator.validate(weChatPayAccount.getAccountNr()).isValid - && weChatPayAccount.getTradeCurrencies().size() > 0); + String getAccountNr() { + return weChatPayAccount.getAccountNr(); } } diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/WesternUnionForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/WesternUnionForm.java index deb59757e6..c190efca98 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/WesternUnionForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/WesternUnionForm.java @@ -67,7 +67,9 @@ public class WesternUnionForm extends PaymentMethodForm { } private final WesternUnionAccountPayload westernUnionAccountPayload; - private InputTextField holderNameInputTextField, emailInputTextField, cityInputTextField, stateInputTextField; + private InputTextField holderNameInputTextField; + private InputTextField cityInputTextField; + private InputTextField stateInputTextField; private final EmailValidator emailValidator; private Country selectedCountry; @@ -82,7 +84,6 @@ public class WesternUnionForm extends PaymentMethodForm { @Override public void addFormForDisplayAccount() { gridRowFrom = gridRow; - String countryCode = westernUnionAccountPayload.getCountryCode(); FormBuilder.addTopLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), paymentAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE); FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"), @@ -157,7 +158,7 @@ public class WesternUnionForm extends PaymentMethodForm { }); applyIsStateRequired(); - emailInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.email")); + InputTextField emailInputTextField = FormBuilder.addInputTextField(gridPane, ++gridRow, Res.get("payment.email")); emailInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { westernUnionAccountPayload.setEmail(newValue); updateFromInputs(); diff --git a/desktop/src/main/java/bisq/desktop/util/FormBuilder.java b/desktop/src/main/java/bisq/desktop/util/FormBuilder.java index 6f5dfb75b8..6307d85a5a 100644 --- a/desktop/src/main/java/bisq/desktop/util/FormBuilder.java +++ b/desktop/src/main/java/bisq/desktop/util/FormBuilder.java @@ -230,7 +230,7 @@ public class FormBuilder { textField.setMouseTransparent(true); textField.setFocusTraversable(false); - final Tuple2 topLabelWithVBox = getTopLabelWithVBox(gridPane, rowIndex, title, textField, top); + final Tuple2 topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, textField, top); return new Tuple3<>(topLabelWithVBox.first, textField, topLabelWithVBox.second); } @@ -344,7 +344,7 @@ public class FormBuilder { ((JFXTextArea) textArea).setLabelFloat(true); textArea.setWrapText(true); - final Tuple2 topLabelWithVBox = getTopLabelWithVBox(gridPane, rowIndex, title, textArea, top); + final Tuple2 topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, textArea, top); return new Tuple2<>(topLabelWithVBox.first, textArea); } @@ -357,7 +357,7 @@ public class FormBuilder { public static Tuple2 addTopLabelDatePicker(GridPane gridPane, int rowIndex, String title, double top) { DatePicker datePicker = new JFXDatePicker(); - final Tuple2 topLabelWithVBox = getTopLabelWithVBox(gridPane, rowIndex, title, datePicker, top); + final Tuple2 topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, datePicker, top); return new Tuple2<>(topLabelWithVBox.first, datePicker); } @@ -419,7 +419,7 @@ public class FormBuilder { InfoInputTextField inputTextField = new InfoInputTextField(); - final Tuple2 topLabelWithVBox = getTopLabelWithVBox(gridPane, rowIndex, title, inputTextField, top); + final Tuple2 topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, inputTextField, top); return new Tuple2<>(topLabelWithVBox.first, inputTextField); } @@ -457,7 +457,7 @@ public class FormBuilder { toggleButton.setText(toggleButtonTitle); VBox.setMargin(toggleButton, new Insets(4, 0, 0, 0)); - final Tuple2 topLabelWithVBox = getTopLabelWithVBox(gridPane, rowIndex, title, inputTextField, 0); + final Tuple2 topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, inputTextField, 0); topLabelWithVBox.second.getChildren().add(toggleButton); @@ -469,9 +469,7 @@ public class FormBuilder { // Label + InputTextField + Button /////////////////////////////////////////////////////////////////////////////////////////// - public static Tuple3 addLabelInputTextFieldButton(GridPane gridPane, int rowIndex, String title, String buttonTitle) { - Label label = addLabel(gridPane, rowIndex, title, 0); - + public static Tuple3 addTopLabelInputTextFieldButton(GridPane gridPane, int rowIndex, String title, String buttonTitle) { InputTextField inputTextField = new InputTextField(); Button button = new AutoTooltipButton(buttonTitle); button.setDefaultButton(true); @@ -480,11 +478,10 @@ public class FormBuilder { hBox.setSpacing(10); hBox.getChildren().addAll(inputTextField, button); HBox.setHgrow(inputTextField, Priority.ALWAYS); - GridPane.setRowIndex(hBox, rowIndex); - GridPane.setColumnIndex(hBox, 1); - gridPane.getChildren().add(hBox); - return new Tuple3<>(label, inputTextField, button); + final Tuple2 labelVBoxTuple2 = addTopLabelWithVBox(gridPane, rowIndex, title, hBox, 0); + + return new Tuple3<>(labelVBoxTuple2.first, inputTextField, button); } @@ -492,12 +489,11 @@ public class FormBuilder { // Label + TextField + Button /////////////////////////////////////////////////////////////////////////////////////////// - public static Tuple3 addLabelTextFieldButton(GridPane gridPane, int rowIndex, String title, String buttonTitle) { - return addLabelTextFieldButton(gridPane, rowIndex, title, buttonTitle, 0); + public static Tuple3 addTopLabelTextFieldButton(GridPane gridPane, int rowIndex, String title, String buttonTitle) { + return addTopLabelTextFieldButton(gridPane, rowIndex, title, buttonTitle, 0); } - public static Tuple3 addLabelTextFieldButton(GridPane gridPane, int rowIndex, String title, String buttonTitle, double top) { - Label label = addLabel(gridPane, rowIndex, title, top); + public static Tuple3 addTopLabelTextFieldButton(GridPane gridPane, int rowIndex, String title, String buttonTitle, double top) { TextField textField = new JFXTextField(); textField.setEditable(false); @@ -510,12 +506,10 @@ public class FormBuilder { hBox.setSpacing(10); hBox.getChildren().addAll(textField, button); HBox.setHgrow(textField, Priority.ALWAYS); - GridPane.setRowIndex(hBox, rowIndex); - GridPane.setColumnIndex(hBox, 1); - GridPane.setMargin(hBox, new Insets(top, 0, 0, 0)); - gridPane.getChildren().add(hBox); - return new Tuple3<>(label, textField, button); + final Tuple2 labelVBoxTuple2 = addTopLabelWithVBox(gridPane, rowIndex, title, hBox, 0); + + return new Tuple3<>(labelVBoxTuple2.first, textField, button); } @@ -652,7 +646,7 @@ public class FormBuilder { hBox.setSpacing(10); hBox.getChildren().addAll(radioButton1, radioButton2); - final Tuple2 topLabelWithVBox = getTopLabelWithVBox(gridPane, rowIndex, title, hBox, top); + final Tuple2 topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, hBox, top); return new Tuple3<>(topLabelWithVBox.first, radioButton1, radioButton2); } @@ -757,7 +751,7 @@ public class FormBuilder { } @NotNull - public static Tuple2 getTopLabelWithVBox(GridPane gridPane, int rowIndex, + public static Tuple2 addTopLabelWithVBox(GridPane gridPane, int rowIndex, String title, Node node, double top) { Label label = getTopLabel(title); @@ -837,7 +831,7 @@ public class FormBuilder { ComboBox comboBox2 = new JFXComboBox<>(); hBox.getChildren().addAll(comboBox1, comboBox2); - final Tuple2 topLabelWithVBox = getTopLabelWithVBox(gridPane, rowIndex, title, hBox, top); + final Tuple2 topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, hBox, top); return new Tuple3<>(topLabelWithVBox.first, comboBox1, comboBox2); } @@ -951,7 +945,7 @@ public class FormBuilder { TextFieldWithCopyIcon textFieldWithCopyIcon = new TextFieldWithCopyIcon(); textFieldWithCopyIcon.setText(value); - final Tuple2 topLabelWithVBox = getTopLabelWithVBox(gridPane, rowIndex, title, textFieldWithCopyIcon, top); + final Tuple2 topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, textFieldWithCopyIcon, top); return new Tuple2<>(topLabelWithVBox.first, textFieldWithCopyIcon); } @@ -1066,7 +1060,7 @@ public class FormBuilder { Button button = new AutoTooltipButton(buttonTitle); button.setDefaultButton(true); - final Tuple2 topLabelWithVBox = getTopLabelWithVBox(gridPane, rowIndex, labelText, button, top); + final Tuple2 topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, labelText, button, top); return new Tuple2<>(topLabelWithVBox.first, button); } @@ -1083,7 +1077,7 @@ public class FormBuilder { Button button2 = new AutoTooltipButton(title2); hBox.getChildren().addAll(button1, button2); - final Tuple2 topLabelWithVBox = getTopLabelWithVBox(gridPane, rowIndex, labelText, hBox, top); + final Tuple2 topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, labelText, hBox, top); return new Tuple3<>(topLabelWithVBox.first, button1, button2); } @@ -1340,7 +1334,7 @@ public class FormBuilder { public static Tuple3, VBox> addTopLabelListView(GridPane gridPane, int rowIndex, String title, double top) { ListView listView = new ListView<>(); - final Tuple2 topLabelWithVBox = getTopLabelWithVBox(gridPane, rowIndex, title, listView, top); + final Tuple2 topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, listView, top); return new Tuple3<>(topLabelWithVBox.first, listView, topLabelWithVBox.second); } @@ -1353,7 +1347,7 @@ public class FormBuilder { flowPane.setPadding(new Insets(10, 10, 10, 10)); flowPane.setVgap(10); flowPane.setHgap(10); - final Tuple2 topLabelWithVBox = getTopLabelWithVBox(gridPane, rowIndex, title, flowPane, top); + final Tuple2 topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, flowPane, top); return new Tuple2<>(topLabelWithVBox.first, flowPane); }