mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Allow only EUR for the moment (#282)
This commit is contained in:
parent
f9859b3a13
commit
f8e4d1a41d
3 changed files with 38 additions and 15 deletions
|
@ -66,10 +66,9 @@ class IrcAccountModel extends UIModel {
|
|||
final ObjectProperty<BankAccountType> type = new SimpleObjectProperty<>();
|
||||
final ObjectProperty<Currency> currency = new SimpleObjectProperty<>();
|
||||
|
||||
final ObservableList<BankAccountType> allTypes = FXCollections.observableArrayList(BankAccountType
|
||||
.getAllBankAccountTypes());
|
||||
final ObservableList<Currency> allCurrencies = FXCollections.observableArrayList(CurrencyUtil
|
||||
.getAllCurrencies());
|
||||
final ObservableList<BankAccountType> allTypes =
|
||||
FXCollections.observableArrayList(BankAccountType.getAllBankAccountTypes());
|
||||
final ObservableList<Currency> allCurrencies = FXCollections.observableArrayList(CurrencyUtil.getAllCurrencies());
|
||||
final ObservableList<BankAccount> allBankAccounts = FXCollections.observableArrayList();
|
||||
|
||||
|
||||
|
|
|
@ -74,14 +74,10 @@ public class IrcAccountViewCB extends CachedViewCB<IrcAccountPm> implements Cont
|
|||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
typesComboBox.setItems(presentationModel.getAllTypes());
|
||||
typesComboBox.setConverter(presentationModel.getTypesConverter());
|
||||
|
||||
currencyComboBox.setItems(presentationModel.getAllCurrencies());
|
||||
currencyComboBox.setConverter(presentationModel.getCurrencyConverter());
|
||||
|
||||
ircNickNameTextField.setValidator(presentationModel.getNickNameValidator());
|
||||
|
||||
typesComboBox.setItems(presentationModel.getAllTypes());
|
||||
typesComboBox.setConverter(presentationModel.getTypesConverter());
|
||||
// we use a custom cell for deactivating non IRC items, later we use the standard cell and the StringConverter
|
||||
typesComboBox.setCellFactory(new Callback<ListView<BankAccountType>, ListCell<BankAccountType>>() {
|
||||
@Override
|
||||
|
@ -105,9 +101,37 @@ public class IrcAccountViewCB extends CachedViewCB<IrcAccountPm> implements Cont
|
|||
};
|
||||
}
|
||||
});
|
||||
|
||||
typesComboBox.getSelectionModel().select(0);
|
||||
|
||||
currencyComboBox.setItems(presentationModel.getAllCurrencies());
|
||||
currencyComboBox.setConverter(presentationModel.getCurrencyConverter());
|
||||
// we use a custom cell for deactivating non EUR items, later we use the standard cell and the StringConverter
|
||||
currencyComboBox.setCellFactory(new Callback<ListView<Currency>, ListCell<Currency>>() {
|
||||
@Override
|
||||
public ListCell<Currency> call(ListView<Currency> p) {
|
||||
return new ListCell<Currency>() {
|
||||
|
||||
@Override
|
||||
protected void updateItem(Currency currency, boolean empty) {
|
||||
super.updateItem(currency, empty);
|
||||
|
||||
if (currency == null || empty) {
|
||||
setGraphic(null);
|
||||
}
|
||||
else {
|
||||
setText(currency.getCurrencyCode() + " (" + currency.getDisplayName() + ")");
|
||||
|
||||
if (!currency.getCurrencyCode().equals("EUR")) {
|
||||
setOpacity(0.3);
|
||||
setDisable(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
currencyComboBox.getSelectionModel().select(0);
|
||||
|
||||
super.initialize(url, rb);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
package io.bitsquare.locale;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Currency;
|
||||
import java.util.List;
|
||||
|
@ -29,8 +27,8 @@ public class CurrencyUtil {
|
|||
|
||||
public static List<Currency> getAllCurrencies() {
|
||||
final ArrayList<Currency> mainCurrencies = new ArrayList<>();
|
||||
mainCurrencies.add(Currency.getInstance("USD"));
|
||||
mainCurrencies.add(Currency.getInstance("EUR"));
|
||||
mainCurrencies.add(Currency.getInstance("USD"));
|
||||
mainCurrencies.add(Currency.getInstance("CNY"));
|
||||
mainCurrencies.add(Currency.getInstance("RUB"));
|
||||
mainCurrencies.add(Currency.getInstance("JPY"));
|
||||
|
@ -57,6 +55,8 @@ public class CurrencyUtil {
|
|||
}
|
||||
|
||||
public static Currency getDefaultCurrency() {
|
||||
return NumberFormat.getNumberInstance(Locale.getDefault()).getCurrency();
|
||||
// TODO Only display EUR for the moment
|
||||
return Currency.getInstance("EUR");
|
||||
// NumberFormat.getNumberInstance(Locale.getDefault()).getCurrency();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue