Search in sources :

Example 36 with TradeCurrency

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

the class CreateOfferView method addPaymentGroup.

private void addPaymentGroup() {
    TitledGroupBg titledGroupBg = addTitledGroupBg(gridPane, gridRow, 2, Res.get("shared.selectTradingAccount"));
    GridPane.setColumnSpan(titledGroupBg, 3);
    // noinspection unchecked
    paymentAccountsComboBox = addLabelComboBox(gridPane, gridRow, Res.getWithCol("shared.tradingAccount"), Layout.FIRST_ROW_DISTANCE).second;
    paymentAccountsComboBox.setPromptText(Res.get("shared.selectTradingAccount"));
    paymentAccountsComboBox.setMinWidth(300);
    editOfferElements.add(paymentAccountsComboBox);
    // we display either currencyComboBox (multi currency account) or currencyTextField (single)
    Tuple2<Label, ComboBox> currencyComboBoxTuple = addLabelComboBox(gridPane, ++gridRow, Res.getWithCol("shared.currency"));
    currencyComboBoxLabel = currencyComboBoxTuple.first;
    editOfferElements.add(currencyComboBoxLabel);
    // noinspection unchecked
    currencyComboBox = currencyComboBoxTuple.second;
    editOfferElements.add(currencyComboBox);
    currencyComboBox.setPromptText(Res.get("list.currency.select"));
    currencyComboBox.setConverter(new StringConverter<TradeCurrency>() {

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

        @Override
        public TradeCurrency fromString(String s) {
            return null;
        }
    });
    Tuple2<Label, TextField> currencyTextFieldTuple = addLabelTextField(gridPane, gridRow, Res.getWithCol("shared.currency"), "", 5);
    currencyTextFieldLabel = currencyTextFieldTuple.first;
    editOfferElements.add(currencyTextFieldLabel);
    currencyTextField = currencyTextFieldTuple.second;
    editOfferElements.add(currencyTextField);
}
Also used : TradeCurrency(bisq.core.locale.TradeCurrency) ComboBox(javafx.scene.control.ComboBox) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Label(javafx.scene.control.Label) BalanceTextField(bisq.desktop.components.BalanceTextField) InputTextField(bisq.desktop.components.InputTextField) InfoInputTextField(bisq.desktop.components.InfoInputTextField) TextField(javafx.scene.control.TextField) FundsTextField(bisq.desktop.components.FundsTextField) AddressTextField(bisq.desktop.components.AddressTextField) TitledGroupBg(bisq.desktop.components.TitledGroupBg)

Example 37 with TradeCurrency

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

the class SwishForm method addFormForAddAccount.

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

Example 38 with TradeCurrency

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

the class VenmoForm method addFormForDisplayAccount.

@Override
public void addFormForDisplayAccount() {
    gridRowFrom = gridRow;
    addLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), account.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
    addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.paymentMethod"), Res.get(account.getPaymentMethod().getId()));
    addLabelTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.owner"), account.getHolderName());
    TextField field = addLabelTextField(gridPane, ++gridRow, Res.get("payment.venmo.venmoUserName"), account.getVenmoUserName()).second;
    field.setMouseTransparent(false);
    final TradeCurrency singleTradeCurrency = account.getSingleTradeCurrency();
    final String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "";
    addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.currency"), nameAndCode);
    addLimitations();
}
Also used : TradeCurrency(bisq.core.locale.TradeCurrency) TextField(javafx.scene.control.TextField) FormBuilder.addLabelInputTextField(bisq.desktop.util.FormBuilder.addLabelInputTextField) FormBuilder.addLabelTextField(bisq.desktop.util.FormBuilder.addLabelTextField) InputTextField(bisq.desktop.components.InputTextField)

Example 39 with TradeCurrency

use of bisq.core.locale.TradeCurrency 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 40 with TradeCurrency

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

the class WesternUnionForm method addFormForDisplayAccount.

@Override
public void addFormForDisplayAccount() {
    gridRowFrom = gridRow;
    String countryCode = westernUnionAccountPayload.getCountryCode();
    FormBuilder.addLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), paymentAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
    FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.paymentMethod"), Res.get(paymentAccount.getPaymentMethod().getId()));
    FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.get("payment.country"), getCountryBasedPaymentAccount().getCountry() != null ? getCountryBasedPaymentAccount().getCountry().name : "");
    TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency();
    String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null";
    FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.currency"), nameAndCode);
    FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.fullName"), westernUnionAccountPayload.getHolderName());
    FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.get("payment.account.city"), westernUnionAccountPayload.getCity()).second.setMouseTransparent(false);
    if (BankUtil.isStateRequired(westernUnionAccountPayload.getCountryCode()))
        FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.get("payment.account.state"), westernUnionAccountPayload.getState()).second.setMouseTransparent(false);
    FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.get("payment.email"), westernUnionAccountPayload.getEmail());
    addLimitations();
}
Also used : TradeCurrency(bisq.core.locale.TradeCurrency)

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