mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-25 07:27:18 +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<BankAccountType> type = new SimpleObjectProperty<>();
|
||||||
final ObjectProperty<Currency> currency = new SimpleObjectProperty<>();
|
final ObjectProperty<Currency> currency = new SimpleObjectProperty<>();
|
||||||
|
|
||||||
final ObservableList<BankAccountType> allTypes = FXCollections.observableArrayList(BankAccountType
|
final ObservableList<BankAccountType> allTypes =
|
||||||
.getAllBankAccountTypes());
|
FXCollections.observableArrayList(BankAccountType.getAllBankAccountTypes());
|
||||||
final ObservableList<Currency> allCurrencies = FXCollections.observableArrayList(CurrencyUtil
|
final ObservableList<Currency> allCurrencies = FXCollections.observableArrayList(CurrencyUtil.getAllCurrencies());
|
||||||
.getAllCurrencies());
|
|
||||||
final ObservableList<BankAccount> allBankAccounts = FXCollections.observableArrayList();
|
final ObservableList<BankAccount> allBankAccounts = FXCollections.observableArrayList();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -74,14 +74,10 @@ public class IrcAccountViewCB extends CachedViewCB<IrcAccountPm> implements Cont
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(URL url, ResourceBundle rb) {
|
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());
|
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
|
// 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>>() {
|
typesComboBox.setCellFactory(new Callback<ListView<BankAccountType>, ListCell<BankAccountType>>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -105,9 +101,37 @@ public class IrcAccountViewCB extends CachedViewCB<IrcAccountPm> implements Cont
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
typesComboBox.getSelectionModel().select(0);
|
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);
|
super.initialize(url, rb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,6 @@
|
||||||
|
|
||||||
package io.bitsquare.locale;
|
package io.bitsquare.locale;
|
||||||
|
|
||||||
import java.text.NumberFormat;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Currency;
|
import java.util.Currency;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -29,8 +27,8 @@ public class CurrencyUtil {
|
||||||
|
|
||||||
public static List<Currency> getAllCurrencies() {
|
public static List<Currency> getAllCurrencies() {
|
||||||
final ArrayList<Currency> mainCurrencies = new ArrayList<>();
|
final ArrayList<Currency> mainCurrencies = new ArrayList<>();
|
||||||
mainCurrencies.add(Currency.getInstance("USD"));
|
|
||||||
mainCurrencies.add(Currency.getInstance("EUR"));
|
mainCurrencies.add(Currency.getInstance("EUR"));
|
||||||
|
mainCurrencies.add(Currency.getInstance("USD"));
|
||||||
mainCurrencies.add(Currency.getInstance("CNY"));
|
mainCurrencies.add(Currency.getInstance("CNY"));
|
||||||
mainCurrencies.add(Currency.getInstance("RUB"));
|
mainCurrencies.add(Currency.getInstance("RUB"));
|
||||||
mainCurrencies.add(Currency.getInstance("JPY"));
|
mainCurrencies.add(Currency.getInstance("JPY"));
|
||||||
|
@ -57,6 +55,8 @@ public class CurrencyUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Currency getDefaultCurrency() {
|
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