Search in sources :

Example 6 with TradeCurrency

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

the class VenmoForm 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.venmo.venmoUserName")).second;
    accountIdInputTextField.setValidator(validator);
    accountIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        account.setVenmoUserName(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 7 with TradeCurrency

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

the class FiatAccountsDataModel method onSaveNewAccount.

// /////////////////////////////////////////////////////////////////////////////////////////
// UI actions
// /////////////////////////////////////////////////////////////////////////////////////////
public void onSaveNewAccount(PaymentAccount paymentAccount) {
    user.addPaymentAccount(paymentAccount);
    TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency();
    List<TradeCurrency> tradeCurrencies = paymentAccount.getTradeCurrencies();
    if (singleTradeCurrency != null) {
        if (singleTradeCurrency instanceof FiatCurrency)
            preferences.addFiatCurrency((FiatCurrency) singleTradeCurrency);
        else
            preferences.addCryptoCurrency((CryptoCurrency) singleTradeCurrency);
    } else if (tradeCurrencies != null && !tradeCurrencies.isEmpty()) {
        if (tradeCurrencies.contains(CurrencyUtil.getDefaultTradeCurrency()))
            paymentAccount.setSelectedTradeCurrency(CurrencyUtil.getDefaultTradeCurrency());
        else
            paymentAccount.setSelectedTradeCurrency(tradeCurrencies.get(0));
        tradeCurrencies.forEach(tradeCurrency -> {
            if (tradeCurrency instanceof FiatCurrency)
                preferences.addFiatCurrency((FiatCurrency) tradeCurrency);
            else
                preferences.addCryptoCurrency((CryptoCurrency) tradeCurrency);
        });
    }
    accountAgeWitnessService.publishMyAccountAgeWitness(paymentAccount.getPaymentAccountPayload());
}
Also used : GUIUtil(bisq.desktop.util.GUIUtil) TradeCurrency(bisq.core.locale.TradeCurrency) CryptoCurrencyAccount(bisq.core.payment.CryptoCurrencyAccount) ActivatableDataModel(bisq.desktop.common.model.ActivatableDataModel) Inject(com.google.inject.Inject) SetChangeListener(javafx.collections.SetChangeListener) FXCollections(javafx.collections.FXCollections) FiatCurrency(bisq.core.locale.FiatCurrency) PaymentMethod(bisq.core.payment.payload.PaymentMethod) Collectors(java.util.stream.Collectors) OpenOfferManager(bisq.core.offer.OpenOfferManager) AccountAgeWitnessService(bisq.core.payment.AccountAgeWitnessService) User(bisq.core.user.User) PersistenceProtoResolver(bisq.common.proto.persistable.PersistenceProtoResolver) ArrayList(java.util.ArrayList) PaymentAccount(bisq.core.payment.PaymentAccount) List(java.util.List) CryptoCurrency(bisq.core.locale.CryptoCurrency) Stage(javafx.stage.Stage) TradeManager(bisq.core.trade.TradeManager) Preferences(bisq.core.user.Preferences) CurrencyUtil(bisq.core.locale.CurrencyUtil) ObservableList(javafx.collections.ObservableList) CryptoCurrency(bisq.core.locale.CryptoCurrency) TradeCurrency(bisq.core.locale.TradeCurrency) FiatCurrency(bisq.core.locale.FiatCurrency)

Example 8 with TradeCurrency

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

the class AltCoinAccountsDataModel method onSaveNewAccount.

// /////////////////////////////////////////////////////////////////////////////////////////
// UI actions
// /////////////////////////////////////////////////////////////////////////////////////////
public void onSaveNewAccount(PaymentAccount paymentAccount) {
    user.addPaymentAccount(paymentAccount);
    TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency();
    List<TradeCurrency> tradeCurrencies = paymentAccount.getTradeCurrencies();
    if (singleTradeCurrency != null) {
        if (singleTradeCurrency instanceof FiatCurrency)
            preferences.addFiatCurrency((FiatCurrency) singleTradeCurrency);
        else
            preferences.addCryptoCurrency((CryptoCurrency) singleTradeCurrency);
    } else if (tradeCurrencies != null && !tradeCurrencies.isEmpty()) {
        tradeCurrencies.stream().forEach(tradeCurrency -> {
            if (tradeCurrency instanceof FiatCurrency)
                preferences.addFiatCurrency((FiatCurrency) tradeCurrency);
            else
                preferences.addCryptoCurrency((CryptoCurrency) tradeCurrency);
        });
    }
    if (!(paymentAccount instanceof CryptoCurrencyAccount))
        accountAgeWitnessService.publishMyAccountAgeWitness(paymentAccount.getPaymentAccountPayload());
}
Also used : GUIUtil(bisq.desktop.util.GUIUtil) TradeCurrency(bisq.core.locale.TradeCurrency) CryptoCurrencyAccount(bisq.core.payment.CryptoCurrencyAccount) ActivatableDataModel(bisq.desktop.common.model.ActivatableDataModel) Inject(com.google.inject.Inject) SetChangeListener(javafx.collections.SetChangeListener) FXCollections(javafx.collections.FXCollections) FiatCurrency(bisq.core.locale.FiatCurrency) PaymentMethod(bisq.core.payment.payload.PaymentMethod) Collectors(java.util.stream.Collectors) OpenOfferManager(bisq.core.offer.OpenOfferManager) AccountAgeWitnessService(bisq.core.payment.AccountAgeWitnessService) User(bisq.core.user.User) PersistenceProtoResolver(bisq.common.proto.persistable.PersistenceProtoResolver) ArrayList(java.util.ArrayList) PaymentAccount(bisq.core.payment.PaymentAccount) List(java.util.List) CryptoCurrency(bisq.core.locale.CryptoCurrency) Stage(javafx.stage.Stage) TradeManager(bisq.core.trade.TradeManager) Preferences(bisq.core.user.Preferences) ObservableList(javafx.collections.ObservableList) CryptoCurrency(bisq.core.locale.CryptoCurrency) TradeCurrency(bisq.core.locale.TradeCurrency) FiatCurrency(bisq.core.locale.FiatCurrency) CryptoCurrencyAccount(bisq.core.payment.CryptoCurrencyAccount)

Example 9 with TradeCurrency

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

the class AliPayForm method addFormForDisplayAccount.

@Override
public void addFormForDisplayAccount() {
    gridRowFrom = gridRow;
    addLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), aliPayAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
    addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.paymentMethod"), Res.get(aliPayAccount.getPaymentMethod().getId()));
    TextField field = addLabelTextField(gridPane, ++gridRow, Res.get("payment.account.no"), aliPayAccount.getAccountNr()).second;
    field.setMouseTransparent(false);
    final TradeCurrency singleTradeCurrency = aliPayAccount.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 10 with TradeCurrency

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

the class AliPayForm method addFormForAddAccount.

@Override
public void addFormForAddAccount() {
    gridRowFrom = gridRow + 1;
    accountNrInputTextField = addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.account.no")).second;
    accountNrInputTextField.setValidator(aliPayValidator);
    accountNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        aliPayAccount.setAccountNr(newValue);
        updateFromInputs();
    });
    final TradeCurrency singleTradeCurrency = aliPayAccount.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)

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