Search in sources :

Example 1 with TradeCurrency

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

the class CurrencyList method getPartitionedSortedItems.

private List<CurrencyListItem> getPartitionedSortedItems(List<TradeCurrency> currencies) {
    Map<TradeCurrency, Integer> tradesPerCurrency = countTrades(currencies);
    Comparator<CurrencyListItem> comparator = getComparator();
    Queue<CurrencyListItem> fiatCurrencies = new PriorityQueue<>(comparator);
    Queue<CurrencyListItem> cryptoCurrencies = new PriorityQueue<>(comparator);
    for (Map.Entry<TradeCurrency, Integer> entry : tradesPerCurrency.entrySet()) {
        TradeCurrency currency = entry.getKey();
        Integer count = entry.getValue();
        CurrencyListItem item = new CurrencyListItem(currency, count);
        if (predicates.isFiatCurrency(currency)) {
            fiatCurrencies.add(item);
        }
        if (predicates.isCryptoCurrency(currency)) {
            cryptoCurrencies.add(item);
        }
    }
    List<CurrencyListItem> result = Lists.newLinkedList();
    result.addAll(fiatCurrencies);
    result.addAll(cryptoCurrencies);
    return result;
}
Also used : TradeCurrency(bisq.core.locale.TradeCurrency) PriorityQueue(java.util.PriorityQueue) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with TradeCurrency

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

the class PriceFeedService method setCurrencyCodeOnInit.

// /////////////////////////////////////////////////////////////////////////////////////////
// API
// /////////////////////////////////////////////////////////////////////////////////////////
public void setCurrencyCodeOnInit() {
    if (getCurrencyCode() == null) {
        final TradeCurrency preferredTradeCurrency = preferences.getPreferredTradeCurrency();
        final String code = preferredTradeCurrency != null ? preferredTradeCurrency.getCode() : "USD";
        setCurrencyCode(code);
    }
}
Also used : TradeCurrency(bisq.core.locale.TradeCurrency)

Example 3 with TradeCurrency

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

the class SwishForm method addFormForDisplayAccount.

@Override
public void addFormForDisplayAccount() {
    gridRowFrom = gridRow;
    addLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), swishAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
    addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.paymentMethod"), Res.get(swishAccount.getPaymentMethod().getId()));
    addLabelTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.owner"), swishAccount.getHolderName());
    TextField field = addLabelTextField(gridPane, ++gridRow, Res.get("payment.mobile"), swishAccount.getMobileNr()).second;
    field.setMouseTransparent(false);
    TradeCurrency singleTradeCurrency = swishAccount.getSingleTradeCurrency();
    String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null";
    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 4 with TradeCurrency

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

the class USPostalMoneyOrderForm method addFormForDisplayAccount.

@Override
public void addFormForDisplayAccount() {
    gridRowFrom = gridRow;
    addLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), usPostalMoneyOrderAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
    addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.paymentMethod"), Res.get(usPostalMoneyOrderAccount.getPaymentMethod().getId()));
    addLabelTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.owner"), usPostalMoneyOrderAccount.getHolderName());
    TextArea textArea = addLabelTextArea(gridPane, ++gridRow, Res.get("payment.postal.address"), "").second;
    textArea.setText(usPostalMoneyOrderAccount.getPostalAddress());
    textArea.setPrefHeight(60);
    textArea.setEditable(false);
    TradeCurrency singleTradeCurrency = usPostalMoneyOrderAccount.getSingleTradeCurrency();
    String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null";
    addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.currency"), nameAndCode);
    addLimitations();
}
Also used : TradeCurrency(bisq.core.locale.TradeCurrency) TextArea(javafx.scene.control.TextArea) FormBuilder.addLabelTextArea(bisq.desktop.util.FormBuilder.addLabelTextArea)

Example 5 with TradeCurrency

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

the class USPostalMoneyOrderForm 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) -> {
        usPostalMoneyOrderAccount.setHolderName(newValue);
        updateFromInputs();
    });
    postalAddressTextArea = addLabelTextArea(gridPane, ++gridRow, Res.get("payment.postal.address"), "").second;
    postalAddressTextArea.setPrefHeight(60);
    // postalAddressTextArea.setValidator(usPostalMoneyOrderValidator);
    postalAddressTextArea.textProperty().addListener((ov, oldValue, newValue) -> {
        usPostalMoneyOrderAccount.setPostalAddress(newValue);
        updateFromInputs();
    });
    TradeCurrency singleTradeCurrency = usPostalMoneyOrderAccount.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)

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