Search in sources :

Example 26 with InputTextField

use of bisq.desktop.components.InputTextField in project bisq-desktop by bisq-network.

the class WesternUnionForm 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);
            updateFromInputs();
            applyIsStateRequired();
            cityInputTextField.setText("");
            stateInputTextField.setText("");
        }
    });
    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);
    holderNameInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.fullName")).second;
    holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        westernUnionAccountPayload.setHolderName(newValue);
        updateFromInputs();
    });
    holderNameInputTextField.setValidator(inputValidator);
    cityInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.account.city")).second;
    cityInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        westernUnionAccountPayload.setCity(newValue);
        updateFromInputs();
    });
    final Tuple2<Label, InputTextField> tuple2 = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.account.state"));
    stateLabel = tuple2.first;
    stateInputTextField = tuple2.second;
    stateInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        westernUnionAccountPayload.setState(newValue);
        updateFromInputs();
    });
    applyIsStateRequired();
    emailInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.email")).second;
    emailInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        westernUnionAccountPayload.setEmail(newValue);
        updateFromInputs();
    });
    emailInputTextField.setValidator(emailValidator);
    addLimitations();
    addAccountNameTextFieldWithAutoFillCheckBox();
    updateFromInputs();
}
Also used : TradeCurrency(bisq.core.locale.TradeCurrency) ComboBox(javafx.scene.control.ComboBox) InputTextField(bisq.desktop.components.InputTextField) Label(javafx.scene.control.Label) Popup(bisq.desktop.main.overlays.popups.Popup) Region(bisq.core.locale.Region) Country(bisq.core.locale.Country) FiatCurrency(bisq.core.locale.FiatCurrency)

Example 27 with InputTextField

use of bisq.desktop.components.InputTextField 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)

Example 28 with InputTextField

use of bisq.desktop.components.InputTextField in project bisq-desktop by bisq-network.

the class InteracETransferForm 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) -> {
        interacETransferAccount.setHolderName(newValue);
        updateFromInputs();
    });
    mobileNrInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.emailOrMobile")).second;
    mobileNrInputTextField.setValidator(interacETransferValidator);
    mobileNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        interacETransferAccount.setEmail(newValue);
        updateFromInputs();
    });
    InputTextField questionInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.secret")).second;
    questionInputTextField.setValidator(inputValidator);
    questionInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        interacETransferAccount.setQuestion(newValue);
        updateFromInputs();
    });
    InputTextField answerInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.answer")).second;
    answerInputTextField.setValidator(inputValidator);
    answerInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        interacETransferAccount.setAnswer(newValue);
        updateFromInputs();
    });
    TradeCurrency singleTradeCurrency = interacETransferAccount.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)

Example 29 with InputTextField

use of bisq.desktop.components.InputTextField in project bisq-desktop by bisq-network.

the class SepaForm 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) -> {
        sepaAccount.setHolderName(newValue);
        updateFromInputs();
    });
    ibanInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, "IBAN:").second;
    ibanInputTextField.setValidator(ibanValidator);
    ibanInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        sepaAccount.setIban(newValue);
        updateFromInputs();
    });
    InputTextField bicInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, "BIC:").second;
    bicInputTextField.setValidator(bicValidator);
    bicInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        sepaAccount.setBic(newValue);
        updateFromInputs();
    });
    FormBuilder.addLabel(gridPane, ++gridRow, Res.getWithCol("payment.bank.country"));
    HBox hBox = new HBox();
    hBox.setSpacing(10);
    ComboBox<Country> countryComboBox = new ComboBox<>();
    currencyComboBox = new ComboBox<>();
    currencyTextField = new TextField("");
    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);
    GridPane.setRowIndex(hBox, gridRow);
    GridPane.setColumnIndex(hBox, 1);
    gridPane.getChildren().add(hBox);
    countryComboBox.setPromptText(Res.get("payment.select.bank.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();
        sepaAccount.setCountry(selectedItem);
        TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(selectedItem.code);
        setupCurrency(selectedItem, currency);
        updateCountriesSelection(true, euroCountryCheckBoxes);
        updateCountriesSelection(true, nonEuroCountryCheckBoxes);
        updateFromInputs();
    });
    addEuroCountriesGrid(true);
    addNonEuroCountriesGrid(true);
    addLimitations();
    addAccountNameTextFieldWithAutoFillCheckBox();
    countryComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllSepaCountries()));
    Country country = CountryUtil.getDefaultCountry();
    if (CountryUtil.getAllSepaCountries().contains(country)) {
        countryComboBox.getSelectionModel().select(country);
        sepaAccount.setCountry(country);
        TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(country.code);
        setupCurrency(country, currency);
    }
    updateFromInputs();
}
Also used : HBox(javafx.scene.layout.HBox) TradeCurrency(bisq.core.locale.TradeCurrency) InputTextField(bisq.desktop.components.InputTextField) ComboBox(javafx.scene.control.ComboBox) Country(bisq.core.locale.Country) InputTextField(bisq.desktop.components.InputTextField) TextField(javafx.scene.control.TextField)

Example 30 with InputTextField

use of bisq.desktop.components.InputTextField in project bisq-desktop by bisq-network.

the class FormBuilder method getEditableValueCurrencyBoxWithInfo.

public static Tuple3<HBox, InfoInputTextField, Label> getEditableValueCurrencyBoxWithInfo(String promptText) {
    InfoInputTextField infoInputTextField = new InfoInputTextField();
    InputTextField input = infoInputTextField.getTextField();
    input.setPrefWidth(170);
    input.setAlignment(Pos.CENTER_RIGHT);
    input.setId("text-input-with-currency-text-field");
    input.setPromptText(promptText);
    Label currency = new AutoTooltipLabel(Res.getBaseCurrencyCode());
    currency.setId("currency-info-label");
    HBox box = new HBox();
    box.getChildren().addAll(infoInputTextField, currency);
    return new Tuple3<>(box, infoInputTextField, currency);
}
Also used : HBox(javafx.scene.layout.HBox) InputTextField(bisq.desktop.components.InputTextField) InfoInputTextField(bisq.desktop.components.InfoInputTextField) Tuple3(bisq.common.util.Tuple3) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Label(javafx.scene.control.Label) InfoInputTextField(bisq.desktop.components.InfoInputTextField) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel)

Aggregations

InputTextField (bisq.desktop.components.InputTextField)35 Label (javafx.scene.control.Label)23 HBox (javafx.scene.layout.HBox)19 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)17 Insets (javafx.geometry.Insets)15 TradeCurrency (bisq.core.locale.TradeCurrency)11 InfoInputTextField (bisq.desktop.components.InfoInputTextField)11 FormBuilder.addLabelInputTextField (bisq.desktop.util.FormBuilder.addLabelInputTextField)11 Popup (bisq.desktop.main.overlays.popups.Popup)8 Tuple3 (bisq.common.util.Tuple3)6 AutoTooltipButton (bisq.desktop.components.AutoTooltipButton)6 Button (javafx.scene.control.Button)5 TextField (javafx.scene.control.TextField)5 CheckBox (javafx.scene.control.CheckBox)4 Country (bisq.core.locale.Country)3 AddressTextField (bisq.desktop.components.AddressTextField)3 VBox (javafx.scene.layout.VBox)3 BalanceTextField (bisq.desktop.components.BalanceTextField)2 FundsTextField (bisq.desktop.components.FundsTextField)2 TitledGroupBg (bisq.desktop.components.TitledGroupBg)2