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;
}
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);
}
}
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();
}
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();
}
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();
}
Aggregations