Search in sources :

Example 6 with TradeCurrency

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("");
    }
}
Also used : TradeCurrency(io.bitsquare.locale.TradeCurrency) PaymentAccount(io.bitsquare.payment.PaymentAccount)

Example 7 with TradeCurrency

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)");
    }
}
Also used : TradeCurrency(io.bitsquare.locale.TradeCurrency) Offer(io.bitsquare.trade.offer.Offer) FiatCurrency(io.bitsquare.locale.FiatCurrency)

Aggregations

TradeCurrency (io.bitsquare.locale.TradeCurrency)7 PaymentAccount (io.bitsquare.payment.PaymentAccount)4 CryptoCurrency (io.bitsquare.locale.CryptoCurrency)3 FiatCurrency (io.bitsquare.locale.FiatCurrency)3 PaymentMethod (io.bitsquare.payment.PaymentMethod)3 Inject (com.google.inject.Inject)2 ActivatableDataModel (io.bitsquare.gui.common.model.ActivatableDataModel)2 Popup (io.bitsquare.gui.main.overlays.popups.Popup)2 GUIUtil (io.bitsquare.gui.util.GUIUtil)2 CryptoCurrencyAccount (io.bitsquare.payment.CryptoCurrencyAccount)2 TradeManager (io.bitsquare.trade.TradeManager)2 Offer (io.bitsquare.trade.offer.Offer)2 OpenOfferManager (io.bitsquare.trade.offer.OpenOfferManager)2 Preferences (io.bitsquare.user.Preferences)2 User (io.bitsquare.user.User)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 FXCollections (javafx.collections.FXCollections)2 ObservableList (javafx.collections.ObservableList)2