Search in sources :

Example 21 with TradeCurrency

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

the class PopmoneyForm 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) -> {
        account.setHolderName(newValue);
        updateFromInputs();
    });
    accountIdInputTextField = addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.popmoney.accountId")).second;
    accountIdInputTextField.setValidator(validator);
    accountIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        account.setAccountId(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) FormBuilder.addLabelInputTextField(bisq.desktop.util.FormBuilder.addLabelInputTextField) InputTextField(bisq.desktop.components.InputTextField)

Example 22 with TradeCurrency

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

the class PopmoneyForm 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.popmoney.accountId"), account.getAccountId()).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 23 with TradeCurrency

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

the class SepaForm method updateCountriesSelection.

private void updateCountriesSelection(boolean isEditable, List<CheckBox> checkBoxList) {
    checkBoxList.stream().forEach(checkBox -> {
        String countryCode = (String) checkBox.getUserData();
        TradeCurrency selectedCurrency = sepaAccount.getSelectedTradeCurrency();
        if (selectedCurrency == null) {
            Country country = CountryUtil.getDefaultCountry();
            if (CountryUtil.getAllSepaCountries().contains(country))
                selectedCurrency = CurrencyUtil.getCurrencyByCountryCode(country.code);
        }
        boolean selected;
        if (isEditable && selectedCurrency != null) {
            selected = true;
            sepaAccount.addAcceptedCountry(countryCode);
        } else {
            selected = sepaAccount.getAcceptedCountryCodes().contains(countryCode);
        }
        checkBox.setSelected(selected);
    });
}
Also used : TradeCurrency(bisq.core.locale.TradeCurrency) Country(bisq.core.locale.Country)

Example 24 with TradeCurrency

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

the class SepaForm method addFormForDisplayAccount.

@Override
public void addFormForDisplayAccount() {
    gridRowFrom = gridRow;
    FormBuilder.addLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), sepaAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
    FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.paymentMethod"), Res.get(sepaAccount.getPaymentMethod().getId()));
    FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.owner"), sepaAccount.getHolderName());
    FormBuilder.addLabelTextField(gridPane, ++gridRow, "IBAN:", sepaAccount.getIban()).second.setMouseTransparent(false);
    FormBuilder.addLabelTextField(gridPane, ++gridRow, "BIC:", sepaAccount.getBic()).second.setMouseTransparent(false);
    FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.get("payment.bank.country"), sepaAccount.getCountry() != null ? sepaAccount.getCountry().name : "");
    TradeCurrency singleTradeCurrency = sepaAccount.getSingleTradeCurrency();
    String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null";
    FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.currency"), nameAndCode);
    String countries;
    Tooltip tooltip = null;
    if (CountryUtil.containsAllSepaEuroCountries(sepaAccount.getAcceptedCountryCodes())) {
        countries = Res.getWithCol("shared.allEuroCountries");
    } else {
        countries = CountryUtil.getCodesString(sepaAccount.getAcceptedCountryCodes());
        tooltip = new Tooltip(CountryUtil.getNamesByCodesString(sepaAccount.getAcceptedCountryCodes()));
    }
    TextField acceptedCountries = FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.get("payment.accepted.countries"), countries).second;
    if (tooltip != null) {
        acceptedCountries.setMouseTransparent(false);
        acceptedCountries.setTooltip(tooltip);
    }
    addLimitations();
}
Also used : TradeCurrency(bisq.core.locale.TradeCurrency) Tooltip(javafx.scene.control.Tooltip) InputTextField(bisq.desktop.components.InputTextField) TextField(javafx.scene.control.TextField)

Example 25 with TradeCurrency

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

the class SepaInstantForm 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) -> {
        sepaInstantAccount.setHolderName(newValue);
        updateFromInputs();
    });
    ibanInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, "IBAN:").second;
    ibanInputTextField.setValidator(ibanValidator);
    ibanInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        sepaInstantAccount.setIban(newValue);
        updateFromInputs();
    });
    InputTextField bicInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, "BIC:").second;
    bicInputTextField.setValidator(bicValidator);
    bicInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        sepaInstantAccount.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();
        sepaInstantAccount.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.getAllSepaInstantCountries()));
    Country country = CountryUtil.getDefaultCountry();
    if (CountryUtil.getAllSepaInstantCountries().contains(country)) {
        countryComboBox.getSelectionModel().select(country);
        sepaInstantAccount.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)

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