Search in sources :

Example 1 with PaymentMethodForm

use of bisq.desktop.components.paymentmethods.PaymentMethodForm in project bisq-desktop by bisq-network.

the class FiatAccountsView method addNewAccount.

// Add new account form
private void addNewAccount() {
    paymentAccountsListView.getSelectionModel().clearSelection();
    removeAccountRows();
    addAccountButton.setDisable(true);
    accountTitledGroupBg = addTitledGroupBg(root, ++gridRow, 1, Res.get("shared.createNewAccount"), Layout.GROUP_DISTANCE);
    // noinspection unchecked
    paymentMethodComboBox = addLabelComboBox(root, gridRow, Res.getWithCol("shared.paymentMethod"), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
    paymentMethodComboBox.setPromptText(Res.get("shared.selectPaymentMethod"));
    paymentMethodComboBox.setVisibleRowCount(11);
    paymentMethodComboBox.setPrefWidth(250);
    List<PaymentMethod> list = PaymentMethod.getAllValues().stream().filter(paymentMethod -> !paymentMethod.getId().equals(PaymentMethod.BLOCK_CHAINS_ID)).collect(Collectors.toList());
    paymentMethodComboBox.setItems(FXCollections.observableArrayList(list));
    paymentMethodComboBox.setConverter(new StringConverter<PaymentMethod>() {

        @Override
        public String toString(PaymentMethod paymentMethod) {
            return paymentMethod != null ? Res.get(paymentMethod.getId()) : "";
        }

        @Override
        public PaymentMethod fromString(String s) {
            return null;
        }
    });
    paymentMethodComboBox.setOnAction(e -> {
        if (paymentMethodForm != null) {
            FormBuilder.removeRowsFromGridPane(root, 3, paymentMethodForm.getGridRow() + 1);
            GridPane.setRowSpan(accountTitledGroupBg, paymentMethodForm.getRowSpan() + 1);
        }
        gridRow = 2;
        paymentMethodForm = getPaymentMethodForm(paymentMethodComboBox.getSelectionModel().getSelectedItem());
        if (paymentMethodForm != null) {
            paymentMethodForm.addFormForAddAccount();
            gridRow = paymentMethodForm.getGridRow();
            Tuple2<Button, Button> tuple2 = add2ButtonsAfterGroup(root, ++gridRow, Res.get("shared.saveNewAccount"), Res.get("shared.cancel"));
            saveNewAccountButton = tuple2.first;
            saveNewAccountButton.setOnAction(event -> onSaveNewAccount(paymentMethodForm.getPaymentAccount()));
            saveNewAccountButton.disableProperty().bind(paymentMethodForm.allInputsValidProperty().not());
            Button cancelButton = tuple2.second;
            cancelButton.setOnAction(event -> onCancelNewAccount());
            GridPane.setRowSpan(accountTitledGroupBg, paymentMethodForm.getRowSpan() + 1);
        }
    });
}
Also used : Button(javafx.scene.control.Button) PopmoneyValidator(bisq.desktop.util.validation.PopmoneyValidator) Coin(org.bitcoinj.core.Coin) ListCell(javafx.scene.control.ListCell) Layout(bisq.desktop.util.Layout) BSFormatter(bisq.desktop.util.BSFormatter) PaymentAccountFactory(bisq.core.payment.PaymentAccountFactory) WesternUnionAccount(bisq.core.payment.WesternUnionAccount) ComboBox(javafx.scene.control.ComboBox) Res(bisq.core.locale.Res) MoneyBeamValidator(bisq.desktop.util.validation.MoneyBeamValidator) BICValidator(bisq.desktop.util.validation.BICValidator) AliPayForm(bisq.desktop.components.paymentmethods.AliPayForm) PopmoneyForm(bisq.desktop.components.paymentmethods.PopmoneyForm) SwishForm(bisq.desktop.components.paymentmethods.SwishForm) VenmoForm(bisq.desktop.components.paymentmethods.VenmoForm) AliPayValidator(bisq.desktop.util.validation.AliPayValidator) SepaInstantForm(bisq.desktop.components.paymentmethods.SepaInstantForm) Popup(bisq.desktop.main.overlays.popups.Popup) ChaseQuickPayValidator(bisq.desktop.util.validation.ChaseQuickPayValidator) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) FormBuilder(bisq.desktop.util.FormBuilder) ClearXchangeValidator(bisq.desktop.util.validation.ClearXchangeValidator) PaymentMethod(bisq.core.payment.payload.PaymentMethod) Collectors(java.util.stream.Collectors) AccountAgeWitnessService(bisq.core.payment.AccountAgeWitnessService) OKPayForm(bisq.desktop.components.paymentmethods.OKPayForm) OKPayValidator(bisq.desktop.util.validation.OKPayValidator) VenmoValidator(bisq.desktop.util.validation.VenmoValidator) PaymentAccount(bisq.core.payment.PaymentAccount) List(java.util.List) CashDepositForm(bisq.desktop.components.paymentmethods.CashDepositForm) RevolutValidator(bisq.desktop.util.validation.RevolutValidator) AnchorPane(javafx.scene.layout.AnchorPane) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) UpholdForm(bisq.desktop.components.paymentmethods.UpholdForm) UserThread(bisq.common.UserThread) SpecificBankForm(bisq.desktop.components.paymentmethods.SpecificBankForm) IBANValidator(bisq.desktop.util.validation.IBANValidator) FasterPaymentsForm(bisq.desktop.components.paymentmethods.FasterPaymentsForm) MoneyBeamForm(bisq.desktop.components.paymentmethods.MoneyBeamForm) SwishValidator(bisq.desktop.util.validation.SwishValidator) ClearXchangeForm(bisq.desktop.components.paymentmethods.ClearXchangeForm) ListView(javafx.scene.control.ListView) FXCollections(javafx.collections.FXCollections) FxmlView(bisq.desktop.common.view.FxmlView) Inject(javax.inject.Inject) ClearXchangeAccount(bisq.core.payment.ClearXchangeAccount) Tuple2(bisq.common.util.Tuple2) USPostalMoneyOrderValidator(bisq.desktop.util.validation.USPostalMoneyOrderValidator) Tuple3(bisq.common.util.Tuple3) VPos(javafx.geometry.VPos) UpholdValidator(bisq.desktop.util.validation.UpholdValidator) TextAlignment(javafx.scene.text.TextAlignment) Callback(javafx.util.Callback) RevolutForm(bisq.desktop.components.paymentmethods.RevolutForm) TitledGroupBg(bisq.desktop.components.TitledGroupBg) GridPane(javafx.scene.layout.GridPane) NationalBankForm(bisq.desktop.components.paymentmethods.NationalBankForm) SameBankForm(bisq.desktop.components.paymentmethods.SameBankForm) WesternUnionForm(bisq.desktop.components.paymentmethods.WesternUnionForm) Label(javafx.scene.control.Label) InteracETransferValidator(bisq.desktop.util.validation.InteracETransferValidator) PerfectMoneyForm(bisq.desktop.components.paymentmethods.PerfectMoneyForm) BisqEnvironment(bisq.core.app.BisqEnvironment) StringConverter(javafx.util.StringConverter) CashAppValidator(bisq.desktop.util.validation.CashAppValidator) USPostalMoneyOrderForm(bisq.desktop.components.paymentmethods.USPostalMoneyOrderForm) TimeUnit(java.util.concurrent.TimeUnit) PaymentMethodForm(bisq.desktop.components.paymentmethods.PaymentMethodForm) InputValidator(bisq.core.util.validation.InputValidator) ChaseQuickPayForm(bisq.desktop.components.paymentmethods.ChaseQuickPayForm) ImageUtil(bisq.desktop.util.ImageUtil) SepaForm(bisq.desktop.components.paymentmethods.SepaForm) ImageView(javafx.scene.image.ImageView) CashAppForm(bisq.desktop.components.paymentmethods.CashAppForm) InteracETransferForm(bisq.desktop.components.paymentmethods.InteracETransferForm) PerfectMoneyValidator(bisq.desktop.util.validation.PerfectMoneyValidator) ActivatableViewAndModel(bisq.desktop.common.view.ActivatableViewAndModel) ChangeListener(javafx.beans.value.ChangeListener) Button(javafx.scene.control.Button) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) PaymentMethod(bisq.core.payment.payload.PaymentMethod)

Aggregations

UserThread (bisq.common.UserThread)1 Tuple2 (bisq.common.util.Tuple2)1 Tuple3 (bisq.common.util.Tuple3)1 BisqEnvironment (bisq.core.app.BisqEnvironment)1 Res (bisq.core.locale.Res)1 AccountAgeWitnessService (bisq.core.payment.AccountAgeWitnessService)1 ClearXchangeAccount (bisq.core.payment.ClearXchangeAccount)1 PaymentAccount (bisq.core.payment.PaymentAccount)1 PaymentAccountFactory (bisq.core.payment.PaymentAccountFactory)1 WesternUnionAccount (bisq.core.payment.WesternUnionAccount)1 PaymentMethod (bisq.core.payment.payload.PaymentMethod)1 InputValidator (bisq.core.util.validation.InputValidator)1 ActivatableViewAndModel (bisq.desktop.common.view.ActivatableViewAndModel)1 FxmlView (bisq.desktop.common.view.FxmlView)1 AutoTooltipButton (bisq.desktop.components.AutoTooltipButton)1 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)1 TitledGroupBg (bisq.desktop.components.TitledGroupBg)1 AliPayForm (bisq.desktop.components.paymentmethods.AliPayForm)1 CashAppForm (bisq.desktop.components.paymentmethods.CashAppForm)1 CashDepositForm (bisq.desktop.components.paymentmethods.CashDepositForm)1