use of io.bitsquare.locale.TradeCurrency in project bitsquare by bitsquare.
the class CreateOfferView method onPaymentAccountsComboBoxSelected.
private void onPaymentAccountsComboBoxSelected() {
PaymentAccount paymentAccount = paymentAccountsComboBox.getSelectionModel().getSelectedItem();
maybeShowClearXchangeWarning(paymentAccount);
if (paymentAccount != null) {
currencyComboBox.setVisible(paymentAccount.hasMultipleCurrencies());
if (paymentAccount.hasMultipleCurrencies()) {
currencyComboBox.setItems(FXCollections.observableArrayList(paymentAccount.getTradeCurrencies()));
// we select combobox following the user currency, if user currency not available in account, we select first
TradeCurrency tradeCurrency = model.getTradeCurrency();
if (paymentAccount.getTradeCurrencies().contains(tradeCurrency))
currencyComboBox.getSelectionModel().select(tradeCurrency);
else
currencyComboBox.getSelectionModel().select(paymentAccount.getTradeCurrencies().get(0));
model.onPaymentAccountSelected(paymentAccount);
} else {
currencyTextField.setText(paymentAccount.getSingleTradeCurrency().getNameAndCode());
model.onPaymentAccountSelected(paymentAccount);
model.onCurrencySelected(paymentAccount.getSingleTradeCurrency());
}
} else {
currencyComboBox.setVisible(false);
currencyTextField.setText("");
}
}
use of io.bitsquare.locale.TradeCurrency in project bitsquare by bitsquare.
the class OfferBookView method setDirectionTitles.
private void setDirectionTitles() {
TradeCurrency selectedTradeCurrency = model.getSelectedTradeCurrency();
if (selectedTradeCurrency != null) {
Offer.Direction direction = model.getDirection();
String preFix = "Create new offer to ";
String directionText = direction == Offer.Direction.BUY ? "buy" : "sell";
String mirroredDirectionText = direction == Offer.Direction.SELL ? "buy" : "sell";
String code = selectedTradeCurrency.getCode();
if (model.showAllTradeCurrenciesProperty.get())
createOfferButton.setText(preFix + directionText + " BTC");
else if (selectedTradeCurrency instanceof FiatCurrency)
createOfferButton.setText(preFix + directionText + " BTC" + (direction == Offer.Direction.BUY ? " with " : " for ") + code);
else
createOfferButton.setText(preFix + mirroredDirectionText + " " + code + " (" + directionText + " BTC)");
}
}
Aggregations