Search in sources :

Example 41 with TradeCurrency

use of bisq.core.locale.TradeCurrency in project bisq-desktop by bisq-network.

the class AltCoinAccountsView method onSaveNewAccount.

// /////////////////////////////////////////////////////////////////////////////////////////
// UI actions
// /////////////////////////////////////////////////////////////////////////////////////////
private void onSaveNewAccount(PaymentAccount paymentAccount) {
    TradeCurrency selectedTradeCurrency = paymentAccount.getSelectedTradeCurrency();
    if (selectedTradeCurrency != null) {
        String code = selectedTradeCurrency.getCode();
        if (selectedTradeCurrency instanceof CryptoCurrency && ((CryptoCurrency) selectedTradeCurrency).isAsset()) {
            String name = selectedTradeCurrency.getName();
            new Popup<>().information(Res.get("account.altcoin.popup.wallet.msg", selectedTradeCurrency.getCodeAndName(), name, name)).closeButtonText(Res.get("account.altcoin.popup.wallet.confirm")).show();
        }
        switch(code) {
            case "XMR":
                new Popup<>().information(Res.get("account.altcoin.popup.xmr.msg")).useIUnderstandButton().show();
                break;
            case "ZEC":
                new Popup<>().information(Res.get("account.altcoin.popup.ZEC.msg", "ZEC")).useIUnderstandButton().show();
                break;
            case "XZC":
                new Popup<>().information(Res.get("account.altcoin.popup.XZC.msg", "XZC")).useIUnderstandButton().show();
                break;
            case "BCH":
            case "BCHC":
                new Popup<>().information(Res.get("account.altcoin.popup.bch")).useIUnderstandButton().show();
                break;
            case "BTG":
                new Popup<>().information(Res.get("account.altcoin.popup.btg")).useIUnderstandButton().show();
                break;
        }
        if (!model.getPaymentAccounts().stream().filter(e -> e.getAccountName() != null && e.getAccountName().equals(paymentAccount.getAccountName())).findAny().isPresent()) {
            model.onSaveNewAccount(paymentAccount);
            removeNewAccountForm();
        } else {
            new Popup<>().warning(Res.get("shared.accountNameAlreadyUsed")).show();
        }
    }
}
Also used : Button(javafx.scene.control.Button) TradeCurrency(bisq.core.locale.TradeCurrency) ListView(javafx.scene.control.ListView) ListCell(javafx.scene.control.ListCell) Layout(bisq.desktop.util.Layout) FxmlView(bisq.desktop.common.view.FxmlView) BSFormatter(bisq.desktop.util.BSFormatter) AltCoinAddressValidator(bisq.core.payment.validation.AltCoinAddressValidator) Inject(javax.inject.Inject) PaymentAccountFactory(bisq.core.payment.PaymentAccountFactory) Tuple2(bisq.common.util.Tuple2) CryptoCurrencyForm(bisq.desktop.components.paymentmethods.CryptoCurrencyForm) Tuple3(bisq.common.util.Tuple3) VPos(javafx.geometry.VPos) Res(bisq.core.locale.Res) Callback(javafx.util.Callback) TitledGroupBg(bisq.desktop.components.TitledGroupBg) GridPane(javafx.scene.layout.GridPane) FormBuilder.addLabelListView(bisq.desktop.util.FormBuilder.addLabelListView) FormBuilder.add3ButtonsAfterGroup(bisq.desktop.util.FormBuilder.add3ButtonsAfterGroup) Popup(bisq.desktop.main.overlays.popups.Popup) Label(javafx.scene.control.Label) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) FormBuilder.addTitledGroupBg(bisq.desktop.util.FormBuilder.addTitledGroupBg) FormBuilder(bisq.desktop.util.FormBuilder) PaymentMethod(bisq.core.payment.payload.PaymentMethod) AccountAgeWitnessService(bisq.core.payment.AccountAgeWitnessService) TimeUnit(java.util.concurrent.TimeUnit) PaymentMethodForm(bisq.desktop.components.paymentmethods.PaymentMethodForm) PaymentAccount(bisq.core.payment.PaymentAccount) InputValidator(bisq.core.util.validation.InputValidator) FormBuilder.add2ButtonsAfterGroup(bisq.desktop.util.FormBuilder.add2ButtonsAfterGroup) CryptoCurrency(bisq.core.locale.CryptoCurrency) ImageUtil(bisq.desktop.util.ImageUtil) AnchorPane(javafx.scene.layout.AnchorPane) ImageView(javafx.scene.image.ImageView) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) UserThread(bisq.common.UserThread) ActivatableViewAndModel(bisq.desktop.common.view.ActivatableViewAndModel) ChangeListener(javafx.beans.value.ChangeListener) CryptoCurrency(bisq.core.locale.CryptoCurrency) TradeCurrency(bisq.core.locale.TradeCurrency) Popup(bisq.desktop.main.overlays.popups.Popup)

Example 42 with TradeCurrency

use of bisq.core.locale.TradeCurrency in project bisq-desktop by bisq-network.

the class BankForm method addFormForAddAccount.

@Override
public void addFormForAddAccount() {
    gridRowFrom = gridRow + 1;
    Tuple3<Label, ComboBox, ComboBox> tuple3 = addLabelComboBoxComboBox(gridPane, ++gridRow, Res.get("payment.country"));
    // noinspection unchecked,unchecked,unchecked
    ComboBox<Region> regionComboBox = tuple3.second;
    regionComboBox.setPromptText(Res.get("payment.select.region"));
    regionComboBox.setConverter(new StringConverter<Region>() {

        @Override
        public String toString(Region region) {
            return region.name;
        }

        @Override
        public Region fromString(String s) {
            return null;
        }
    });
    regionComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllRegions()));
    // noinspection unchecked,unchecked,unchecked
    ComboBox<Country> countryComboBox = tuple3.third;
    countryComboBox.setVisibleRowCount(15);
    countryComboBox.setDisable(true);
    countryComboBox.setPromptText(Res.get("payment.select.country"));
    countryComboBox.setConverter(new StringConverter<Country>() {

        @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();
        if (selectedItem != null) {
            getCountryBasedPaymentAccount().setCountry(selectedItem);
            String countryCode = selectedItem.code;
            TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(countryCode);
            paymentAccount.setSingleTradeCurrency(currency);
            currencyComboBox.setDisable(false);
            currencyComboBox.getSelectionModel().select(currency);
            bankIdLabel.setText(BankUtil.getBankIdLabel(countryCode));
            branchIdLabel.setText(BankUtil.getBranchIdLabel(countryCode));
            accountNrLabel.setText(BankUtil.getAccountNrLabel(countryCode));
            accountTypeLabel.setText(BankUtil.getAccountTypeLabel(countryCode));
            bankNameInputTextField.setText("");
            bankIdInputTextField.setText("");
            branchIdInputTextField.setText("");
            accountNrInputTextField.setText("");
            accountTypeComboBox.getSelectionModel().clearSelection();
            accountTypeComboBox.setItems(FXCollections.observableArrayList(BankUtil.getAccountTypeValues(countryCode)));
            if (BankUtil.useValidation(countryCode) && !validatorsApplied) {
                validatorsApplied = true;
                if (useHolderID)
                    holderIdInputTextField.setValidator(inputValidator);
                bankNameInputTextField.setValidator(inputValidator);
                bankIdInputTextField.setValidator(new BankIdValidator(countryCode));
                branchIdInputTextField.setValidator(new BranchIdValidator(countryCode));
                accountNrInputTextField.setValidator(new AccountNrValidator(countryCode));
            } else {
                validatorsApplied = false;
                if (useHolderID)
                    holderIdInputTextField.setValidator(null);
                bankNameInputTextField.setValidator(null);
                bankIdInputTextField.setValidator(null);
                branchIdInputTextField.setValidator(null);
                accountNrInputTextField.setValidator(null);
            }
            holderNameInputTextField.resetValidation();
            bankNameInputTextField.resetValidation();
            bankIdInputTextField.resetValidation();
            branchIdInputTextField.resetValidation();
            accountNrInputTextField.resetValidation();
            boolean requiresHolderId = BankUtil.isHolderIdRequired(countryCode);
            if (requiresHolderId) {
                holderNameInputTextField.minWidthProperty().unbind();
                holderNameInputTextField.setMinWidth(250);
            } else {
                holderNameInputTextField.minWidthProperty().bind(currencyComboBox.widthProperty());
            }
            if (useHolderID) {
                if (!requiresHolderId)
                    holderIdInputTextField.setText("");
                holderIdInputTextField.resetValidation();
                holderIdInputTextField.setVisible(requiresHolderId);
                holderIdInputTextField.setManaged(requiresHolderId);
                holderIdLabel.setText(BankUtil.getHolderIdLabel(countryCode));
                holderIdLabel.setVisible(requiresHolderId);
                holderIdLabel.setManaged(requiresHolderId);
            }
            boolean bankNameRequired = BankUtil.isBankNameRequired(countryCode);
            bankNameTuple.first.setVisible(bankNameRequired);
            bankNameTuple.first.setManaged(bankNameRequired);
            bankNameInputTextField.setVisible(bankNameRequired);
            bankNameInputTextField.setManaged(bankNameRequired);
            boolean bankIdRequired = BankUtil.isBankIdRequired(countryCode);
            bankIdTuple.first.setVisible(bankIdRequired);
            bankIdTuple.first.setManaged(bankIdRequired);
            bankIdInputTextField.setVisible(bankIdRequired);
            bankIdInputTextField.setManaged(bankIdRequired);
            boolean branchIdRequired = BankUtil.isBranchIdRequired(countryCode);
            branchIdTuple.first.setVisible(branchIdRequired);
            branchIdTuple.first.setManaged(branchIdRequired);
            branchIdInputTextField.setVisible(branchIdRequired);
            branchIdInputTextField.setManaged(branchIdRequired);
            boolean accountNrRequired = BankUtil.isAccountNrRequired(countryCode);
            accountNrTuple.first.setVisible(accountNrRequired);
            accountNrTuple.first.setManaged(accountNrRequired);
            accountNrInputTextField.setVisible(accountNrRequired);
            accountNrInputTextField.setManaged(accountNrRequired);
            boolean accountTypeRequired = BankUtil.isAccountTypeRequired(countryCode);
            accountTypeTuple.first.setVisible(accountTypeRequired);
            accountTypeTuple.first.setManaged(accountTypeRequired);
            accountTypeTuple.second.setVisible(accountTypeRequired);
            accountTypeTuple.second.setManaged(accountTypeRequired);
            updateFromInputs();
            onCountryChanged();
        }
    });
    regionComboBox.setOnAction(e -> {
        Region selectedItem = regionComboBox.getSelectionModel().getSelectedItem();
        if (selectedItem != null) {
            countryComboBox.setDisable(false);
            countryComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllCountriesForRegion(selectedItem)));
        }
    });
    // noinspection unchecked
    currencyComboBox = addLabelComboBox(gridPane, ++gridRow, Res.getWithCol("shared.currency")).second;
    currencyComboBox.setPromptText(Res.get("list.currency.select"));
    currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getAllSortedFiatCurrencies()));
    currencyComboBox.setOnAction(e -> {
        TradeCurrency selectedItem = currencyComboBox.getSelectionModel().getSelectedItem();
        FiatCurrency defaultCurrency = CurrencyUtil.getCurrencyByCountryCode(countryComboBox.getSelectionModel().getSelectedItem().code);
        if (!defaultCurrency.equals(selectedItem)) {
            new Popup<>().warning(Res.get("payment.foreign.currency")).actionButtonText(Res.get("shared.yes")).onAction(() -> {
                paymentAccount.setSingleTradeCurrency(selectedItem);
                autoFillNameTextField();
            }).closeButtonText(Res.get("payment.restore.default")).onClose(() -> currencyComboBox.getSelectionModel().select(defaultCurrency)).show();
        } else {
            paymentAccount.setSingleTradeCurrency(selectedItem);
            autoFillNameTextField();
        }
    });
    currencyComboBox.setConverter(new StringConverter<TradeCurrency>() {

        @Override
        public String toString(TradeCurrency currency) {
            return currency.getNameAndCode();
        }

        @Override
        public TradeCurrency fromString(String string) {
            return null;
        }
    });
    currencyComboBox.setDisable(true);
    addAcceptedBanksForAddAccount();
    addHolderNameAndId();
    bankNameTuple = addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.bank.name"));
    bankNameInputTextField = bankNameTuple.second;
    bankNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        bankAccountPayload.setBankName(newValue);
        updateFromInputs();
    });
    bankIdTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getBankIdLabel(""));
    bankIdLabel = bankIdTuple.first;
    bankIdInputTextField = bankIdTuple.second;
    bankIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        bankAccountPayload.setBankId(newValue);
        updateFromInputs();
    });
    branchIdTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getBranchIdLabel(""));
    branchIdLabel = branchIdTuple.first;
    branchIdInputTextField = branchIdTuple.second;
    branchIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        bankAccountPayload.setBranchId(newValue);
        updateFromInputs();
    });
    accountNrTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getAccountNrLabel(""));
    accountNrLabel = accountNrTuple.first;
    accountNrInputTextField = accountNrTuple.second;
    accountNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        bankAccountPayload.setAccountNr(newValue);
        updateFromInputs();
    });
    accountTypeTuple = addLabelComboBox(gridPane, ++gridRow, "");
    accountTypeLabel = accountTypeTuple.first;
    // noinspection unchecked
    accountTypeComboBox = accountTypeTuple.second;
    accountTypeComboBox.setPromptText(Res.get("payment.select.account"));
    accountTypeComboBox.setOnAction(e -> {
        if (BankUtil.isAccountTypeRequired(bankAccountPayload.getCountryCode())) {
            bankAccountPayload.setAccountType(accountTypeComboBox.getSelectionModel().getSelectedItem());
            updateFromInputs();
        }
    });
    addLimitations();
    addAccountNameTextFieldWithAutoFillCheckBox();
    updateFromInputs();
}
Also used : BankIdValidator(bisq.desktop.util.validation.BankIdValidator) TradeCurrency(bisq.core.locale.TradeCurrency) ComboBox(javafx.scene.control.ComboBox) Label(javafx.scene.control.Label) BranchIdValidator(bisq.desktop.util.validation.BranchIdValidator) Popup(bisq.desktop.main.overlays.popups.Popup) Region(bisq.core.locale.Region) Country(bisq.core.locale.Country) FiatCurrency(bisq.core.locale.FiatCurrency) AccountNrValidator(bisq.desktop.util.validation.AccountNrValidator)

Example 43 with TradeCurrency

use of bisq.core.locale.TradeCurrency in project bisq-desktop by bisq-network.

the class CashAppForm method addFormForAddAccount.

@Override
public void addFormForAddAccount() {
    gridRowFrom = gridRow + 1;
    accountIdInputTextField = addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.cashApp.cashTag")).second;
    accountIdInputTextField.setValidator(validator);
    accountIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        account.setCashTag(newValue);
        updateFromInputs();
    });
    final TradeCurrency singleTradeCurrency = account.getSingleTradeCurrency();
    final String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "";
    addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.currency"), nameAndCode);
    addLimitations();
    addAccountNameTextFieldWithAutoFillCheckBox();
}
Also used : TradeCurrency(bisq.core.locale.TradeCurrency)

Example 44 with TradeCurrency

use of bisq.core.locale.TradeCurrency in project bisq-desktop by bisq-network.

the class CashDepositForm method addFormForAddAccount.

@Override
public void addFormForAddAccount() {
    gridRowFrom = gridRow + 1;
    Tuple3<Label, ComboBox, ComboBox> tuple3 = FormBuilder.addLabelComboBoxComboBox(gridPane, ++gridRow, Res.get("payment.country"));
    // noinspection unchecked,unchecked,unchecked
    ComboBox<Region> regionComboBox = tuple3.second;
    regionComboBox.setPromptText(Res.get("payment.select.region"));
    regionComboBox.setConverter(new StringConverter<Region>() {

        @Override
        public String toString(Region region) {
            return region.name;
        }

        @Override
        public Region fromString(String s) {
            return null;
        }
    });
    regionComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllRegions()));
    // noinspection unchecked,unchecked,unchecked
    ComboBox<Country> countryComboBox = tuple3.third;
    countryComboBox.setVisibleRowCount(15);
    countryComboBox.setDisable(true);
    countryComboBox.setPromptText(Res.get("payment.select.country"));
    countryComboBox.setConverter(new StringConverter<Country>() {

        @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();
        if (selectedItem != null) {
            getCountryBasedPaymentAccount().setCountry(selectedItem);
            String countryCode = selectedItem.code;
            TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(countryCode);
            paymentAccount.setSingleTradeCurrency(currency);
            currencyComboBox.setDisable(false);
            currencyComboBox.getSelectionModel().select(currency);
            bankIdLabel.setText(BankUtil.getBankIdLabel(countryCode));
            branchIdLabel.setText(BankUtil.getBranchIdLabel(countryCode));
            accountNrLabel.setText(BankUtil.getAccountNrLabel(countryCode));
            accountTypeLabel.setText(BankUtil.getAccountTypeLabel(countryCode));
            bankNameInputTextField.setText("");
            bankIdInputTextField.setText("");
            branchIdInputTextField.setText("");
            accountNrInputTextField.setText("");
            accountTypeComboBox.getSelectionModel().clearSelection();
            accountTypeComboBox.setItems(FXCollections.observableArrayList(BankUtil.getAccountTypeValues(countryCode)));
            if (BankUtil.useValidation(countryCode) && !validatorsApplied) {
                validatorsApplied = true;
                if (useHolderID)
                    holderIdInputTextField.setValidator(inputValidator);
                bankNameInputTextField.setValidator(inputValidator);
                bankIdInputTextField.setValidator(new BankIdValidator(countryCode));
                branchIdInputTextField.setValidator(new BranchIdValidator(countryCode));
                accountNrInputTextField.setValidator(new AccountNrValidator(countryCode));
            } else {
                validatorsApplied = false;
                if (useHolderID)
                    holderIdInputTextField.setValidator(null);
                bankNameInputTextField.setValidator(null);
                bankIdInputTextField.setValidator(null);
                branchIdInputTextField.setValidator(null);
                accountNrInputTextField.setValidator(null);
            }
            holderNameInputTextField.resetValidation();
            emailInputTextField.resetValidation();
            bankNameInputTextField.resetValidation();
            bankIdInputTextField.resetValidation();
            branchIdInputTextField.resetValidation();
            accountNrInputTextField.resetValidation();
            boolean requiresHolderId = BankUtil.isHolderIdRequired(countryCode);
            if (requiresHolderId) {
                holderNameInputTextField.minWidthProperty().unbind();
                holderNameInputTextField.setMinWidth(300);
            } else {
                holderNameInputTextField.minWidthProperty().bind(currencyComboBox.widthProperty());
            }
            if (useHolderID) {
                if (!requiresHolderId)
                    holderIdInputTextField.setText("");
                holderIdInputTextField.resetValidation();
                holderIdInputTextField.setVisible(requiresHolderId);
                holderIdInputTextField.setManaged(requiresHolderId);
                holderIdLabel.setText(BankUtil.getHolderIdLabel(countryCode));
                holderIdLabel.setVisible(requiresHolderId);
                holderIdLabel.setManaged(requiresHolderId);
            }
            boolean bankNameRequired = BankUtil.isBankNameRequired(countryCode);
            bankNameTuple.first.setVisible(bankNameRequired);
            bankNameTuple.first.setManaged(bankNameRequired);
            bankNameInputTextField.setVisible(bankNameRequired);
            bankNameInputTextField.setManaged(bankNameRequired);
            boolean bankIdRequired = BankUtil.isBankIdRequired(countryCode);
            bankIdTuple.first.setVisible(bankIdRequired);
            bankIdTuple.first.setManaged(bankIdRequired);
            bankIdInputTextField.setVisible(bankIdRequired);
            bankIdInputTextField.setManaged(bankIdRequired);
            boolean branchIdRequired = BankUtil.isBranchIdRequired(countryCode);
            branchIdTuple.first.setVisible(branchIdRequired);
            branchIdTuple.first.setManaged(branchIdRequired);
            branchIdInputTextField.setVisible(branchIdRequired);
            branchIdInputTextField.setManaged(branchIdRequired);
            boolean accountNrRequired = BankUtil.isAccountNrRequired(countryCode);
            accountNrTuple.first.setVisible(accountNrRequired);
            accountNrTuple.first.setManaged(accountNrRequired);
            accountNrInputTextField.setVisible(accountNrRequired);
            accountNrInputTextField.setManaged(accountNrRequired);
            boolean accountTypeRequired = BankUtil.isAccountTypeRequired(countryCode);
            accountTypeTuple.first.setVisible(accountTypeRequired);
            accountTypeTuple.first.setManaged(accountTypeRequired);
            accountTypeTuple.second.setVisible(accountTypeRequired);
            accountTypeTuple.second.setManaged(accountTypeRequired);
            updateFromInputs();
            onCountryChanged();
        }
    });
    regionComboBox.setOnAction(e -> {
        Region selectedItem = regionComboBox.getSelectionModel().getSelectedItem();
        if (selectedItem != null) {
            countryComboBox.setDisable(false);
            countryComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllCountriesForRegion(selectedItem)));
        }
    });
    // noinspection unchecked
    currencyComboBox = FormBuilder.addLabelComboBox(gridPane, ++gridRow, Res.getWithCol("shared.currency")).second;
    currencyComboBox.setPromptText(Res.get("list.currency.select"));
    currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getAllSortedFiatCurrencies()));
    currencyComboBox.setOnAction(e -> {
        TradeCurrency selectedItem = currencyComboBox.getSelectionModel().getSelectedItem();
        FiatCurrency defaultCurrency = CurrencyUtil.getCurrencyByCountryCode(countryComboBox.getSelectionModel().getSelectedItem().code);
        if (!defaultCurrency.equals(selectedItem)) {
            new Popup<>().warning(Res.get("payment.foreign.currency")).actionButtonText(Res.get("shared.yes")).onAction(() -> {
                paymentAccount.setSingleTradeCurrency(selectedItem);
                autoFillNameTextField();
            }).closeButtonText(Res.get("payment.restore.default")).onClose(() -> currencyComboBox.getSelectionModel().select(defaultCurrency)).show();
        } else {
            paymentAccount.setSingleTradeCurrency(selectedItem);
            autoFillNameTextField();
        }
    });
    currencyComboBox.setConverter(new StringConverter<TradeCurrency>() {

        @Override
        public String toString(TradeCurrency currency) {
            return currency.getNameAndCode();
        }

        @Override
        public TradeCurrency fromString(String string) {
            return null;
        }
    });
    currencyComboBox.setDisable(true);
    addAcceptedBanksForAddAccount();
    addHolderNameAndId();
    bankNameTuple = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.bank.name"));
    bankNameInputTextField = bankNameTuple.second;
    bankNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        cashDepositAccountPayload.setBankName(newValue);
        updateFromInputs();
    });
    bankIdTuple = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, BankUtil.getBankIdLabel(""));
    bankIdLabel = bankIdTuple.first;
    bankIdInputTextField = bankIdTuple.second;
    bankIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        cashDepositAccountPayload.setBankId(newValue);
        updateFromInputs();
    });
    branchIdTuple = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, BankUtil.getBranchIdLabel(""));
    branchIdLabel = branchIdTuple.first;
    branchIdInputTextField = branchIdTuple.second;
    branchIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        cashDepositAccountPayload.setBranchId(newValue);
        updateFromInputs();
    });
    accountNrTuple = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, BankUtil.getAccountNrLabel(""));
    accountNrLabel = accountNrTuple.first;
    accountNrInputTextField = accountNrTuple.second;
    accountNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        cashDepositAccountPayload.setAccountNr(newValue);
        updateFromInputs();
    });
    accountTypeTuple = FormBuilder.addLabelComboBox(gridPane, ++gridRow, "");
    accountTypeLabel = accountTypeTuple.first;
    // noinspection unchecked
    accountTypeComboBox = accountTypeTuple.second;
    accountTypeComboBox.setPromptText(Res.get("payment.select.account"));
    accountTypeComboBox.setOnAction(e -> {
        if (BankUtil.isAccountTypeRequired(cashDepositAccountPayload.getCountryCode())) {
            cashDepositAccountPayload.setAccountType(accountTypeComboBox.getSelectionModel().getSelectedItem());
            updateFromInputs();
        }
    });
    TextArea requirementsTextArea = FormBuilder.addLabelTextArea(gridPane, ++gridRow, Res.get("payment.extras"), "").second;
    requirementsTextArea.setMinHeight(30);
    requirementsTextArea.setMaxHeight(30);
    requirementsTextArea.textProperty().addListener((ov, oldValue, newValue) -> {
        cashDepositAccountPayload.setRequirements(newValue);
        updateFromInputs();
    });
    addLimitations();
    addAccountNameTextFieldWithAutoFillCheckBox();
    updateFromInputs();
}
Also used : BankIdValidator(bisq.desktop.util.validation.BankIdValidator) TradeCurrency(bisq.core.locale.TradeCurrency) TextArea(javafx.scene.control.TextArea) ComboBox(javafx.scene.control.ComboBox) Label(javafx.scene.control.Label) BranchIdValidator(bisq.desktop.util.validation.BranchIdValidator) Popup(bisq.desktop.main.overlays.popups.Popup) Region(bisq.core.locale.Region) Country(bisq.core.locale.Country) FiatCurrency(bisq.core.locale.FiatCurrency) AccountNrValidator(bisq.desktop.util.validation.AccountNrValidator)

Example 45 with TradeCurrency

use of bisq.core.locale.TradeCurrency in project bisq-desktop by bisq-network.

the class ChaseQuickPayForm method addFormForAddAccount.

@Override
public void addFormForAddAccount() {
    gridRowFrom = gridRow + 1;
    InputTextField holderNameInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.owner")).second;
    holderNameInputTextField.setValidator(inputValidator);
    holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        chaseQuickPayAccount.setHolderName(newValue);
        updateFromInputs();
    });
    mobileNrInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.email")).second;
    mobileNrInputTextField.setValidator(chaseQuickPayValidator);
    mobileNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        chaseQuickPayAccount.setEmail(newValue);
        updateFromInputs();
    });
    TradeCurrency singleTradeCurrency = chaseQuickPayAccount.getSingleTradeCurrency();
    String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null";
    FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.currency"), nameAndCode);
    addLimitations();
    addAccountNameTextFieldWithAutoFillCheckBox();
}
Also used : TradeCurrency(bisq.core.locale.TradeCurrency) InputTextField(bisq.desktop.components.InputTextField)

Aggregations

TradeCurrency (bisq.core.locale.TradeCurrency)57 InputTextField (bisq.desktop.components.InputTextField)26 TextField (javafx.scene.control.TextField)16 FormBuilder.addLabelInputTextField (bisq.desktop.util.FormBuilder.addLabelInputTextField)13 FiatCurrency (bisq.core.locale.FiatCurrency)11 Country (bisq.core.locale.Country)10 FormBuilder.addLabelTextField (bisq.desktop.util.FormBuilder.addLabelTextField)9 CryptoCurrency (bisq.core.locale.CryptoCurrency)8 PaymentAccount (bisq.core.payment.PaymentAccount)7 ComboBox (javafx.scene.control.ComboBox)6 Label (javafx.scene.control.Label)6 CryptoCurrencyAccount (bisq.core.payment.CryptoCurrencyAccount)5 Popup (bisq.desktop.main.overlays.popups.Popup)5 List (java.util.List)5 Tuple2 (bisq.common.util.Tuple2)4 CurrencyUtil (bisq.core.locale.CurrencyUtil)4 OpenOfferManager (bisq.core.offer.OpenOfferManager)4 AccountAgeWitnessService (bisq.core.payment.AccountAgeWitnessService)4 TradeManager (bisq.core.trade.TradeManager)4 User (bisq.core.user.User)4