Use abstract method to apply TradeCurrency

This commit is contained in:
Christoph Atteneder 2018-10-25 12:27:36 +02:00
parent d9b11ab647
commit 7e5e9cb588
No known key found for this signature in database
GPG Key ID: CD5DC1C529CDFD3B
2 changed files with 2 additions and 30 deletions

View File

@ -18,7 +18,6 @@
package bisq.desktop.components.paymentmethods;
import bisq.desktop.components.InputTextField;
import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.util.FormBuilder;
import bisq.desktop.util.GUIUtil;
import bisq.desktop.util.Layout;
@ -364,20 +363,7 @@ abstract class BankForm extends GeneralBankForm {
private void onTradeCurrencySelected(TradeCurrency tradeCurrency) {
FiatCurrency defaultCurrency = CurrencyUtil.getCurrencyByCountryCode(selectedCountry.code);
if (!defaultCurrency.equals(tradeCurrency)) {
new Popup<>().warning(Res.get("payment.foreign.currency"))
.actionButtonText(Res.get("shared.yes"))
.onAction(() -> {
paymentAccount.setSingleTradeCurrency(tradeCurrency);
autoFillNameTextField();
})
.closeButtonText(Res.get("payment.restore.default"))
.onClose(() -> currencyComboBox.getSelectionModel().select(defaultCurrency))
.show();
} else {
paymentAccount.setSingleTradeCurrency(tradeCurrency);
autoFillNameTextField();
}
applyTradeCurrency(tradeCurrency, defaultCurrency);
}
private CountryBasedPaymentAccount getCountryBasedPaymentAccount() {

View File

@ -18,7 +18,6 @@
package bisq.desktop.components.paymentmethods;
import bisq.desktop.components.InputTextField;
import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.util.FormBuilder;
import bisq.desktop.util.GUIUtil;
import bisq.desktop.util.Layout;
@ -108,20 +107,7 @@ public class WesternUnionForm extends PaymentMethodForm {
private void onTradeCurrencySelected(TradeCurrency tradeCurrency) {
FiatCurrency defaultCurrency = CurrencyUtil.getCurrencyByCountryCode(selectedCountry.code);
if (!defaultCurrency.equals(tradeCurrency)) {
new Popup<>().warning(Res.get("payment.foreign.currency"))
.actionButtonText(Res.get("shared.yes"))
.onAction(() -> {
paymentAccount.setSingleTradeCurrency(tradeCurrency);
autoFillNameTextField();
})
.closeButtonText(Res.get("payment.restore.default"))
.onClose(() -> currencyComboBox.getSelectionModel().select(defaultCurrency))
.show();
} else {
paymentAccount.setSingleTradeCurrency(tradeCurrency);
autoFillNameTextField();
}
applyTradeCurrency(tradeCurrency, defaultCurrency);
}
private void onCountrySelected(Country country) {