mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Merge pull request #1610 from ManfredKarrer/refact-generics
Refact generics
This commit is contained in:
commit
1755388efa
@ -30,6 +30,7 @@ import com.google.inject.Inject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -78,11 +79,11 @@ public final class Navigation implements PersistedDataHost {
|
||||
//noinspection unchecked
|
||||
return ((Class<? extends View>) Class.forName(className));
|
||||
} catch (ClassNotFoundException e) {
|
||||
log.warn("Could not find the Viewpath class {}; exception: {}", className, e);
|
||||
log.warn("Could not find the viewPath class {}; exception: {}", className, e);
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.filter(e -> e != null)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!viewClasses.isEmpty())
|
||||
@ -90,8 +91,8 @@ public final class Navigation implements PersistedDataHost {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void navigateTo(Class<? extends View>... viewClasses) {
|
||||
@SafeVarargs
|
||||
public final void navigateTo(Class<? extends View>... viewClasses) {
|
||||
navigateTo(ViewPath.to(viewClasses));
|
||||
}
|
||||
|
||||
@ -123,7 +124,7 @@ public final class Navigation implements PersistedDataHost {
|
||||
currentPath = newPath;
|
||||
previousPath = currentPath;
|
||||
queueUpForSave();
|
||||
listeners.stream().forEach((e) -> e.onNavigationRequested(currentPath));
|
||||
listeners.forEach((e) -> e.onNavigationRequested(currentPath));
|
||||
}
|
||||
|
||||
private void queueUpForSave() {
|
||||
|
@ -94,7 +94,6 @@ public class MenuItem extends AutoTooltipToggleButton {
|
||||
}
|
||||
|
||||
public void activate() {
|
||||
//noinspection unchecked
|
||||
setOnAction((event) -> navigation.navigateTo(getNavPathClasses()));
|
||||
selectedProperty().addListener(selectedPropertyChangeListener);
|
||||
disableProperty().addListener(disablePropertyChangeListener);
|
||||
@ -105,6 +104,7 @@ public class MenuItem extends AutoTooltipToggleButton {
|
||||
private Class<? extends View>[] getNavPathClasses() {
|
||||
List<Class<? extends View>> list = new ArrayList<>(baseNavPath);
|
||||
list.add(viewClass);
|
||||
//noinspection unchecked
|
||||
Class<? extends View>[] array = new Class[list.size()];
|
||||
list.toArray(array);
|
||||
return array;
|
||||
|
@ -19,6 +19,8 @@ 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;
|
||||
import bisq.desktop.util.validation.AccountNrValidator;
|
||||
import bisq.desktop.util.validation.BankIdValidator;
|
||||
@ -30,7 +32,6 @@ import bisq.core.locale.Country;
|
||||
import bisq.core.locale.CountryUtil;
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.FiatCurrency;
|
||||
import bisq.core.locale.Region;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
import bisq.core.payment.AccountAgeWitnessService;
|
||||
@ -42,7 +43,6 @@ import bisq.core.util.BSFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import bisq.common.util.Tuple2;
|
||||
import bisq.common.util.Tuple3;
|
||||
import bisq.common.util.Tuple4;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -54,8 +54,6 @@ import javafx.scene.layout.GridPane;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
|
||||
import javafx.util.StringConverter;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -227,19 +225,17 @@ abstract class BankForm extends PaymentMethodForm {
|
||||
private Label bankIdLabel, branchIdLabel, accountNrLabel, nationalAccountIdLabel;
|
||||
private Tuple2<Label, InputTextField> bankIdTuple, accountNrTuple, branchIdTuple,
|
||||
bankNameTuple, nationalAccountIdTuple;
|
||||
private Tuple2<Label, ComboBox> accountTypeTuple;
|
||||
private Tuple2<Label, ComboBox<String>> accountTypeTuple;
|
||||
private Label accountTypeLabel;
|
||||
private ComboBox<String> accountTypeComboBox;
|
||||
private boolean validatorsApplied;
|
||||
private boolean useHolderID;
|
||||
private final Runnable closeHandler;
|
||||
private ComboBox<TradeCurrency> currencyComboBox;
|
||||
private boolean accountNrInputTextFieldEdited;
|
||||
private Country selectedCountry;
|
||||
|
||||
BankForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator,
|
||||
GridPane gridPane, int gridRow, BSFormatter formatter, Runnable closeHandler) {
|
||||
GridPane gridPane, int gridRow, BSFormatter formatter) {
|
||||
super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter);
|
||||
this.closeHandler = closeHandler;
|
||||
this.bankAccountPayload = (BankAccountPayload) paymentAccount.paymentAccountPayload;
|
||||
}
|
||||
|
||||
@ -292,200 +288,9 @@ abstract class BankForm extends PaymentMethodForm {
|
||||
accountNrInputTextFieldEdited = false;
|
||||
gridRowFrom = gridRow + 1;
|
||||
|
||||
Tuple3<Label, ComboBox, ComboBox> tuple3 = addLabelComboBoxComboBox(gridPane, ++gridRow, Res.get("payment.country"));
|
||||
|
||||
//noinspection unchecked,unchecked,unchecked
|
||||
ComboBox<Region> regionComboBox = tuple3.second;
|
||||
regionComboBox.setPromptText(Res.get("payment.select.region"));
|
||||
regionComboBox.setConverter(new StringConverter<Region>() {
|
||||
@Override
|
||||
public String toString(Region region) {
|
||||
return region.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Region fromString(String s) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
regionComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllRegions()));
|
||||
|
||||
|
||||
//noinspection unchecked,unchecked,unchecked
|
||||
ComboBox<Country> countryComboBox = tuple3.third;
|
||||
countryComboBox.setVisibleRowCount(15);
|
||||
countryComboBox.setDisable(true);
|
||||
countryComboBox.setPromptText(Res.get("payment.select.country"));
|
||||
countryComboBox.setConverter(new StringConverter<Country>() {
|
||||
@Override
|
||||
public String toString(Country country) {
|
||||
return country.name + " (" + country.code + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Country fromString(String s) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
countryComboBox.setOnAction(e -> {
|
||||
Country selectedItem = countryComboBox.getSelectionModel().getSelectedItem();
|
||||
if (selectedItem != null) {
|
||||
getCountryBasedPaymentAccount().setCountry(selectedItem);
|
||||
String countryCode = selectedItem.code;
|
||||
TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(countryCode);
|
||||
paymentAccount.setSingleTradeCurrency(currency);
|
||||
currencyComboBox.setDisable(false);
|
||||
currencyComboBox.getSelectionModel().select(currency);
|
||||
|
||||
bankIdLabel.setText(BankUtil.getBankIdLabel(countryCode));
|
||||
branchIdLabel.setText(BankUtil.getBranchIdLabel(countryCode));
|
||||
nationalAccountIdLabel.setText(BankUtil.getNationalAccountIdLabel(countryCode));
|
||||
accountNrLabel.setText(BankUtil.getAccountNrLabel(countryCode));
|
||||
accountTypeLabel.setText(BankUtil.getAccountTypeLabel(countryCode));
|
||||
|
||||
bankNameInputTextField.setText("");
|
||||
bankIdInputTextField.setText("");
|
||||
branchIdInputTextField.setText("");
|
||||
nationalAccountIdInputTextField.setText("");
|
||||
accountNrInputTextField.setText("");
|
||||
accountNrInputTextField.focusedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue) accountNrInputTextFieldEdited = true;
|
||||
});
|
||||
accountTypeComboBox.getSelectionModel().clearSelection();
|
||||
accountTypeComboBox.setItems(FXCollections.observableArrayList(BankUtil.getAccountTypeValues(countryCode)));
|
||||
|
||||
if (BankUtil.useValidation(countryCode) && !validatorsApplied) {
|
||||
validatorsApplied = true;
|
||||
if (useHolderID)
|
||||
holderIdInputTextField.setValidator(inputValidator);
|
||||
bankNameInputTextField.setValidator(inputValidator);
|
||||
bankIdInputTextField.setValidator(new BankIdValidator(countryCode));
|
||||
branchIdInputTextField.setValidator(new BranchIdValidator(countryCode));
|
||||
accountNrInputTextField.setValidator(new AccountNrValidator(countryCode));
|
||||
nationalAccountIdInputTextField.setValidator(new NationalAccountIdValidator(countryCode));
|
||||
} else {
|
||||
validatorsApplied = false;
|
||||
if (useHolderID)
|
||||
holderIdInputTextField.setValidator(null);
|
||||
bankNameInputTextField.setValidator(null);
|
||||
bankIdInputTextField.setValidator(null);
|
||||
branchIdInputTextField.setValidator(null);
|
||||
accountNrInputTextField.setValidator(null);
|
||||
nationalAccountIdInputTextField.setValidator(null);
|
||||
}
|
||||
holderNameInputTextField.resetValidation();
|
||||
bankNameInputTextField.resetValidation();
|
||||
bankIdInputTextField.resetValidation();
|
||||
branchIdInputTextField.resetValidation();
|
||||
accountNrInputTextField.resetValidation();
|
||||
nationalAccountIdInputTextField.resetValidation();
|
||||
|
||||
boolean requiresHolderId = BankUtil.isHolderIdRequired(countryCode);
|
||||
if (requiresHolderId) {
|
||||
holderNameInputTextField.minWidthProperty().unbind();
|
||||
holderNameInputTextField.setMinWidth(250);
|
||||
} else {
|
||||
holderNameInputTextField.minWidthProperty().bind(currencyComboBox.widthProperty());
|
||||
}
|
||||
|
||||
if (useHolderID) {
|
||||
if (!requiresHolderId)
|
||||
holderIdInputTextField.setText("");
|
||||
|
||||
holderIdInputTextField.resetValidation();
|
||||
holderIdInputTextField.setVisible(requiresHolderId);
|
||||
holderIdInputTextField.setManaged(requiresHolderId);
|
||||
|
||||
holderIdLabel.setText(BankUtil.getHolderIdLabel(countryCode));
|
||||
holderIdLabel.setVisible(requiresHolderId);
|
||||
holderIdLabel.setManaged(requiresHolderId);
|
||||
}
|
||||
|
||||
boolean nationalAccountIdRequired = BankUtil.isNationalAccountIdRequired(countryCode);
|
||||
nationalAccountIdTuple.first.setVisible(nationalAccountIdRequired);
|
||||
nationalAccountIdTuple.first.setManaged(nationalAccountIdRequired);
|
||||
nationalAccountIdInputTextField.setVisible(nationalAccountIdRequired);
|
||||
nationalAccountIdInputTextField.setManaged(nationalAccountIdRequired);
|
||||
|
||||
boolean bankNameRequired = BankUtil.isBankNameRequired(countryCode);
|
||||
bankNameTuple.first.setVisible(bankNameRequired);
|
||||
bankNameTuple.first.setManaged(bankNameRequired);
|
||||
bankNameInputTextField.setVisible(bankNameRequired);
|
||||
bankNameInputTextField.setManaged(bankNameRequired);
|
||||
|
||||
boolean bankIdRequired = BankUtil.isBankIdRequired(countryCode);
|
||||
bankIdTuple.first.setVisible(bankIdRequired);
|
||||
bankIdTuple.first.setManaged(bankIdRequired);
|
||||
bankIdInputTextField.setVisible(bankIdRequired);
|
||||
bankIdInputTextField.setManaged(bankIdRequired);
|
||||
|
||||
boolean branchIdRequired = BankUtil.isBranchIdRequired(countryCode);
|
||||
branchIdTuple.first.setVisible(branchIdRequired);
|
||||
branchIdTuple.first.setManaged(branchIdRequired);
|
||||
branchIdInputTextField.setVisible(branchIdRequired);
|
||||
branchIdInputTextField.setManaged(branchIdRequired);
|
||||
|
||||
boolean accountNrRequired = BankUtil.isAccountNrRequired(countryCode);
|
||||
accountNrTuple.first.setVisible(accountNrRequired);
|
||||
accountNrTuple.first.setManaged(accountNrRequired);
|
||||
accountNrInputTextField.setVisible(accountNrRequired);
|
||||
accountNrInputTextField.setManaged(accountNrRequired);
|
||||
|
||||
boolean accountTypeRequired = BankUtil.isAccountTypeRequired(countryCode);
|
||||
accountTypeTuple.first.setVisible(accountTypeRequired);
|
||||
accountTypeTuple.first.setManaged(accountTypeRequired);
|
||||
accountTypeTuple.second.setVisible(accountTypeRequired);
|
||||
accountTypeTuple.second.setManaged(accountTypeRequired);
|
||||
|
||||
updateFromInputs();
|
||||
|
||||
onCountryChanged();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
regionComboBox.setOnAction(e -> {
|
||||
Region selectedItem = regionComboBox.getSelectionModel().getSelectedItem();
|
||||
if (selectedItem != null) {
|
||||
countryComboBox.setDisable(false);
|
||||
countryComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllCountriesForRegion(selectedItem)));
|
||||
}
|
||||
});
|
||||
|
||||
//noinspection unchecked
|
||||
currencyComboBox = addLabelComboBox(gridPane, ++gridRow, Res.getWithCol("shared.currency")).second;
|
||||
currencyComboBox.setPromptText(Res.get("list.currency.select"));
|
||||
currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getAllSortedFiatCurrencies()));
|
||||
currencyComboBox.setOnAction(e -> {
|
||||
TradeCurrency selectedItem = currencyComboBox.getSelectionModel().getSelectedItem();
|
||||
FiatCurrency defaultCurrency = CurrencyUtil.getCurrencyByCountryCode(countryComboBox.getSelectionModel().getSelectedItem().code);
|
||||
if (!defaultCurrency.equals(selectedItem)) {
|
||||
new Popup<>().warning(Res.get("payment.foreign.currency"))
|
||||
.actionButtonText(Res.get("shared.yes"))
|
||||
.onAction(() -> {
|
||||
paymentAccount.setSingleTradeCurrency(selectedItem);
|
||||
autoFillNameTextField();
|
||||
})
|
||||
.closeButtonText(Res.get("payment.restore.default"))
|
||||
.onClose(() -> currencyComboBox.getSelectionModel().select(defaultCurrency))
|
||||
.show();
|
||||
} else {
|
||||
paymentAccount.setSingleTradeCurrency(selectedItem);
|
||||
autoFillNameTextField();
|
||||
}
|
||||
});
|
||||
currencyComboBox.setConverter(new StringConverter<TradeCurrency>() {
|
||||
@Override
|
||||
public String toString(TradeCurrency currency) {
|
||||
return currency.getNameAndCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TradeCurrency fromString(String string) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
currencyComboBox.setDisable(true);
|
||||
Tuple2<ComboBox<TradeCurrency>, Integer> tuple = GUIUtil.addRegionCountryTradeCurrencyComboBoxes(gridPane, gridRow, this::onCountrySelected, this::onTradeCurrencySelected);
|
||||
currencyComboBox = tuple.first;
|
||||
gridRow = tuple.second;
|
||||
|
||||
addAcceptedBanksForAddAccount();
|
||||
|
||||
@ -537,9 +342,9 @@ abstract class BankForm extends PaymentMethodForm {
|
||||
|
||||
});
|
||||
|
||||
accountTypeTuple = addLabelComboBox(gridPane, ++gridRow, "");
|
||||
accountTypeTuple = FormBuilder.addLabelComboBox(gridPane, ++gridRow, "");
|
||||
accountTypeLabel = accountTypeTuple.first;
|
||||
//noinspection unchecked
|
||||
|
||||
accountTypeComboBox = accountTypeTuple.second;
|
||||
accountTypeComboBox.setPromptText(Res.get("payment.select.account"));
|
||||
accountTypeComboBox.setOnAction(e -> {
|
||||
@ -555,6 +360,140 @@ abstract class BankForm extends PaymentMethodForm {
|
||||
updateFromInputs();
|
||||
}
|
||||
|
||||
private void onCountrySelected(Country country) {
|
||||
selectedCountry = country;
|
||||
if (country != null) {
|
||||
getCountryBasedPaymentAccount().setCountry(country);
|
||||
String countryCode = country.code;
|
||||
TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(countryCode);
|
||||
paymentAccount.setSingleTradeCurrency(currency);
|
||||
currencyComboBox.setDisable(false);
|
||||
currencyComboBox.getSelectionModel().select(currency);
|
||||
|
||||
bankIdLabel.setText(BankUtil.getBankIdLabel(countryCode));
|
||||
branchIdLabel.setText(BankUtil.getBranchIdLabel(countryCode));
|
||||
nationalAccountIdLabel.setText(BankUtil.getNationalAccountIdLabel(countryCode));
|
||||
accountNrLabel.setText(BankUtil.getAccountNrLabel(countryCode));
|
||||
accountTypeLabel.setText(BankUtil.getAccountTypeLabel(countryCode));
|
||||
|
||||
bankNameInputTextField.setText("");
|
||||
bankIdInputTextField.setText("");
|
||||
branchIdInputTextField.setText("");
|
||||
nationalAccountIdInputTextField.setText("");
|
||||
accountNrInputTextField.setText("");
|
||||
accountNrInputTextField.focusedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue) accountNrInputTextFieldEdited = true;
|
||||
});
|
||||
accountTypeComboBox.getSelectionModel().clearSelection();
|
||||
accountTypeComboBox.setItems(FXCollections.observableArrayList(BankUtil.getAccountTypeValues(countryCode)));
|
||||
|
||||
if (BankUtil.useValidation(countryCode) && !validatorsApplied) {
|
||||
validatorsApplied = true;
|
||||
if (useHolderID)
|
||||
holderIdInputTextField.setValidator(inputValidator);
|
||||
bankNameInputTextField.setValidator(inputValidator);
|
||||
bankIdInputTextField.setValidator(new BankIdValidator(countryCode));
|
||||
branchIdInputTextField.setValidator(new BranchIdValidator(countryCode));
|
||||
accountNrInputTextField.setValidator(new AccountNrValidator(countryCode));
|
||||
nationalAccountIdInputTextField.setValidator(new NationalAccountIdValidator(countryCode));
|
||||
} else {
|
||||
validatorsApplied = false;
|
||||
if (useHolderID)
|
||||
holderIdInputTextField.setValidator(null);
|
||||
bankNameInputTextField.setValidator(null);
|
||||
bankIdInputTextField.setValidator(null);
|
||||
branchIdInputTextField.setValidator(null);
|
||||
accountNrInputTextField.setValidator(null);
|
||||
nationalAccountIdInputTextField.setValidator(null);
|
||||
}
|
||||
holderNameInputTextField.resetValidation();
|
||||
bankNameInputTextField.resetValidation();
|
||||
bankIdInputTextField.resetValidation();
|
||||
branchIdInputTextField.resetValidation();
|
||||
accountNrInputTextField.resetValidation();
|
||||
nationalAccountIdInputTextField.resetValidation();
|
||||
|
||||
boolean requiresHolderId = BankUtil.isHolderIdRequired(countryCode);
|
||||
if (requiresHolderId) {
|
||||
holderNameInputTextField.minWidthProperty().unbind();
|
||||
holderNameInputTextField.setMinWidth(250);
|
||||
} else {
|
||||
holderNameInputTextField.minWidthProperty().bind(currencyComboBox.widthProperty());
|
||||
}
|
||||
|
||||
if (useHolderID) {
|
||||
if (!requiresHolderId)
|
||||
holderIdInputTextField.setText("");
|
||||
|
||||
holderIdInputTextField.resetValidation();
|
||||
holderIdInputTextField.setVisible(requiresHolderId);
|
||||
holderIdInputTextField.setManaged(requiresHolderId);
|
||||
|
||||
holderIdLabel.setText(BankUtil.getHolderIdLabel(countryCode));
|
||||
holderIdLabel.setVisible(requiresHolderId);
|
||||
holderIdLabel.setManaged(requiresHolderId);
|
||||
}
|
||||
|
||||
boolean nationalAccountIdRequired = BankUtil.isNationalAccountIdRequired(countryCode);
|
||||
nationalAccountIdTuple.first.setVisible(nationalAccountIdRequired);
|
||||
nationalAccountIdTuple.first.setManaged(nationalAccountIdRequired);
|
||||
nationalAccountIdInputTextField.setVisible(nationalAccountIdRequired);
|
||||
nationalAccountIdInputTextField.setManaged(nationalAccountIdRequired);
|
||||
|
||||
boolean bankNameRequired = BankUtil.isBankNameRequired(countryCode);
|
||||
bankNameTuple.first.setVisible(bankNameRequired);
|
||||
bankNameTuple.first.setManaged(bankNameRequired);
|
||||
bankNameInputTextField.setVisible(bankNameRequired);
|
||||
bankNameInputTextField.setManaged(bankNameRequired);
|
||||
|
||||
boolean bankIdRequired = BankUtil.isBankIdRequired(countryCode);
|
||||
bankIdTuple.first.setVisible(bankIdRequired);
|
||||
bankIdTuple.first.setManaged(bankIdRequired);
|
||||
bankIdInputTextField.setVisible(bankIdRequired);
|
||||
bankIdInputTextField.setManaged(bankIdRequired);
|
||||
|
||||
boolean branchIdRequired = BankUtil.isBranchIdRequired(countryCode);
|
||||
branchIdTuple.first.setVisible(branchIdRequired);
|
||||
branchIdTuple.first.setManaged(branchIdRequired);
|
||||
branchIdInputTextField.setVisible(branchIdRequired);
|
||||
branchIdInputTextField.setManaged(branchIdRequired);
|
||||
|
||||
boolean accountNrRequired = BankUtil.isAccountNrRequired(countryCode);
|
||||
accountNrTuple.first.setVisible(accountNrRequired);
|
||||
accountNrTuple.first.setManaged(accountNrRequired);
|
||||
accountNrInputTextField.setVisible(accountNrRequired);
|
||||
accountNrInputTextField.setManaged(accountNrRequired);
|
||||
|
||||
boolean accountTypeRequired = BankUtil.isAccountTypeRequired(countryCode);
|
||||
accountTypeTuple.first.setVisible(accountTypeRequired);
|
||||
accountTypeTuple.first.setManaged(accountTypeRequired);
|
||||
accountTypeTuple.second.setVisible(accountTypeRequired);
|
||||
accountTypeTuple.second.setManaged(accountTypeRequired);
|
||||
|
||||
updateFromInputs();
|
||||
|
||||
onCountryChanged();
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
private CountryBasedPaymentAccount getCountryBasedPaymentAccount() {
|
||||
return (CountryBasedPaymentAccount) this.paymentAccount;
|
||||
}
|
||||
@ -623,8 +562,8 @@ abstract class BankForm extends PaymentMethodForm {
|
||||
String nationalAccountId = nationalAccountIdInputTextField.getText();
|
||||
|
||||
if (countryCode.equals("AR") && nationalAccountId.length() == 22 && !accountNrInputTextFieldEdited) {
|
||||
branchIdInputTextField.setText(nationalAccountId.substring(3,7));
|
||||
accountNrInputTextField.setText(nationalAccountId.substring(8,21));
|
||||
branchIdInputTextField.setText(nationalAccountId.substring(3, 7));
|
||||
accountNrInputTextField.setText(nationalAccountId.substring(8, 21));
|
||||
}
|
||||
}
|
||||
|
||||
@ -658,7 +597,7 @@ abstract class BankForm extends PaymentMethodForm {
|
||||
if (useHolderID && BankUtil.isHolderIdRequired(countryCode))
|
||||
result = result && holderIdInputTextField.getValidator().validate(bankAccountPayload.getHolderTaxId()).isValid;
|
||||
|
||||
if(BankUtil.isNationalAccountIdRequired(countryCode))
|
||||
if (BankUtil.isNationalAccountIdRequired(countryCode))
|
||||
result = result && nationalAccountIdInputTextField.getValidator().validate(bankAccountPayload.getNationalAccountId()).isValid;
|
||||
}
|
||||
allInputsValid.set(result);
|
||||
|
@ -20,6 +20,7 @@ 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;
|
||||
import bisq.desktop.util.validation.AccountNrValidator;
|
||||
import bisq.desktop.util.validation.BankIdValidator;
|
||||
@ -32,7 +33,6 @@ import bisq.core.locale.Country;
|
||||
import bisq.core.locale.CountryUtil;
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.FiatCurrency;
|
||||
import bisq.core.locale.Region;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
import bisq.core.payment.AccountAgeWitnessService;
|
||||
@ -44,7 +44,6 @@ import bisq.core.util.BSFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import bisq.common.util.Tuple2;
|
||||
import bisq.common.util.Tuple3;
|
||||
import bisq.common.util.Tuple4;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -57,8 +56,6 @@ import javafx.scene.layout.GridPane;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
|
||||
import javafx.util.StringConverter;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -131,7 +128,7 @@ public class CashDepositForm extends PaymentMethodForm {
|
||||
if (nationalAccountIdAccountNrCombined)
|
||||
nrRows--;
|
||||
|
||||
if(nrRows > 2) {
|
||||
if (nrRows > 2) {
|
||||
// Next we try BankName + BankId
|
||||
bankNameBankIdCombined = BankUtil.isBankNameRequired(countryCode) && BankUtil.isBankIdRequired(countryCode);
|
||||
if (bankNameBankIdCombined)
|
||||
@ -242,15 +239,14 @@ public class CashDepositForm extends PaymentMethodForm {
|
||||
private Label bankIdLabel, branchIdLabel, accountNrLabel, nationalAccountIdLabel;
|
||||
private Tuple2<Label, InputTextField> bankIdTuple, accountNrTuple, branchIdTuple,
|
||||
bankNameTuple, nationalAccountIdTuple;
|
||||
private Tuple2<Label, ComboBox> accountTypeTuple;
|
||||
private Tuple2<Label, ComboBox<String>> accountTypeTuple;
|
||||
private Label accountTypeLabel;
|
||||
private ComboBox<String> accountTypeComboBox;
|
||||
private boolean validatorsApplied;
|
||||
private boolean useHolderID;
|
||||
private ComboBox<TradeCurrency> currencyComboBox;
|
||||
private final EmailValidator emailValidator;
|
||||
private boolean accountNrInputTextFieldEdited;
|
||||
|
||||
private Country selectedCountry;
|
||||
|
||||
public CashDepositForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator,
|
||||
GridPane gridPane, int gridRow, BSFormatter formatter) {
|
||||
@ -322,199 +318,9 @@ public class CashDepositForm extends PaymentMethodForm {
|
||||
accountNrInputTextFieldEdited = false;
|
||||
gridRowFrom = gridRow + 1;
|
||||
|
||||
Tuple3<Label, ComboBox, ComboBox> tuple3 = FormBuilder.addLabelComboBoxComboBox(gridPane, ++gridRow, Res.get("payment.country"));
|
||||
|
||||
//noinspection unchecked,unchecked,unchecked
|
||||
ComboBox<Region> regionComboBox = tuple3.second;
|
||||
regionComboBox.setPromptText(Res.get("payment.select.region"));
|
||||
regionComboBox.setConverter(new StringConverter<Region>() {
|
||||
@Override
|
||||
public String toString(Region region) {
|
||||
return region.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Region fromString(String s) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
regionComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllRegions()));
|
||||
|
||||
//noinspection unchecked,unchecked,unchecked
|
||||
ComboBox<Country> countryComboBox = tuple3.third;
|
||||
countryComboBox.setVisibleRowCount(15);
|
||||
countryComboBox.setDisable(true);
|
||||
countryComboBox.setPromptText(Res.get("payment.select.country"));
|
||||
countryComboBox.setConverter(new StringConverter<Country>() {
|
||||
@Override
|
||||
public String toString(Country country) {
|
||||
return country.name + " (" + country.code + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Country fromString(String s) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
countryComboBox.setOnAction(e -> {
|
||||
Country selectedItem = countryComboBox.getSelectionModel().getSelectedItem();
|
||||
if (selectedItem != null) {
|
||||
getCountryBasedPaymentAccount().setCountry(selectedItem);
|
||||
String countryCode = selectedItem.code;
|
||||
TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(countryCode);
|
||||
paymentAccount.setSingleTradeCurrency(currency);
|
||||
currencyComboBox.setDisable(false);
|
||||
currencyComboBox.getSelectionModel().select(currency);
|
||||
|
||||
bankIdLabel.setText(BankUtil.getBankIdLabel(countryCode));
|
||||
branchIdLabel.setText(BankUtil.getBranchIdLabel(countryCode));
|
||||
nationalAccountIdLabel.setText(BankUtil.getNationalAccountIdLabel(countryCode));
|
||||
accountNrLabel.setText(BankUtil.getAccountNrLabel(countryCode));
|
||||
accountTypeLabel.setText(BankUtil.getAccountTypeLabel(countryCode));
|
||||
|
||||
bankNameInputTextField.setText("");
|
||||
bankIdInputTextField.setText("");
|
||||
branchIdInputTextField.setText("");
|
||||
nationalAccountIdInputTextField.setText("");
|
||||
accountNrInputTextField.setText("");
|
||||
accountNrInputTextField.focusedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue) accountNrInputTextFieldEdited = true;
|
||||
});
|
||||
accountTypeComboBox.getSelectionModel().clearSelection();
|
||||
accountTypeComboBox.setItems(FXCollections.observableArrayList(BankUtil.getAccountTypeValues(countryCode)));
|
||||
|
||||
if (BankUtil.useValidation(countryCode) && !validatorsApplied) {
|
||||
validatorsApplied = true;
|
||||
if (useHolderID)
|
||||
holderIdInputTextField.setValidator(inputValidator);
|
||||
bankNameInputTextField.setValidator(inputValidator);
|
||||
bankIdInputTextField.setValidator(new BankIdValidator(countryCode));
|
||||
branchIdInputTextField.setValidator(new BranchIdValidator(countryCode));
|
||||
accountNrInputTextField.setValidator(new AccountNrValidator(countryCode));
|
||||
nationalAccountIdInputTextField.setValidator(new NationalAccountIdValidator(countryCode));
|
||||
} else {
|
||||
validatorsApplied = false;
|
||||
if (useHolderID)
|
||||
holderIdInputTextField.setValidator(null);
|
||||
bankNameInputTextField.setValidator(null);
|
||||
bankIdInputTextField.setValidator(null);
|
||||
branchIdInputTextField.setValidator(null);
|
||||
accountNrInputTextField.setValidator(null);
|
||||
nationalAccountIdInputTextField.setValidator(null);
|
||||
}
|
||||
holderNameInputTextField.resetValidation();
|
||||
emailInputTextField.resetValidation();
|
||||
bankNameInputTextField.resetValidation();
|
||||
bankIdInputTextField.resetValidation();
|
||||
branchIdInputTextField.resetValidation();
|
||||
accountNrInputTextField.resetValidation();
|
||||
nationalAccountIdInputTextField.resetValidation();
|
||||
|
||||
boolean requiresHolderId = BankUtil.isHolderIdRequired(countryCode);
|
||||
if (requiresHolderId) {
|
||||
holderNameInputTextField.minWidthProperty().unbind();
|
||||
holderNameInputTextField.setMinWidth(300);
|
||||
} else {
|
||||
holderNameInputTextField.minWidthProperty().bind(currencyComboBox.widthProperty());
|
||||
}
|
||||
|
||||
if (useHolderID) {
|
||||
if (!requiresHolderId)
|
||||
holderIdInputTextField.setText("");
|
||||
|
||||
holderIdInputTextField.resetValidation();
|
||||
holderIdInputTextField.setVisible(requiresHolderId);
|
||||
holderIdInputTextField.setManaged(requiresHolderId);
|
||||
|
||||
holderIdLabel.setText(BankUtil.getHolderIdLabel(countryCode));
|
||||
holderIdLabel.setVisible(requiresHolderId);
|
||||
holderIdLabel.setManaged(requiresHolderId);
|
||||
}
|
||||
|
||||
boolean nationalAccountIdRequired = BankUtil.isNationalAccountIdRequired(countryCode);
|
||||
nationalAccountIdTuple.first.setVisible(nationalAccountIdRequired);
|
||||
nationalAccountIdTuple.first.setManaged(nationalAccountIdRequired);
|
||||
nationalAccountIdInputTextField.setVisible(nationalAccountIdRequired);
|
||||
nationalAccountIdInputTextField.setManaged(nationalAccountIdRequired);
|
||||
|
||||
boolean bankNameRequired = BankUtil.isBankNameRequired(countryCode);
|
||||
bankNameTuple.first.setVisible(bankNameRequired);
|
||||
bankNameTuple.first.setManaged(bankNameRequired);
|
||||
bankNameInputTextField.setVisible(bankNameRequired);
|
||||
bankNameInputTextField.setManaged(bankNameRequired);
|
||||
|
||||
boolean bankIdRequired = BankUtil.isBankIdRequired(countryCode);
|
||||
bankIdTuple.first.setVisible(bankIdRequired);
|
||||
bankIdTuple.first.setManaged(bankIdRequired);
|
||||
bankIdInputTextField.setVisible(bankIdRequired);
|
||||
bankIdInputTextField.setManaged(bankIdRequired);
|
||||
|
||||
boolean branchIdRequired = BankUtil.isBranchIdRequired(countryCode);
|
||||
branchIdTuple.first.setVisible(branchIdRequired);
|
||||
branchIdTuple.first.setManaged(branchIdRequired);
|
||||
branchIdInputTextField.setVisible(branchIdRequired);
|
||||
branchIdInputTextField.setManaged(branchIdRequired);
|
||||
|
||||
boolean accountNrRequired = BankUtil.isAccountNrRequired(countryCode);
|
||||
accountNrTuple.first.setVisible(accountNrRequired);
|
||||
accountNrTuple.first.setManaged(accountNrRequired);
|
||||
accountNrInputTextField.setVisible(accountNrRequired);
|
||||
accountNrInputTextField.setManaged(accountNrRequired);
|
||||
|
||||
boolean accountTypeRequired = BankUtil.isAccountTypeRequired(countryCode);
|
||||
accountTypeTuple.first.setVisible(accountTypeRequired);
|
||||
accountTypeTuple.first.setManaged(accountTypeRequired);
|
||||
accountTypeTuple.second.setVisible(accountTypeRequired);
|
||||
accountTypeTuple.second.setManaged(accountTypeRequired);
|
||||
|
||||
updateFromInputs();
|
||||
|
||||
onCountryChanged();
|
||||
}
|
||||
});
|
||||
|
||||
regionComboBox.setOnAction(e -> {
|
||||
Region selectedItem = regionComboBox.getSelectionModel().getSelectedItem();
|
||||
if (selectedItem != null) {
|
||||
countryComboBox.setDisable(false);
|
||||
countryComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllCountriesForRegion(selectedItem)));
|
||||
}
|
||||
});
|
||||
|
||||
//noinspection unchecked
|
||||
currencyComboBox = FormBuilder.addLabelComboBox(gridPane, ++gridRow, Res.getWithCol("shared.currency")).second;
|
||||
currencyComboBox.setPromptText(Res.get("list.currency.select"));
|
||||
currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getAllSortedFiatCurrencies()));
|
||||
currencyComboBox.setOnAction(e -> {
|
||||
TradeCurrency selectedItem = currencyComboBox.getSelectionModel().getSelectedItem();
|
||||
FiatCurrency defaultCurrency = CurrencyUtil.getCurrencyByCountryCode(countryComboBox.getSelectionModel().getSelectedItem().code);
|
||||
if (!defaultCurrency.equals(selectedItem)) {
|
||||
new Popup<>().warning(Res.get("payment.foreign.currency"))
|
||||
.actionButtonText(Res.get("shared.yes"))
|
||||
.onAction(() -> {
|
||||
paymentAccount.setSingleTradeCurrency(selectedItem);
|
||||
autoFillNameTextField();
|
||||
})
|
||||
.closeButtonText(Res.get("payment.restore.default"))
|
||||
.onClose(() -> currencyComboBox.getSelectionModel().select(defaultCurrency))
|
||||
.show();
|
||||
} else {
|
||||
paymentAccount.setSingleTradeCurrency(selectedItem);
|
||||
autoFillNameTextField();
|
||||
}
|
||||
});
|
||||
currencyComboBox.setConverter(new StringConverter<TradeCurrency>() {
|
||||
@Override
|
||||
public String toString(TradeCurrency currency) {
|
||||
return currency.getNameAndCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TradeCurrency fromString(String string) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
currencyComboBox.setDisable(true);
|
||||
Tuple2<ComboBox<TradeCurrency>, Integer> tuple = GUIUtil.addRegionCountryTradeCurrencyComboBoxes(gridPane, gridRow, this::onCountrySelected, this::onTradeCurrencySelected);
|
||||
currencyComboBox = tuple.first;
|
||||
gridRow = tuple.second;
|
||||
|
||||
addAcceptedBanksForAddAccount();
|
||||
|
||||
@ -568,7 +374,7 @@ public class CashDepositForm extends PaymentMethodForm {
|
||||
|
||||
accountTypeTuple = FormBuilder.addLabelComboBox(gridPane, ++gridRow, "");
|
||||
accountTypeLabel = accountTypeTuple.first;
|
||||
//noinspection unchecked
|
||||
|
||||
accountTypeComboBox = accountTypeTuple.second;
|
||||
accountTypeComboBox.setPromptText(Res.get("payment.select.account"));
|
||||
accountTypeComboBox.setOnAction(e -> {
|
||||
@ -592,6 +398,141 @@ public class CashDepositForm extends PaymentMethodForm {
|
||||
updateFromInputs();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
private void onCountrySelected(Country country) {
|
||||
selectedCountry = country;
|
||||
if (selectedCountry != null) {
|
||||
getCountryBasedPaymentAccount().setCountry(selectedCountry);
|
||||
String countryCode = selectedCountry.code;
|
||||
TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(countryCode);
|
||||
paymentAccount.setSingleTradeCurrency(currency);
|
||||
currencyComboBox.setDisable(false);
|
||||
currencyComboBox.getSelectionModel().select(currency);
|
||||
|
||||
bankIdLabel.setText(BankUtil.getBankIdLabel(countryCode));
|
||||
branchIdLabel.setText(BankUtil.getBranchIdLabel(countryCode));
|
||||
nationalAccountIdLabel.setText(BankUtil.getNationalAccountIdLabel(countryCode));
|
||||
accountNrLabel.setText(BankUtil.getAccountNrLabel(countryCode));
|
||||
accountTypeLabel.setText(BankUtil.getAccountTypeLabel(countryCode));
|
||||
|
||||
bankNameInputTextField.setText("");
|
||||
bankIdInputTextField.setText("");
|
||||
branchIdInputTextField.setText("");
|
||||
nationalAccountIdInputTextField.setText("");
|
||||
accountNrInputTextField.setText("");
|
||||
accountNrInputTextField.focusedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue) accountNrInputTextFieldEdited = true;
|
||||
});
|
||||
accountTypeComboBox.getSelectionModel().clearSelection();
|
||||
accountTypeComboBox.setItems(FXCollections.observableArrayList(BankUtil.getAccountTypeValues(countryCode)));
|
||||
|
||||
if (BankUtil.useValidation(countryCode) && !validatorsApplied) {
|
||||
validatorsApplied = true;
|
||||
if (useHolderID)
|
||||
holderIdInputTextField.setValidator(inputValidator);
|
||||
bankNameInputTextField.setValidator(inputValidator);
|
||||
bankIdInputTextField.setValidator(new BankIdValidator(countryCode));
|
||||
branchIdInputTextField.setValidator(new BranchIdValidator(countryCode));
|
||||
accountNrInputTextField.setValidator(new AccountNrValidator(countryCode));
|
||||
nationalAccountIdInputTextField.setValidator(new NationalAccountIdValidator(countryCode));
|
||||
} else {
|
||||
validatorsApplied = false;
|
||||
if (useHolderID)
|
||||
holderIdInputTextField.setValidator(null);
|
||||
bankNameInputTextField.setValidator(null);
|
||||
bankIdInputTextField.setValidator(null);
|
||||
branchIdInputTextField.setValidator(null);
|
||||
accountNrInputTextField.setValidator(null);
|
||||
nationalAccountIdInputTextField.setValidator(null);
|
||||
}
|
||||
holderNameInputTextField.resetValidation();
|
||||
emailInputTextField.resetValidation();
|
||||
bankNameInputTextField.resetValidation();
|
||||
bankIdInputTextField.resetValidation();
|
||||
branchIdInputTextField.resetValidation();
|
||||
accountNrInputTextField.resetValidation();
|
||||
nationalAccountIdInputTextField.resetValidation();
|
||||
|
||||
boolean requiresHolderId = BankUtil.isHolderIdRequired(countryCode);
|
||||
if (requiresHolderId) {
|
||||
holderNameInputTextField.minWidthProperty().unbind();
|
||||
holderNameInputTextField.setMinWidth(300);
|
||||
} else {
|
||||
holderNameInputTextField.minWidthProperty().bind(currencyComboBox.widthProperty());
|
||||
}
|
||||
|
||||
if (useHolderID) {
|
||||
if (!requiresHolderId)
|
||||
holderIdInputTextField.setText("");
|
||||
|
||||
holderIdInputTextField.resetValidation();
|
||||
holderIdInputTextField.setVisible(requiresHolderId);
|
||||
holderIdInputTextField.setManaged(requiresHolderId);
|
||||
|
||||
holderIdLabel.setText(BankUtil.getHolderIdLabel(countryCode));
|
||||
holderIdLabel.setVisible(requiresHolderId);
|
||||
holderIdLabel.setManaged(requiresHolderId);
|
||||
}
|
||||
|
||||
boolean nationalAccountIdRequired = BankUtil.isNationalAccountIdRequired(countryCode);
|
||||
nationalAccountIdTuple.first.setVisible(nationalAccountIdRequired);
|
||||
nationalAccountIdTuple.first.setManaged(nationalAccountIdRequired);
|
||||
nationalAccountIdInputTextField.setVisible(nationalAccountIdRequired);
|
||||
nationalAccountIdInputTextField.setManaged(nationalAccountIdRequired);
|
||||
|
||||
boolean bankNameRequired = BankUtil.isBankNameRequired(countryCode);
|
||||
bankNameTuple.first.setVisible(bankNameRequired);
|
||||
bankNameTuple.first.setManaged(bankNameRequired);
|
||||
bankNameInputTextField.setVisible(bankNameRequired);
|
||||
bankNameInputTextField.setManaged(bankNameRequired);
|
||||
|
||||
boolean bankIdRequired = BankUtil.isBankIdRequired(countryCode);
|
||||
bankIdTuple.first.setVisible(bankIdRequired);
|
||||
bankIdTuple.first.setManaged(bankIdRequired);
|
||||
bankIdInputTextField.setVisible(bankIdRequired);
|
||||
bankIdInputTextField.setManaged(bankIdRequired);
|
||||
|
||||
boolean branchIdRequired = BankUtil.isBranchIdRequired(countryCode);
|
||||
branchIdTuple.first.setVisible(branchIdRequired);
|
||||
branchIdTuple.first.setManaged(branchIdRequired);
|
||||
branchIdInputTextField.setVisible(branchIdRequired);
|
||||
branchIdInputTextField.setManaged(branchIdRequired);
|
||||
|
||||
boolean accountNrRequired = BankUtil.isAccountNrRequired(countryCode);
|
||||
accountNrTuple.first.setVisible(accountNrRequired);
|
||||
accountNrTuple.first.setManaged(accountNrRequired);
|
||||
accountNrInputTextField.setVisible(accountNrRequired);
|
||||
accountNrInputTextField.setManaged(accountNrRequired);
|
||||
|
||||
boolean accountTypeRequired = BankUtil.isAccountTypeRequired(countryCode);
|
||||
accountTypeTuple.first.setVisible(accountTypeRequired);
|
||||
accountTypeTuple.first.setManaged(accountTypeRequired);
|
||||
accountTypeTuple.second.setVisible(accountTypeRequired);
|
||||
accountTypeTuple.second.setManaged(accountTypeRequired);
|
||||
|
||||
updateFromInputs();
|
||||
|
||||
onCountryChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private CountryBasedPaymentAccount getCountryBasedPaymentAccount() {
|
||||
return (CountryBasedPaymentAccount) this.paymentAccount;
|
||||
}
|
||||
@ -668,8 +609,8 @@ public class CashDepositForm extends PaymentMethodForm {
|
||||
String nationalAccountId = nationalAccountIdInputTextField.getText();
|
||||
|
||||
if (countryCode.equals("AR") && nationalAccountId.length() == 22 && !accountNrInputTextFieldEdited) {
|
||||
branchIdInputTextField.setText(nationalAccountId.substring(3,7));
|
||||
accountNrInputTextField.setText(nationalAccountId.substring(8,21));
|
||||
branchIdInputTextField.setText(nationalAccountId.substring(3, 7));
|
||||
accountNrInputTextField.setText(nationalAccountId.substring(8, 21));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -703,7 +644,7 @@ public class CashDepositForm extends PaymentMethodForm {
|
||||
if (useHolderID && BankUtil.isHolderIdRequired(countryCode))
|
||||
result = result && holderIdInputTextField.getValidator().validate(cashDepositAccountPayload.getHolderTaxId()).isValid;
|
||||
|
||||
if(BankUtil.isNationalAccountIdRequired(countryCode))
|
||||
if (BankUtil.isNationalAccountIdRequired(countryCode))
|
||||
result = result && nationalAccountIdInputTextField.getValidator().validate(cashDepositAccountPayload.getNationalAccountId()).isValid;
|
||||
}
|
||||
allInputsValid.set(result);
|
||||
|
@ -18,6 +18,7 @@
|
||||
package bisq.desktop.components.paymentmethods;
|
||||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.Layout;
|
||||
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
@ -51,7 +52,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static bisq.desktop.util.FormBuilder.addLabelInputTextField;
|
||||
import static bisq.desktop.util.FormBuilder.addLabelSearchComboBox;
|
||||
import static bisq.desktop.util.FormBuilder.addLabelTextField;
|
||||
import static bisq.desktop.util.FormBuilder.addLabelTextFieldWithCopyIcon;
|
||||
|
||||
@ -159,8 +159,7 @@ public class CryptoCurrencyForm extends PaymentMethodForm {
|
||||
|
||||
@Override
|
||||
protected void addTradeCurrencyComboBox() {
|
||||
//noinspection unchecked
|
||||
currencyComboBox = addLabelSearchComboBox(gridPane, ++gridRow, Res.get("payment.altcoin"),
|
||||
currencyComboBox = FormBuilder.<TradeCurrency>addLabelSearchComboBox(gridPane, ++gridRow, Res.get("payment.altcoin"),
|
||||
Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
|
||||
currencyComboBox.setPromptText(Res.get("payment.select.altcoin"));
|
||||
currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getAllSortedCryptoCurrencies()));
|
||||
@ -176,10 +175,7 @@ public class CryptoCurrencyForm extends PaymentMethodForm {
|
||||
Optional<TradeCurrency> tradeCurrencyOptional = currencyComboBox.getItems().stream().
|
||||
filter(tradeCurrency -> tradeCurrency.getNameAndCode().equals(s)).
|
||||
findAny();
|
||||
if (tradeCurrencyOptional.isPresent())
|
||||
return tradeCurrencyOptional.get();
|
||||
else
|
||||
return null;
|
||||
return tradeCurrencyOptional.orElse(null);
|
||||
}
|
||||
});
|
||||
currencyComboBox.setOnAction(e -> {
|
||||
|
@ -19,6 +19,7 @@ package bisq.desktop.components.paymentmethods;
|
||||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.main.overlays.popups.Popup;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
import bisq.desktop.util.Layout;
|
||||
import bisq.desktop.util.validation.F2FValidator;
|
||||
|
||||
@ -26,7 +27,6 @@ import bisq.core.locale.Country;
|
||||
import bisq.core.locale.CountryUtil;
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.FiatCurrency;
|
||||
import bisq.core.locale.Region;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
import bisq.core.offer.Offer;
|
||||
@ -39,26 +39,24 @@ import bisq.core.payment.payload.PaymentAccountPayload;
|
||||
import bisq.core.util.BSFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import bisq.common.util.Tuple3;
|
||||
import bisq.common.util.Tuple2;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.layout.GridPane;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
|
||||
import javafx.util.StringConverter;
|
||||
|
||||
import static bisq.desktop.util.FormBuilder.*;
|
||||
import static bisq.desktop.util.FormBuilder.addLabelInputTextField;
|
||||
import static bisq.desktop.util.FormBuilder.addLabelTextArea;
|
||||
import static bisq.desktop.util.FormBuilder.addLabelTextField;
|
||||
import static bisq.desktop.util.FormBuilder.addLabelTextFieldWithCopyIcon;
|
||||
|
||||
public class F2FForm extends PaymentMethodForm {
|
||||
private final F2FAccount f2fAccount;
|
||||
private final F2FValidator f2fValidator;
|
||||
private TextArea extraTextArea;
|
||||
private InputTextField cityInputTextField;
|
||||
private Country selectedCountry;
|
||||
|
||||
public static int addFormForBuyer(GridPane gridPane, int gridRow,
|
||||
PaymentAccountPayload paymentAccountPayload, Offer offer) {
|
||||
@ -91,96 +89,9 @@ public class F2FForm extends PaymentMethodForm {
|
||||
public void addFormForAddAccount() {
|
||||
gridRowFrom = gridRow + 1;
|
||||
|
||||
Tuple3<Label, ComboBox, ComboBox> tuple3 = addLabelComboBoxComboBox(gridPane, ++gridRow, Res.get("payment.country"));
|
||||
|
||||
//noinspection unchecked,unchecked,unchecked
|
||||
ComboBox<Region> regionComboBox = tuple3.second;
|
||||
regionComboBox.setPromptText(Res.get("payment.select.region"));
|
||||
regionComboBox.setConverter(new StringConverter<Region>() {
|
||||
@Override
|
||||
public String toString(Region region) {
|
||||
return region.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Region fromString(String s) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
regionComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllRegions()));
|
||||
|
||||
//noinspection unchecked,unchecked,unchecked
|
||||
ComboBox<Country> countryComboBox = tuple3.third;
|
||||
countryComboBox.setVisibleRowCount(15);
|
||||
countryComboBox.setDisable(true);
|
||||
countryComboBox.setPromptText(Res.get("payment.select.country"));
|
||||
countryComboBox.setConverter(new StringConverter<Country>() {
|
||||
@Override
|
||||
public String toString(Country country) {
|
||||
return country.name + " (" + country.code + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Country fromString(String s) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
countryComboBox.setOnAction(e -> {
|
||||
Country selectedItem = countryComboBox.getSelectionModel().getSelectedItem();
|
||||
if (selectedItem != null) {
|
||||
getCountryBasedPaymentAccount().setCountry(selectedItem);
|
||||
String countryCode = selectedItem.code;
|
||||
TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(countryCode);
|
||||
paymentAccount.setSingleTradeCurrency(currency);
|
||||
currencyComboBox.setDisable(false);
|
||||
currencyComboBox.getSelectionModel().select(currency);
|
||||
|
||||
updateFromInputs();
|
||||
}
|
||||
});
|
||||
|
||||
regionComboBox.setOnAction(e -> {
|
||||
Region selectedItem = regionComboBox.getSelectionModel().getSelectedItem();
|
||||
if (selectedItem != null) {
|
||||
countryComboBox.setDisable(false);
|
||||
countryComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllCountriesForRegion(selectedItem)));
|
||||
}
|
||||
});
|
||||
|
||||
//noinspection unchecked
|
||||
currencyComboBox = addLabelComboBox(gridPane, ++gridRow, Res.getWithCol("shared.currency")).second;
|
||||
currencyComboBox.setPromptText(Res.get("list.currency.select"));
|
||||
currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getAllSortedFiatCurrencies()));
|
||||
currencyComboBox.setOnAction(e -> {
|
||||
TradeCurrency selectedItem = currencyComboBox.getSelectionModel().getSelectedItem();
|
||||
FiatCurrency defaultCurrency = CurrencyUtil.getCurrencyByCountryCode(countryComboBox.getSelectionModel().getSelectedItem().code);
|
||||
if (!defaultCurrency.equals(selectedItem)) {
|
||||
new Popup<>().warning(Res.get("payment.foreign.currency"))
|
||||
.actionButtonText(Res.get("shared.yes"))
|
||||
.onAction(() -> {
|
||||
paymentAccount.setSingleTradeCurrency(selectedItem);
|
||||
autoFillNameTextField();
|
||||
})
|
||||
.closeButtonText(Res.get("payment.restore.default"))
|
||||
.onClose(() -> currencyComboBox.getSelectionModel().select(defaultCurrency))
|
||||
.show();
|
||||
} else {
|
||||
paymentAccount.setSingleTradeCurrency(selectedItem);
|
||||
autoFillNameTextField();
|
||||
}
|
||||
});
|
||||
currencyComboBox.setConverter(new StringConverter<TradeCurrency>() {
|
||||
@Override
|
||||
public String toString(TradeCurrency currency) {
|
||||
return currency.getNameAndCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TradeCurrency fromString(String string) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
currencyComboBox.setDisable(true);
|
||||
Tuple2<ComboBox<TradeCurrency>, Integer> tuple = GUIUtil.addRegionCountryTradeCurrencyComboBoxes(gridPane, gridRow, this::onCountrySelected, this::onTradeCurrencySelected);
|
||||
currencyComboBox = tuple.first;
|
||||
gridRow = tuple.second;
|
||||
|
||||
InputTextField contactInputTextField = addLabelInputTextField(gridPane, ++gridRow,
|
||||
Res.getWithCol("payment.f2f.contact")).second;
|
||||
@ -200,7 +111,7 @@ public class F2FForm extends PaymentMethodForm {
|
||||
updateFromInputs();
|
||||
});
|
||||
|
||||
extraTextArea = addLabelTextArea(gridPane, ++gridRow,
|
||||
TextArea extraTextArea = addLabelTextArea(gridPane, ++gridRow,
|
||||
Res.getWithCol("payment.f2f.optionalExtra"), "").second;
|
||||
extraTextArea.setPromptText(Res.get("payment.f2f.extra.prompt"));
|
||||
extraTextArea.setPrefHeight(60);
|
||||
@ -214,6 +125,38 @@ public class F2FForm extends PaymentMethodForm {
|
||||
addAccountNameTextFieldWithAutoFillCheckBox();
|
||||
}
|
||||
|
||||
private void onCountrySelected(Country country) {
|
||||
selectedCountry = country;
|
||||
if (selectedCountry != null) {
|
||||
getCountryBasedPaymentAccount().setCountry(selectedCountry);
|
||||
String countryCode = selectedCountry.code;
|
||||
TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(countryCode);
|
||||
paymentAccount.setSingleTradeCurrency(currency);
|
||||
currencyComboBox.setDisable(false);
|
||||
currencyComboBox.getSelectionModel().select(currency);
|
||||
|
||||
updateFromInputs();
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void autoFillNameTextField() {
|
||||
if (useCustomAccountNameCheckBox != null && !useCustomAccountNameCheckBox.isSelected()) {
|
||||
|
@ -19,6 +19,7 @@ package bisq.desktop.components.paymentmethods;
|
||||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
import bisq.desktop.util.Layout;
|
||||
import bisq.desktop.util.validation.EmailValidator;
|
||||
|
||||
@ -26,7 +27,6 @@ import bisq.core.locale.BankUtil;
|
||||
import bisq.core.locale.Country;
|
||||
import bisq.core.locale.CountryUtil;
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.Region;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.payment.AccountAgeWitnessService;
|
||||
import bisq.core.payment.MoneyGramAccount;
|
||||
@ -37,12 +37,10 @@ import bisq.core.util.BSFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import bisq.common.util.Tuple2;
|
||||
import bisq.common.util.Tuple3;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.Tooltip;
|
||||
import javafx.scene.layout.FlowPane;
|
||||
@ -51,10 +49,6 @@ import javafx.scene.layout.GridPane;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.VPos;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
|
||||
import javafx.util.StringConverter;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import static bisq.desktop.util.FormBuilder.addLabel;
|
||||
@ -116,57 +110,7 @@ public class MoneyGramForm extends PaymentMethodForm {
|
||||
public void addFormForAddAccount() {
|
||||
gridRowFrom = gridRow + 1;
|
||||
|
||||
Tuple3<Label, ComboBox, ComboBox> tuple3 = FormBuilder.addLabelComboBoxComboBox(gridPane, ++gridRow, Res.get("payment.country"));
|
||||
|
||||
//noinspection unchecked,unchecked,unchecked
|
||||
ComboBox<Region> regionComboBox = tuple3.second;
|
||||
regionComboBox.setPromptText(Res.get("payment.select.region"));
|
||||
regionComboBox.setConverter(new StringConverter<Region>() {
|
||||
@Override
|
||||
public String toString(Region region) {
|
||||
return region.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Region fromString(String s) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
regionComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllRegions()));
|
||||
|
||||
//noinspection unchecked,unchecked,unchecked
|
||||
ComboBox<Country> countryComboBox = tuple3.third;
|
||||
countryComboBox.setVisibleRowCount(15);
|
||||
countryComboBox.setDisable(true);
|
||||
countryComboBox.setPromptText(Res.get("payment.select.country"));
|
||||
countryComboBox.setConverter(new StringConverter<Country>() {
|
||||
@Override
|
||||
public String toString(Country country) {
|
||||
return country.name + " (" + country.code + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Country fromString(String s) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
countryComboBox.setOnAction(e -> {
|
||||
Country selectedItem = countryComboBox.getSelectionModel().getSelectedItem();
|
||||
if (selectedItem != null) {
|
||||
getMoneyGramPaymentAccount().setCountry(selectedItem);
|
||||
updateFromInputs();
|
||||
applyIsStateRequired();
|
||||
stateInputTextField.setText("");
|
||||
}
|
||||
});
|
||||
|
||||
regionComboBox.setOnAction(e -> {
|
||||
Region selectedItem = regionComboBox.getSelectionModel().getSelectedItem();
|
||||
if (selectedItem != null) {
|
||||
countryComboBox.setDisable(false);
|
||||
countryComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllCountriesForRegion(selectedItem)));
|
||||
}
|
||||
});
|
||||
gridRow = GUIUtil.addRegionCountry(gridPane, gridRow, this::onCountrySelected);
|
||||
|
||||
holderNameInputTextField = FormBuilder.addLabelInputTextField(gridPane,
|
||||
++gridRow, Res.getWithCol("payment.account.fullName")).second;
|
||||
@ -200,6 +144,15 @@ public class MoneyGramForm extends PaymentMethodForm {
|
||||
updateFromInputs();
|
||||
}
|
||||
|
||||
private void onCountrySelected(Country country) {
|
||||
if (country != null) {
|
||||
getMoneyGramPaymentAccount().setCountry(country);
|
||||
updateFromInputs();
|
||||
applyIsStateRequired();
|
||||
stateInputTextField.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
private void addCurrenciesGrid(boolean isEditable) {
|
||||
Label label = addLabel(gridPane, ++gridRow, Res.get("payment.supportedCurrencies"), 0);
|
||||
GridPane.setValignment(label, VPos.TOP);
|
||||
|
@ -31,7 +31,7 @@ public class NationalBankForm extends BankForm {
|
||||
}
|
||||
|
||||
public NationalBankForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator,
|
||||
GridPane gridPane, int gridRow, BSFormatter formatter, Runnable closeHandler) {
|
||||
super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter, closeHandler);
|
||||
GridPane gridPane, int gridRow, BSFormatter formatter) {
|
||||
super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter);
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ package bisq.desktop.components.paymentmethods;
|
||||
import bisq.desktop.components.InfoTextField;
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.main.overlays.popups.Popup;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.Res;
|
||||
@ -67,7 +68,8 @@ public abstract class PaymentMethodForm {
|
||||
protected CheckBox useCustomAccountNameCheckBox;
|
||||
protected ComboBox<TradeCurrency> currencyComboBox;
|
||||
|
||||
public PaymentMethodForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) {
|
||||
public PaymentMethodForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService,
|
||||
InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) {
|
||||
this.paymentAccount = paymentAccount;
|
||||
this.accountAgeWitnessService = accountAgeWitnessService;
|
||||
this.inputValidator = inputValidator;
|
||||
@ -77,8 +79,7 @@ public abstract class PaymentMethodForm {
|
||||
}
|
||||
|
||||
protected void addTradeCurrencyComboBox() {
|
||||
//noinspection unchecked
|
||||
currencyComboBox = addLabelComboBox(gridPane, ++gridRow, Res.getWithCol("shared.currency")).second;
|
||||
currencyComboBox = FormBuilder.<TradeCurrency>addLabelComboBox(gridPane, ++gridRow, Res.getWithCol("shared.currency")).second;
|
||||
currencyComboBox.setPromptText(Res.get("list.currency.select"));
|
||||
currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getMainFiatCurrencies()));
|
||||
currencyComboBox.setConverter(new StringConverter<TradeCurrency>() {
|
||||
|
@ -36,7 +36,7 @@ public class SameBankForm extends BankForm {
|
||||
}
|
||||
|
||||
public SameBankForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator,
|
||||
GridPane gridPane, int gridRow, BSFormatter formatter, Runnable closeHandler) {
|
||||
super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter, closeHandler);
|
||||
GridPane gridPane, int gridRow, BSFormatter formatter) {
|
||||
super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter);
|
||||
}
|
||||
}
|
||||
|
@ -53,8 +53,8 @@ public class SpecificBankForm extends BankForm {
|
||||
}
|
||||
|
||||
public SpecificBankForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator,
|
||||
GridPane gridPane, int gridRow, BSFormatter formatter, Runnable closeHandler) {
|
||||
super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter, closeHandler);
|
||||
GridPane gridPane, int gridRow, BSFormatter formatter) {
|
||||
super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter);
|
||||
this.specificBanksAccountPayload = (SpecificBanksAccountPayload) paymentAccount.paymentAccountPayload;
|
||||
}
|
||||
|
||||
|
@ -20,15 +20,14 @@ 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;
|
||||
import bisq.desktop.util.validation.EmailValidator;
|
||||
|
||||
import bisq.core.locale.BankUtil;
|
||||
import bisq.core.locale.Country;
|
||||
import bisq.core.locale.CountryUtil;
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.FiatCurrency;
|
||||
import bisq.core.locale.Region;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
import bisq.core.payment.AccountAgeWitnessService;
|
||||
@ -40,7 +39,6 @@ import bisq.core.util.BSFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import bisq.common.util.Tuple2;
|
||||
import bisq.common.util.Tuple3;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@ -48,17 +46,12 @@ import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.layout.GridPane;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
|
||||
import javafx.util.StringConverter;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import static bisq.desktop.util.FormBuilder.addLabelTextFieldWithCopyIcon;
|
||||
|
||||
@Slf4j
|
||||
public class WesternUnionForm extends PaymentMethodForm {
|
||||
|
||||
public static int addFormForBuyer(GridPane gridPane, int gridRow,
|
||||
PaymentAccountPayload paymentAccountPayload) {
|
||||
final WesternUnionAccountPayload payload = (WesternUnionAccountPayload) paymentAccountPayload;
|
||||
@ -75,11 +68,11 @@ public class WesternUnionForm extends PaymentMethodForm {
|
||||
return gridRow;
|
||||
}
|
||||
|
||||
protected final WesternUnionAccountPayload westernUnionAccountPayload;
|
||||
protected InputTextField holderNameInputTextField, emailInputTextField, cityInputTextField, stateInputTextField;
|
||||
private final WesternUnionAccountPayload westernUnionAccountPayload;
|
||||
private InputTextField holderNameInputTextField, emailInputTextField, cityInputTextField, stateInputTextField;
|
||||
private Label stateLabel;
|
||||
private ComboBox<TradeCurrency> currencyComboBox;
|
||||
private final EmailValidator emailValidator;
|
||||
private Country selectedCountry;
|
||||
|
||||
public WesternUnionForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator,
|
||||
GridPane gridPane, int gridRow, BSFormatter formatter) {
|
||||
@ -115,102 +108,47 @@ public class WesternUnionForm extends PaymentMethodForm {
|
||||
addLimitations();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
private void onCountrySelected(Country country) {
|
||||
selectedCountry = country;
|
||||
if (country != null) {
|
||||
getCountryBasedPaymentAccount().setCountry(country);
|
||||
String countryCode = country.code;
|
||||
TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(countryCode);
|
||||
paymentAccount.setSingleTradeCurrency(currency);
|
||||
currencyComboBox.setDisable(false);
|
||||
currencyComboBox.getSelectionModel().select(currency);
|
||||
updateFromInputs();
|
||||
applyIsStateRequired();
|
||||
cityInputTextField.setText("");
|
||||
stateInputTextField.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFormForAddAccount() {
|
||||
gridRowFrom = gridRow + 1;
|
||||
|
||||
Tuple3<Label, ComboBox, ComboBox> tuple3 = FormBuilder.addLabelComboBoxComboBox(gridPane, ++gridRow, Res.get("payment.country"));
|
||||
|
||||
//noinspection unchecked,unchecked,unchecked
|
||||
ComboBox<Region> regionComboBox = tuple3.second;
|
||||
regionComboBox.setPromptText(Res.get("payment.select.region"));
|
||||
regionComboBox.setConverter(new StringConverter<Region>() {
|
||||
@Override
|
||||
public String toString(Region region) {
|
||||
return region.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Region fromString(String s) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
regionComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllRegions()));
|
||||
|
||||
//noinspection unchecked,unchecked,unchecked
|
||||
ComboBox<Country> countryComboBox = tuple3.third;
|
||||
countryComboBox.setVisibleRowCount(15);
|
||||
countryComboBox.setDisable(true);
|
||||
countryComboBox.setPromptText(Res.get("payment.select.country"));
|
||||
countryComboBox.setConverter(new StringConverter<Country>() {
|
||||
@Override
|
||||
public String toString(Country country) {
|
||||
return country.name + " (" + country.code + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Country fromString(String s) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
countryComboBox.setOnAction(e -> {
|
||||
Country selectedItem = countryComboBox.getSelectionModel().getSelectedItem();
|
||||
if (selectedItem != null) {
|
||||
getCountryBasedPaymentAccount().setCountry(selectedItem);
|
||||
String countryCode = selectedItem.code;
|
||||
TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(countryCode);
|
||||
paymentAccount.setSingleTradeCurrency(currency);
|
||||
currencyComboBox.setDisable(false);
|
||||
currencyComboBox.getSelectionModel().select(currency);
|
||||
updateFromInputs();
|
||||
applyIsStateRequired();
|
||||
cityInputTextField.setText("");
|
||||
stateInputTextField.setText("");
|
||||
}
|
||||
});
|
||||
|
||||
regionComboBox.setOnAction(e -> {
|
||||
Region selectedItem = regionComboBox.getSelectionModel().getSelectedItem();
|
||||
if (selectedItem != null) {
|
||||
countryComboBox.setDisable(false);
|
||||
countryComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllCountriesForRegion(selectedItem)));
|
||||
}
|
||||
});
|
||||
|
||||
//noinspection unchecked
|
||||
currencyComboBox = FormBuilder.addLabelComboBox(gridPane, ++gridRow, Res.getWithCol("shared.currency")).second;
|
||||
currencyComboBox.setPromptText(Res.get("list.currency.select"));
|
||||
currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getAllSortedFiatCurrencies()));
|
||||
currencyComboBox.setOnAction(e -> {
|
||||
TradeCurrency selectedItem = currencyComboBox.getSelectionModel().getSelectedItem();
|
||||
FiatCurrency defaultCurrency = CurrencyUtil.getCurrencyByCountryCode(countryComboBox.getSelectionModel().getSelectedItem().code);
|
||||
if (!defaultCurrency.equals(selectedItem)) {
|
||||
new Popup<>().warning(Res.get("payment.foreign.currency"))
|
||||
.actionButtonText(Res.get("shared.yes"))
|
||||
.onAction(() -> {
|
||||
paymentAccount.setSingleTradeCurrency(selectedItem);
|
||||
autoFillNameTextField();
|
||||
})
|
||||
.closeButtonText(Res.get("payment.restore.default"))
|
||||
.onClose(() -> currencyComboBox.getSelectionModel().select(defaultCurrency))
|
||||
.show();
|
||||
} else {
|
||||
paymentAccount.setSingleTradeCurrency(selectedItem);
|
||||
autoFillNameTextField();
|
||||
}
|
||||
});
|
||||
currencyComboBox.setConverter(new StringConverter<TradeCurrency>() {
|
||||
@Override
|
||||
public String toString(TradeCurrency currency) {
|
||||
return currency.getNameAndCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TradeCurrency fromString(String string) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
currencyComboBox.setDisable(true);
|
||||
Tuple2<ComboBox<TradeCurrency>, Integer> tuple = GUIUtil.addRegionCountryTradeCurrencyComboBoxes(gridPane, gridRow, this::onCountrySelected, this::onTradeCurrencySelected);
|
||||
currencyComboBox = tuple.first;
|
||||
gridRow = tuple.second;
|
||||
|
||||
holderNameInputTextField = FormBuilder.addLabelInputTextField(gridPane,
|
||||
++gridRow, Res.getWithCol("payment.account.fullName")).second;
|
||||
|
@ -713,7 +713,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
||||
|
||||
private final Class<? extends View> viewClass;
|
||||
|
||||
public NavButton(Class<? extends View> viewClass, String title) {
|
||||
NavButton(Class<? extends View> viewClass, String title) {
|
||||
super(title, new ImageView() {{
|
||||
setId("image-nav-" + viewId(viewClass));
|
||||
}});
|
||||
@ -740,7 +740,6 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
||||
}
|
||||
});
|
||||
|
||||
//noinspection unchecked
|
||||
this.setOnAction(e -> navigation.navigateTo(MainView.class, viewClass));
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,6 @@ public class AccountView extends ActivatableView<TabPane, AccountViewModel> {
|
||||
navigationListener = viewPath -> {
|
||||
if (viewPath.size() == 3 && viewPath.indexOf(AccountView.class) == 1) {
|
||||
if (arbitratorRegistrationTab == null && viewPath.get(2).equals(ArbitratorRegistrationView.class))
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, FiatAccountsView.class);
|
||||
else
|
||||
loadView(viewPath.tip());
|
||||
@ -98,16 +97,12 @@ public class AccountView extends ActivatableView<TabPane, AccountViewModel> {
|
||||
if (newValue == accountSettingsTab) {
|
||||
Class<? extends View> selectedViewClass = accountSettingsView.getSelectedViewClass();
|
||||
if (selectedViewClass == null)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, FiatAccountsView.class);
|
||||
else
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, selectedViewClass);
|
||||
} else if (arbitratorRegistrationTab != null) {
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, AccountView.class, ArbitratorRegistrationView.class);
|
||||
} else {
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class);
|
||||
}
|
||||
};
|
||||
@ -124,13 +119,10 @@ public class AccountView extends ActivatableView<TabPane, AccountViewModel> {
|
||||
|
||||
if (navigation.getCurrentPath().size() == 2 && navigation.getCurrentPath().get(1) == AccountView.class) {
|
||||
if (root.getSelectionModel().getSelectedItem() == accountSettingsTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class);
|
||||
else if (arbitratorRegistrationTab != null)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, AccountView.class, ArbitratorRegistrationView.class);
|
||||
else
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class);
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,10 @@ import javafx.collections.ListChangeListener;
|
||||
import javafx.util.Callback;
|
||||
import javafx.util.StringConverter;
|
||||
|
||||
import static bisq.desktop.util.FormBuilder.*;
|
||||
import static bisq.desktop.util.FormBuilder.addButton;
|
||||
import static bisq.desktop.util.FormBuilder.addButtonAfterGroup;
|
||||
import static bisq.desktop.util.FormBuilder.addMultilineLabel;
|
||||
import static bisq.desktop.util.FormBuilder.addTitledGroupBg;
|
||||
|
||||
@FxmlView
|
||||
public class ArbitratorRegistrationView extends ActivatableViewAndModel<VBox, ArbitratorRegistrationViewModel> {
|
||||
@ -153,9 +156,8 @@ public class ArbitratorRegistrationView extends ActivatableViewAndModel<VBox, Ar
|
||||
|
||||
pubKeyTextField.textProperty().bind(model.registrationPubKeyAsHex);
|
||||
|
||||
Tuple2<Label, ListView> tuple = addLabelListView(gridPane, ++gridRow, Res.get("shared.yourLanguage"));
|
||||
Tuple2<Label, ListView<String>> tuple = FormBuilder.addLabelListView(gridPane, ++gridRow, Res.get("shared.yourLanguage"));
|
||||
GridPane.setValignment(tuple.first, VPos.TOP);
|
||||
//noinspection unchecked
|
||||
languagesListView = tuple.second;
|
||||
languagesListView.disableProperty().bind(model.registrationEditDisabled);
|
||||
languagesListView.setMinHeight(3 * Layout.LIST_ROW_HEIGHT + 2);
|
||||
@ -190,8 +192,7 @@ public class ArbitratorRegistrationView extends ActivatableViewAndModel<VBox, Ar
|
||||
}
|
||||
});
|
||||
|
||||
//noinspection unchecked
|
||||
languageComboBox = addLabelComboBox(gridPane, ++gridRow).second;
|
||||
languageComboBox = FormBuilder.<String>addLabelComboBox(gridPane, ++gridRow).second;
|
||||
languageComboBox.disableProperty().bind(model.registrationEditDisabled);
|
||||
languageComboBox.setPromptText(Res.get("shared.addLanguage"));
|
||||
languageComboBox.setConverter(new StringConverter<String>() {
|
||||
|
@ -66,7 +66,6 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static bisq.desktop.util.FormBuilder.add2ButtonsAfterGroup;
|
||||
import static bisq.desktop.util.FormBuilder.add3ButtonsAfterGroup;
|
||||
import static bisq.desktop.util.FormBuilder.addLabelListView;
|
||||
import static bisq.desktop.util.FormBuilder.addTitledGroupBg;
|
||||
|
||||
@FxmlView
|
||||
@ -213,9 +212,8 @@ public class AltCoinAccountsView extends ActivatableViewAndModel<GridPane, AltCo
|
||||
private void buildForm() {
|
||||
addTitledGroupBg(root, gridRow, 1, Res.get("shared.manageAccounts"));
|
||||
|
||||
Tuple2<Label, ListView> tuple = addLabelListView(root, gridRow, Res.get("account.altcoin.yourAltcoinAccounts"), Layout.FIRST_ROW_DISTANCE);
|
||||
Tuple2<Label, ListView<PaymentAccount>> tuple = FormBuilder.addLabelListView(root, gridRow, Res.get("account.altcoin.yourAltcoinAccounts"), Layout.FIRST_ROW_DISTANCE);
|
||||
GridPane.setValignment(tuple.first, VPos.TOP);
|
||||
//noinspection unchecked
|
||||
paymentAccountsListView = tuple.second;
|
||||
paymentAccountsListView.setPrefHeight(2 * Layout.LIST_ROW_HEIGHT + 14);
|
||||
paymentAccountsListView.setCellFactory(new Callback<ListView<PaymentAccount>, ListCell<PaymentAccount>>() {
|
||||
|
@ -25,6 +25,7 @@ import bisq.desktop.components.AutoTooltipLabel;
|
||||
import bisq.desktop.components.AutoTooltipTableColumn;
|
||||
import bisq.desktop.components.TableGroupHeadline;
|
||||
import bisq.desktop.main.overlays.popups.Popup;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.ImageUtil;
|
||||
import bisq.desktop.util.Layout;
|
||||
|
||||
@ -65,8 +66,6 @@ import javafx.util.Callback;
|
||||
import javafx.util.StringConverter;
|
||||
|
||||
import static bisq.desktop.util.FormBuilder.addCheckBox;
|
||||
import static bisq.desktop.util.FormBuilder.addLabelComboBox;
|
||||
import static bisq.desktop.util.FormBuilder.addLabelListView;
|
||||
import static bisq.desktop.util.FormBuilder.addTitledGroupBg;
|
||||
|
||||
@FxmlView
|
||||
@ -157,9 +156,8 @@ public class ArbitratorSelectionView extends ActivatableViewAndModel<GridPane, A
|
||||
private void addLanguageGroup() {
|
||||
addTitledGroupBg(root, gridRow, 1, Res.get("account.arbitratorSelection.whichLanguages"));
|
||||
|
||||
Tuple2<Label, ListView> tuple = addLabelListView(root, gridRow, Res.get("shared.yourLanguage"), Layout.FIRST_ROW_DISTANCE);
|
||||
Tuple2<Label, ListView<String>> tuple = FormBuilder.addLabelListView(root, gridRow, Res.get("shared.yourLanguage"), Layout.FIRST_ROW_DISTANCE);
|
||||
GridPane.setValignment(tuple.first, VPos.TOP);
|
||||
//noinspection unchecked
|
||||
languagesListView = tuple.second;
|
||||
languagesListView.setMinHeight(3 * Layout.LIST_ROW_HEIGHT + 2);
|
||||
languagesListView.setMaxHeight(6 * Layout.LIST_ROW_HEIGHT + 2);
|
||||
@ -193,8 +191,7 @@ public class ArbitratorSelectionView extends ActivatableViewAndModel<GridPane, A
|
||||
}
|
||||
});
|
||||
|
||||
//noinspection unchecked
|
||||
languageComboBox = addLabelComboBox(root, ++gridRow, "", 15).second;
|
||||
languageComboBox = FormBuilder.<String>addLabelComboBox(root, ++gridRow, "", 15).second;
|
||||
languageComboBox.setPromptText(Res.get("shared.addLanguage"));
|
||||
languageComboBox.setConverter(new StringConverter<String>() {
|
||||
@Override
|
||||
@ -334,8 +331,7 @@ public class ArbitratorSelectionView extends ActivatableViewAndModel<GridPane, A
|
||||
|
||||
setGraphic(null);
|
||||
|
||||
if (checkBox != null)
|
||||
checkBox.setOnAction(null);
|
||||
checkBox.setOnAction(null);
|
||||
if (tableRow != null)
|
||||
tableRow.setOnMouseClicked(null);
|
||||
}
|
||||
|
@ -118,7 +118,9 @@ import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static bisq.desktop.util.FormBuilder.*;
|
||||
import static bisq.desktop.util.FormBuilder.add2ButtonsAfterGroup;
|
||||
import static bisq.desktop.util.FormBuilder.add3ButtonsAfterGroup;
|
||||
import static bisq.desktop.util.FormBuilder.addTitledGroupBg;
|
||||
|
||||
@FxmlView
|
||||
public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAccountsViewModel> {
|
||||
@ -323,10 +325,9 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
|
||||
private void buildForm() {
|
||||
addTitledGroupBg(root, gridRow, 1, Res.get("shared.manageAccounts"));
|
||||
|
||||
Tuple2<Label, ListView> tuple = addLabelListView(root, gridRow, Res.get("account.fiat.yourFiatAccounts"), Layout.FIRST_ROW_DISTANCE);
|
||||
Tuple2<Label, ListView<PaymentAccount>> tuple = FormBuilder.addLabelListView(root, gridRow, Res.get("account.fiat.yourFiatAccounts"), Layout.FIRST_ROW_DISTANCE);
|
||||
GridPane.setValignment(tuple.first, VPos.TOP);
|
||||
tuple.first.setTextAlignment(TextAlignment.RIGHT);
|
||||
//noinspection unchecked
|
||||
paymentAccountsListView = tuple.second;
|
||||
paymentAccountsListView.setPrefHeight(2 * Layout.LIST_ROW_HEIGHT + 14);
|
||||
paymentAccountsListView.setCellFactory(new Callback<ListView<PaymentAccount>, ListCell<PaymentAccount>>() {
|
||||
@ -372,8 +373,7 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
|
||||
removeAccountRows();
|
||||
addAccountButton.setDisable(true);
|
||||
accountTitledGroupBg = addTitledGroupBg(root, ++gridRow, 1, Res.get("shared.createNewAccount"), Layout.GROUP_DISTANCE);
|
||||
//noinspection unchecked
|
||||
paymentMethodComboBox = addLabelComboBox(root, gridRow, Res.getWithCol("shared.paymentMethod"), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
|
||||
paymentMethodComboBox = FormBuilder.<PaymentMethod>addLabelComboBox(root, gridRow, Res.getWithCol("shared.paymentMethod"), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
|
||||
paymentMethodComboBox.setPromptText(Res.get("shared.selectPaymentMethod"));
|
||||
paymentMethodComboBox.setVisibleRowCount(11);
|
||||
paymentMethodComboBox.setPrefWidth(250);
|
||||
@ -474,11 +474,11 @@ public class FiatAccountsView extends ActivatableViewAndModel<GridPane, FiatAcco
|
||||
case PaymentMethod.FASTER_PAYMENTS_ID:
|
||||
return new FasterPaymentsForm(paymentAccount, accountAgeWitnessService, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.NATIONAL_BANK_ID:
|
||||
return new NationalBankForm(paymentAccount, accountAgeWitnessService, inputValidator, root, gridRow, formatter, this::onCancelNewAccount);
|
||||
return new NationalBankForm(paymentAccount, accountAgeWitnessService, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.SAME_BANK_ID:
|
||||
return new SameBankForm(paymentAccount, accountAgeWitnessService, inputValidator, root, gridRow, formatter, this::onCancelNewAccount);
|
||||
return new SameBankForm(paymentAccount, accountAgeWitnessService, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.SPECIFIC_BANKS_ID:
|
||||
return new SpecificBankForm(paymentAccount, accountAgeWitnessService, inputValidator, root, gridRow, formatter, this::onCancelNewAccount);
|
||||
return new SpecificBankForm(paymentAccount, accountAgeWitnessService, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.ALI_PAY_ID:
|
||||
return new AliPayForm(paymentAccount, accountAgeWitnessService, aliPayValidator, inputValidator, root, gridRow, formatter);
|
||||
case PaymentMethod.WECHAT_PAY_ID:
|
||||
|
@ -109,7 +109,6 @@ public class PasswordView extends ActivatableView<GridPane, Void> {
|
||||
.actionButtonTextWithGoTo("navigation.account.walletSeed")
|
||||
.onAction(() -> {
|
||||
navigation.setReturnPath(navigation.getCurrentPath());
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, SeedWordsView.class);
|
||||
})
|
||||
.show();
|
||||
|
@ -205,7 +205,6 @@ class MenuItem extends AutoTooltipToggleButton {
|
||||
}
|
||||
|
||||
public void activate() {
|
||||
//noinspection unchecked
|
||||
setOnAction((event) -> navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, viewClass));
|
||||
selectedProperty().addListener(selectedPropertyChangeListener);
|
||||
disableProperty().addListener(disablePropertyChangeListener);
|
||||
|
@ -83,7 +83,6 @@ public class DaoView extends ActivatableViewAndModel<TabPane, Activatable> {
|
||||
navigationListener = viewPath -> {
|
||||
if (viewPath.size() == 3 && viewPath.indexOf(DaoView.class) == 1) {
|
||||
if (compensationTab == null && viewPath.get(2).equals(BsqWalletView.class))
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, DaoView.class, BsqWalletView.class);
|
||||
else
|
||||
loadView(viewPath.tip());
|
||||
@ -94,16 +93,12 @@ public class DaoView extends ActivatableViewAndModel<TabPane, Activatable> {
|
||||
if (newValue == bsqWalletTab) {
|
||||
Class<? extends View> selectedViewClass = bsqWalletView.getSelectedViewClass();
|
||||
if (selectedViewClass == null)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, DaoView.class, BsqWalletView.class, BsqDashboardView.class);
|
||||
else
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, DaoView.class, BsqWalletView.class, selectedViewClass);
|
||||
} else if (newValue == compensationTab) {
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, DaoView.class, ProposalView.class);
|
||||
} else if (newValue == votingTab) {
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, DaoView.class, VotingView.class);
|
||||
}
|
||||
};
|
||||
@ -117,13 +112,10 @@ public class DaoView extends ActivatableViewAndModel<TabPane, Activatable> {
|
||||
if (navigation.getCurrentPath().size() == 2 && navigation.getCurrentPath().get(1) == DaoView.class) {
|
||||
Tab selectedItem = root.getSelectionModel().getSelectedItem();
|
||||
if (selectedItem == bsqWalletTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, DaoView.class, BsqWalletView.class);
|
||||
else if (selectedItem == compensationTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, DaoView.class, ProposalView.class);
|
||||
else if (selectedItem == votingTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, DaoView.class, VotingView.class);
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import bisq.desktop.common.view.ActivatableView;
|
||||
import bisq.desktop.common.view.FxmlView;
|
||||
import bisq.desktop.main.dao.proposal.ProposalDisplay;
|
||||
import bisq.desktop.main.overlays.popups.Popup;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
import bisq.desktop.util.Layout;
|
||||
|
||||
@ -72,7 +73,6 @@ import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import static bisq.desktop.util.FormBuilder.addButtonAfterGroup;
|
||||
import static bisq.desktop.util.FormBuilder.addLabelComboBox;
|
||||
import static bisq.desktop.util.FormBuilder.addTitledGroupBg;
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
@ -131,7 +131,7 @@ public class MakeProposalView extends ActivatableView<GridPane, Void> {
|
||||
@Override
|
||||
public void initialize() {
|
||||
addTitledGroupBg(root, 0, 1, Res.get("dao.proposal.create.selectProposalType"));
|
||||
proposalTypeComboBox = addLabelComboBox(root, 0,
|
||||
proposalTypeComboBox = FormBuilder.<ProposalType>addLabelComboBox(root, 0,
|
||||
Res.getWithCol("dao.proposal.create.proposalType"), Layout.FIRST_ROW_DISTANCE).second;
|
||||
proposalTypeComboBox.setConverter(new StringConverter<ProposalType>() {
|
||||
@Override
|
||||
|
@ -185,7 +185,6 @@ class MenuItem extends AutoTooltipToggleButton {
|
||||
}
|
||||
|
||||
public void activate() {
|
||||
//noinspection unchecked
|
||||
setOnAction((event) -> navigation.navigateTo(MainView.class, DaoView.class, VotingView.class, viewClass));
|
||||
selectedProperty().addListener(selectedPropertyChangeListener);
|
||||
disableProperty().addListener(disablePropertyChangeListener);
|
||||
|
@ -206,7 +206,6 @@ class MenuItem extends AutoTooltipToggleButton {
|
||||
}
|
||||
|
||||
public void activate() {
|
||||
//noinspection unchecked
|
||||
setOnAction((event) -> navigation.navigateTo(MainView.class, DaoView.class, BsqWalletView.class, viewClass));
|
||||
selectedProperty().addListener(selectedPropertyChangeListener);
|
||||
disableProperty().addListener(disablePropertyChangeListener);
|
||||
|
@ -178,7 +178,6 @@ public class BsqSendView extends ActivatableView<GridPane, Void> implements BsqB
|
||||
if (t instanceof InsufficientMoneyException) {
|
||||
final Coin missingCoin = ((InsufficientMoneyException) t).missing;
|
||||
final String missing = missingCoin != null ? missingCoin.toFriendlyString() : "null";
|
||||
//noinspection unchecked
|
||||
new Popup<>().warning(Res.get("popup.warning.insufficientBtcFundsForBsqTx", missing))
|
||||
.actionButtonTextWithGoTo("navigation.funds.depositFunds")
|
||||
.onAction(() -> navigation.navigateTo(MainView.class, FundsView.class, DepositView.class))
|
||||
|
@ -214,19 +214,19 @@ public class DebugView extends InitializableView<GridPane, Void> {
|
||||
));
|
||||
}
|
||||
|
||||
private void addGroup(String title, ObservableList<Class> list) {
|
||||
ComboBox<Class> comboBox = FormBuilder.addLabelComboBox(root, ++rowIndex, title).second;
|
||||
private void addGroup(String title, ObservableList<Class<? extends Task>> list) {
|
||||
ComboBox<Class<? extends Task>> comboBox = FormBuilder.<Class<? extends Task>>addLabelComboBox(root, ++rowIndex, title).second;
|
||||
comboBox.setVisibleRowCount(list.size());
|
||||
comboBox.setItems(list);
|
||||
comboBox.setPromptText("Select task to intercept");
|
||||
comboBox.setConverter(new StringConverter<Class>() {
|
||||
comboBox.setConverter(new StringConverter<Class<? extends Task>>() {
|
||||
@Override
|
||||
public String toString(Class item) {
|
||||
public String toString(Class<? extends Task> item) {
|
||||
return item.getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class fromString(String s) {
|
||||
public Class<? extends Task> fromString(String s) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
@ -92,10 +92,8 @@ public class DisputesView extends ActivatableViewAndModel<TabPane, Activatable>
|
||||
|
||||
tabChangeListener = (ov, oldValue, newValue) -> {
|
||||
if (newValue == tradersDisputesTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, DisputesView.class, TraderDisputeView.class);
|
||||
else if (newValue == arbitratorsDisputesTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, DisputesView.class, ArbitratorDisputeView.class);
|
||||
};
|
||||
|
||||
@ -104,12 +102,10 @@ public class DisputesView extends ActivatableViewAndModel<TabPane, Activatable>
|
||||
|
||||
private void updateArbitratorsDisputesTabDisableState() {
|
||||
boolean isActiveArbitrator = arbitratorManager.getArbitratorsObservableMap().values().stream()
|
||||
.filter(e -> e.getPubKeyRing() != null && e.getPubKeyRing().equals(keyRing.getPubKeyRing()))
|
||||
.findAny().isPresent();
|
||||
.anyMatch(e -> e.getPubKeyRing() != null && e.getPubKeyRing().equals(keyRing.getPubKeyRing()));
|
||||
|
||||
boolean hasDisputesAsArbitrator = disputeManager.getDisputesAsObservableList().stream()
|
||||
.filter(d -> d.getArbitratorPubKeyRing().equals(keyRing.getPubKeyRing()))
|
||||
.findAny().isPresent();
|
||||
.anyMatch(d -> d.getArbitratorPubKeyRing().equals(keyRing.getPubKeyRing()));
|
||||
|
||||
if (arbitratorsDisputesTab == null && (isActiveArbitrator || hasDisputesAsArbitrator)) {
|
||||
arbitratorsDisputesTab = new Tab(Res.get("support.tab.ArbitratorsSupportTickets"));
|
||||
@ -130,16 +126,13 @@ public class DisputesView extends ActivatableViewAndModel<TabPane, Activatable>
|
||||
navigation.addListener(navigationListener);
|
||||
|
||||
if (arbitratorsDisputesTab != null && root.getSelectionModel().getSelectedItem() == arbitratorsDisputesTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, DisputesView.class, ArbitratorDisputeView.class);
|
||||
else
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, DisputesView.class, TraderDisputeView.class);
|
||||
|
||||
//noinspection UnusedAssignment
|
||||
String key = "supportInfo";
|
||||
if (!DevEnv.isDevMode())
|
||||
//noinspection unchecked
|
||||
new Popup<>().backgroundInfo(Res.get("support.backgroundInfo"))
|
||||
.width(900)
|
||||
.dontShowAgainId(key)
|
||||
|
@ -76,19 +76,14 @@ public class FundsView extends ActivatableViewAndModel<TabPane, Activatable> {
|
||||
|
||||
tabChangeListener = (ov, oldValue, newValue) -> {
|
||||
if (newValue == depositTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, FundsView.class, DepositView.class);
|
||||
else if (newValue == withdrawalTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, FundsView.class, WithdrawalView.class);
|
||||
else if (newValue == reservedTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, FundsView.class, ReservedView.class);
|
||||
else if (newValue == lockedTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, FundsView.class, LockedView.class);
|
||||
else if (newValue == transactionsTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, FundsView.class, TransactionsView.class);
|
||||
};
|
||||
}
|
||||
@ -99,19 +94,14 @@ public class FundsView extends ActivatableViewAndModel<TabPane, Activatable> {
|
||||
navigation.addListener(navigationListener);
|
||||
|
||||
if (root.getSelectionModel().getSelectedItem() == depositTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, FundsView.class, DepositView.class);
|
||||
else if (root.getSelectionModel().getSelectedItem() == withdrawalTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, FundsView.class, WithdrawalView.class);
|
||||
else if (root.getSelectionModel().getSelectedItem() == reservedTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, FundsView.class, ReservedView.class);
|
||||
else if (root.getSelectionModel().getSelectedItem() == lockedTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, FundsView.class, LockedView.class);
|
||||
else if (root.getSelectionModel().getSelectedItem() == transactionsTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, FundsView.class, TransactionsView.class);
|
||||
}
|
||||
|
||||
|
@ -101,13 +101,10 @@ public class MarketView extends ActivatableViewAndModel<TabPane, Activatable> {
|
||||
|
||||
tabChangeListener = (ov, oldValue, newValue) -> {
|
||||
if (newValue == offerBookTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, MarketView.class, OfferBookChartView.class);
|
||||
else if (newValue == tradesTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, MarketView.class, TradesChartsView.class);
|
||||
else if (newValue == spreadTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, MarketView.class, SpreadView.class);
|
||||
};
|
||||
|
||||
@ -134,13 +131,10 @@ public class MarketView extends ActivatableViewAndModel<TabPane, Activatable> {
|
||||
navigation.addListener(navigationListener);
|
||||
|
||||
if (root.getSelectionModel().getSelectedItem() == offerBookTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, MarketView.class, OfferBookChartView.class);
|
||||
else if (root.getSelectionModel().getSelectedItem() == tradesTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, MarketView.class, TradesChartsView.class);
|
||||
else
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, MarketView.class, SpreadView.class);
|
||||
|
||||
if (root.getScene() != null) {
|
||||
|
@ -86,15 +86,10 @@ import javafx.util.StringConverter;
|
||||
import java.util.Collections;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static bisq.desktop.util.Layout.INITIAL_SCENE_HEIGHT;
|
||||
|
||||
@FxmlView
|
||||
public class OfferBookChartView extends ActivatableViewAndModel<VBox, OfferBookChartViewModel> {
|
||||
private static final Logger log = LoggerFactory.getLogger(OfferBookChartView.class);
|
||||
|
||||
private final boolean useDevPrivilegeKeys;
|
||||
|
||||
private NumberAxis xAxis;
|
||||
@ -275,12 +270,10 @@ public class OfferBookChartView extends ActivatableViewAndModel<VBox, OfferBookC
|
||||
sellOfferTableView.setItems(model.getTopSellOfferList());
|
||||
buyTableRowSelectionListener = (observable, oldValue, newValue) -> {
|
||||
model.preferences.setSellScreenCurrencyCode(model.getCurrencyCode());
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, SellOfferView.class);
|
||||
};
|
||||
sellTableRowSelectionListener = (observable, oldValue, newValue) -> {
|
||||
model.preferences.setBuyScreenCurrencyCode(model.getCurrencyCode());
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, BuyOfferView.class);
|
||||
};
|
||||
buyOfferTableView.getSelectionModel().selectedItemProperty().addListener(buyTableRowSelectionListener);
|
||||
@ -543,20 +536,18 @@ public class OfferBookChartView extends ActivatableViewAndModel<VBox, OfferBookC
|
||||
button.setOnAction(e -> {
|
||||
if (isSellOffer) {
|
||||
model.preferences.setBuyScreenCurrencyCode(model.getCurrencyCode());
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, BuyOfferView.class);
|
||||
} else {
|
||||
model.preferences.setSellScreenCurrencyCode(model.getCurrencyCode());
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, SellOfferView.class);
|
||||
}
|
||||
});
|
||||
|
||||
VBox vBox = new VBox();
|
||||
VBox.setVgrow(tableView, Priority.ALWAYS);
|
||||
vBox.setSpacing(10);
|
||||
vBox.setFillWidth(true);
|
||||
vBox.setMinHeight(190);
|
||||
vBox.setVgrow(tableView, Priority.ALWAYS);
|
||||
vBox.getChildren().addAll(titleLabel, tableView, button);
|
||||
|
||||
button.prefWidthProperty().bind(vBox.widthProperty());
|
||||
|
@ -187,7 +187,6 @@ class OfferBookChartViewModel extends ActivatableViewModel {
|
||||
final String code = tradeCurrency.getCode();
|
||||
|
||||
if (isEditEntry(code)) {
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, SettingsView.class, PreferencesView.class);
|
||||
} else {
|
||||
selectedTradeCurrencyProperty.set(tradeCurrency);
|
||||
|
@ -180,7 +180,6 @@ class TradesChartsViewModel extends ActivatableViewModel {
|
||||
final String code = tradeCurrency.getCode();
|
||||
|
||||
if (isEditEntry(code)) {
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, SettingsView.class, PreferencesView.class);
|
||||
} else {
|
||||
boolean showAllEntry = isShowAllEntry(code);
|
||||
|
@ -45,6 +45,7 @@ import bisq.desktop.main.overlays.windows.OfferDetailsWindow;
|
||||
import bisq.desktop.main.overlays.windows.QRCodeWindow;
|
||||
import bisq.desktop.main.portfolio.PortfolioView;
|
||||
import bisq.desktop.main.portfolio.openoffer.OpenOffersView;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
import bisq.desktop.util.Layout;
|
||||
import bisq.desktop.util.Transitions;
|
||||
@ -277,7 +278,6 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
|
||||
.actionButtonTextWithGoTo("navigation.account")
|
||||
.onAction(() -> {
|
||||
navigation.setReturnPath(navigation.getCurrentPath());
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, FiatAccountsView.class);
|
||||
}).show();
|
||||
}
|
||||
@ -310,7 +310,6 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
|
||||
model.getDataModel().swapTradeToSavings();
|
||||
String key = "CreateOfferCancelAndFunded";
|
||||
if (preferences.showAgain(key)) {
|
||||
//noinspection unchecked
|
||||
new Popup<>().information(Res.get("createOffer.alreadyFunded"))
|
||||
.actionButtonTextWithGoTo("navigation.funds.availableForWithdrawal")
|
||||
.onAction(() -> navigation.navigateTo(MainView.class, FundsView.class, WithdrawalView.class))
|
||||
@ -349,7 +348,6 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
|
||||
.actionButtonTextWithGoTo("navigation.arbitratorSelection")
|
||||
.onAction(() -> {
|
||||
navigation.setReturnPath(navigation.getCurrentPath());
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, ArbitratorSelectionView.class);
|
||||
}).show();
|
||||
}
|
||||
@ -372,7 +370,6 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
|
||||
message = Res.get("popup.warning.noBsqFundsForBtcFeePayment");
|
||||
|
||||
if (message != null)
|
||||
//noinspection unchecked
|
||||
new Popup<>().warning(message)
|
||||
.actionButtonTextWithGoTo("navigation.dao.wallet.receive")
|
||||
.onAction(() -> navigation.navigateTo(MainView.class, DaoView.class, BsqWalletView.class, BsqReceiveView.class))
|
||||
@ -691,7 +688,6 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
|
||||
.dontShowAgainId(key)
|
||||
.actionButtonTextWithGoTo("navigation.portfolio.myOpenOffers")
|
||||
.onAction(() -> {
|
||||
//noinspection unchecked
|
||||
UserThread.runAfter(() ->
|
||||
navigation.navigateTo(MainView.class, PortfolioView.class,
|
||||
OpenOffersView.class),
|
||||
@ -867,8 +863,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
|
||||
paymentTitledGroupBg = addTitledGroupBg(gridPane, gridRow, 2, Res.get("shared.selectTradingAccount"));
|
||||
GridPane.setColumnSpan(paymentTitledGroupBg, 3);
|
||||
|
||||
//noinspection unchecked
|
||||
final Tuple2<Label, ComboBox> paymentAccountLabelComboBoxTuple = addLabelComboBox(gridPane, gridRow, Res.getWithCol("shared.tradingAccount"), Layout.FIRST_ROW_DISTANCE);
|
||||
final Tuple2<Label, ComboBox<PaymentAccount>> paymentAccountLabelComboBoxTuple = FormBuilder.addLabelComboBox(gridPane, gridRow, Res.getWithCol("shared.tradingAccount"), Layout.FIRST_ROW_DISTANCE);
|
||||
paymentAccountsLabel = paymentAccountLabelComboBoxTuple.first;
|
||||
paymentAccountsComboBox = paymentAccountLabelComboBoxTuple.second;
|
||||
paymentAccountsComboBox.setPromptText(Res.get("shared.selectTradingAccount"));
|
||||
@ -876,10 +871,9 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel> extends
|
||||
editOfferElements.add(paymentAccountsComboBox);
|
||||
|
||||
// we display either currencyComboBox (multi currency account) or currencyTextField (single)
|
||||
Tuple2<Label, ComboBox> currencyComboBoxTuple = addLabelComboBox(gridPane, ++gridRow, Res.getWithCol("shared.currency"));
|
||||
Tuple2<Label, ComboBox<TradeCurrency>> currencyComboBoxTuple = FormBuilder.addLabelComboBox(gridPane, ++gridRow, Res.getWithCol("shared.currency"));
|
||||
currencyComboBoxLabel = currencyComboBoxTuple.first;
|
||||
editOfferElements.add(currencyComboBoxLabel);
|
||||
//noinspection unchecked
|
||||
currencyComboBox = currencyComboBoxTuple.second;
|
||||
editOfferElements.add(currencyComboBox);
|
||||
currencyComboBox.setPromptText(Res.get("list.currency.select"));
|
||||
|
@ -643,7 +643,6 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
|
||||
updateButtonDisableState();
|
||||
return true;
|
||||
} else {
|
||||
//noinspection unchecked
|
||||
new Popup<>().warning(Res.get("shared.notEnoughFunds",
|
||||
btcFormatter.formatCoinWithCode(dataModel.totalToPayAsCoinProperty().get()),
|
||||
btcFormatter.formatCoinWithCode(dataModel.getTotalAvailableBalance())))
|
||||
@ -825,7 +824,6 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
|
||||
|
||||
private void displayPriceOutOfRangePopup() {
|
||||
Popup popup = new Popup<>();
|
||||
//noinspection unchecked
|
||||
popup.warning(Res.get("createOffer.priceOutSideOfDeviation",
|
||||
btcFormatter.formatToPercentWithSymbol(preferences.getMaxPriceDistanceInPercent())))
|
||||
.actionButtonText(Res.get("createOffer.changePrice"))
|
||||
|
@ -119,16 +119,11 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
|
||||
Optional<TradeCurrency> tradeCurrencyOptional = (this instanceof SellOfferView) ?
|
||||
CurrencyUtil.getTradeCurrency(preferences.getSellScreenCurrencyCode()) :
|
||||
CurrencyUtil.getTradeCurrency(preferences.getBuyScreenCurrencyCode());
|
||||
if (tradeCurrencyOptional.isPresent())
|
||||
tradeCurrency = tradeCurrencyOptional.get();
|
||||
else {
|
||||
tradeCurrency = GlobalSettings.getDefaultTradeCurrency();
|
||||
}
|
||||
tradeCurrency = tradeCurrencyOptional.orElseGet(GlobalSettings::getDefaultTradeCurrency);
|
||||
|
||||
root.getSelectionModel().selectedItemProperty().addListener(tabChangeListener);
|
||||
root.getTabs().addListener(tabListChangeListener);
|
||||
navigation.addListener(navigationListener);
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, this.getClass(), OfferBookView.class);
|
||||
}
|
||||
|
||||
@ -168,7 +163,6 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
|
||||
if (!createOfferViewOpen) {
|
||||
OfferView.this.createOfferViewOpen = true;
|
||||
OfferView.this.tradeCurrency = tradeCurrency;
|
||||
//noinspection unchecked
|
||||
OfferView.this.navigation.navigateTo(MainView.class, OfferView.this.getClass(),
|
||||
CreateOfferView.class);
|
||||
} else {
|
||||
@ -181,7 +175,6 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
|
||||
if (!takeOfferViewOpen) {
|
||||
OfferView.this.takeOfferViewOpen = true;
|
||||
OfferView.this.offer = offer;
|
||||
//noinspection unchecked
|
||||
OfferView.this.navigation.navigateTo(MainView.class, OfferView.this.getClass(),
|
||||
TakeOfferView.class);
|
||||
} else {
|
||||
@ -228,8 +221,6 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
|
||||
}
|
||||
offerBookView.enableCreateOfferButton();
|
||||
|
||||
// update the navigation state
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, this.getClass(), OfferBookView.class);
|
||||
}
|
||||
|
||||
@ -241,8 +232,6 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
|
||||
takeOfferView = null;
|
||||
}
|
||||
|
||||
// update the navigation state
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, this.getClass(), OfferBookView.class);
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@ import bisq.desktop.main.funds.withdrawal.WithdrawalView;
|
||||
import bisq.desktop.main.offer.OfferView;
|
||||
import bisq.desktop.main.overlays.popups.Popup;
|
||||
import bisq.desktop.main.overlays.windows.OfferDetailsWindow;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
import bisq.desktop.util.Layout;
|
||||
|
||||
@ -105,7 +106,6 @@ import java.util.Optional;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static bisq.desktop.util.FormBuilder.addButton;
|
||||
import static bisq.desktop.util.FormBuilder.addHBoxLabelComboBox;
|
||||
import static bisq.desktop.util.FormBuilder.addTitledGroupBg;
|
||||
|
||||
@FxmlView
|
||||
@ -156,12 +156,11 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
||||
|
||||
addTitledGroupBg(root, gridRow, 2, Res.get("offerbook.availableOffers"));
|
||||
|
||||
final Tuple3<HBox, AutoTooltipLabel, ComboBox> filterBoxTuple = addHBoxLabelComboBox(root, gridRow, Res.get("offerbook.filterByCurrency"), Layout.FIRST_ROW_DISTANCE);
|
||||
final Tuple3<HBox, AutoTooltipLabel, ComboBox<TradeCurrency>> filterBoxTuple = FormBuilder.addHBoxLabelComboBox(root, gridRow, Res.get("offerbook.filterByCurrency"), Layout.FIRST_ROW_DISTANCE);
|
||||
final HBox filterBox = filterBoxTuple.first;
|
||||
currencyComboBox = filterBoxTuple.third;
|
||||
currencyComboBox.setPromptText(Res.get("list.currency.select"));
|
||||
|
||||
//noinspection unchecked
|
||||
paymentMethodComboBox = new ComboBox<>();
|
||||
final Label paymentMethodLabel = new AutoTooltipLabel(Res.getWithCol("offerbook.filterByPaymentMethod"));
|
||||
paymentMethodLabel.setPadding(new Insets(0, 0, 0, 10));
|
||||
@ -405,7 +404,6 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
||||
.closeButtonText(Res.get("offerbook.setupNewAccount"))
|
||||
.onClose(() -> {
|
||||
navigation.setReturnPath(navigation.getCurrentPath());
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, FiatAccountsView.class);
|
||||
})
|
||||
.show();
|
||||
@ -507,7 +505,6 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
||||
() -> {
|
||||
log.debug(Res.get("offerbook.removeOffer.success"));
|
||||
if (DontShowAgainLookup.showAgain(key))
|
||||
//noinspection unchecked
|
||||
new Popup<>().instruction(Res.get("offerbook.withdrawFundsHint", Res.get("navigation.funds.availableForWithdrawal")))
|
||||
.actionButtonTextWithGoTo("navigation.funds.availableForWithdrawal")
|
||||
.onAction(() -> navigation.navigateTo(MainView.class, FundsView.class, WithdrawalView.class))
|
||||
@ -526,7 +523,6 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
||||
.actionButtonTextWithGoTo(targetAsString)
|
||||
.onAction(() -> {
|
||||
navigation.setReturnPath(navigation.getCurrentPath());
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, target);
|
||||
}).show();
|
||||
}
|
||||
|
@ -253,7 +253,6 @@ class OfferBookViewModel extends ActivatableViewModel {
|
||||
boolean showAllEntry = isShowAllEntry(code);
|
||||
showAllTradeCurrenciesProperty.set(showAllEntry);
|
||||
if (isEditEntry(code))
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, SettingsView.class, PreferencesView.class);
|
||||
else if (!showAllEntry) {
|
||||
this.selectedTradeCurrency = tradeCurrency;
|
||||
|
@ -341,7 +341,6 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
||||
//noinspection ConstantConditions,ConstantConditions
|
||||
if (balance != null && balance.isPositive() && !model.takeOfferCompleted.get() && !DevEnv.isDevMode()) {
|
||||
model.dataModel.swapTradeToSavings();
|
||||
//noinspection unchecked
|
||||
new Popup<>().information(Res.get("takeOffer.alreadyFunded.movedFunds"))
|
||||
.actionButtonTextWithGoTo("navigation.funds.availableForWithdrawal")
|
||||
.onAction(() -> navigation.navigateTo(MainView.class, FundsView.class, WithdrawalView.class))
|
||||
@ -386,7 +385,6 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
||||
.actionButtonTextWithGoTo("navigation.arbitratorSelection")
|
||||
.onAction(() -> {
|
||||
navigation.setReturnPath(navigation.getCurrentPath());
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class,
|
||||
ArbitratorSelectionView.class);
|
||||
}).show();
|
||||
@ -549,7 +547,6 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
||||
errorPopupDisplayed.set(true);
|
||||
model.resetOfferWarning();
|
||||
close();
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, FundsView.class, WithdrawalView.class);
|
||||
})
|
||||
.onClose(() -> {
|
||||
@ -608,7 +605,6 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
||||
.actionButtonTextWithGoTo("navigation.portfolio.pending")
|
||||
.dontShowAgainId(key)
|
||||
.onAction(() -> {
|
||||
//noinspection unchecked
|
||||
UserThread.runAfter(
|
||||
() -> navigation.navigateTo(MainView.class, PortfolioView.class, PendingTradesView.class)
|
||||
, 100, TimeUnit.MILLISECONDS);
|
||||
@ -701,11 +697,10 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
||||
paymentAccountTitledGroupBg = FormBuilder.addTitledGroupBg(gridPane, gridRow, 2, Res.get("takeOffer.paymentInfo"));
|
||||
GridPane.setColumnSpan(paymentAccountTitledGroupBg, 3);
|
||||
|
||||
Tuple2<Label, ComboBox> tuple = FormBuilder.addLabelComboBox(gridPane, gridRow, Res.getWithCol("shared.tradingAccount"), Layout.FIRST_ROW_DISTANCE);
|
||||
Tuple2<Label, ComboBox<PaymentAccount>> tuple = FormBuilder.addLabelComboBox(gridPane, gridRow, Res.getWithCol("shared.tradingAccount"), Layout.FIRST_ROW_DISTANCE);
|
||||
paymentAccountsLabel = tuple.first;
|
||||
paymentAccountsLabel.setVisible(false);
|
||||
paymentAccountsLabel.setManaged(false);
|
||||
//noinspection unchecked
|
||||
paymentAccountsComboBox = tuple.second;
|
||||
paymentAccountsComboBox.setPromptText(Res.get("shared.selectTradingAccount"));
|
||||
paymentAccountsComboBox.setConverter(GUIUtil.getPaymentAccountsComboBoxStringConverter());
|
||||
@ -1023,7 +1018,6 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
||||
message = Res.get("popup.warning.noBsqFundsForBtcFeePayment");
|
||||
|
||||
if (message != null)
|
||||
//noinspection unchecked
|
||||
new Popup<>().warning(message)
|
||||
.actionButtonTextWithGoTo("navigation.dao.wallet.receive")
|
||||
.onAction(() -> navigation.navigateTo(MainView.class, DaoView.class, BsqWalletView.class, BsqReceiveView.class))
|
||||
|
@ -240,7 +240,6 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
|
||||
updateButtonDisableState();
|
||||
return true;
|
||||
} else {
|
||||
//noinspection unchecked
|
||||
new Popup<>().warning(Res.get("shared.notEnoughFunds",
|
||||
btcFormatter.formatCoinWithCode(dataModel.getTotalToPayAsCoin().get()),
|
||||
btcFormatter.formatCoinWithCode(dataModel.getTotalAvailableBalance())))
|
||||
|
@ -196,7 +196,6 @@ public class NotificationCenter {
|
||||
notification.actionButtonTextWithGoTo("navigation.portfolio.pending")
|
||||
.onAction(() -> {
|
||||
DontShowAgainLookup.dontShowAgain(key, true);
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, PortfolioView.class, PendingTradesView.class);
|
||||
if (selectItemByTradeIdConsumer != null)
|
||||
UserThread.runAfter(() -> selectItemByTradeIdConsumer.accept(trade.getId()), 1);
|
||||
@ -239,7 +238,6 @@ public class NotificationCenter {
|
||||
if (message != null) {
|
||||
Notification notification = new Notification().disputeHeadLine(trade.getShortId()).message(message);
|
||||
if (navigation.getCurrentPath() != null && !navigation.getCurrentPath().contains(TraderDisputeView.class)) {
|
||||
//noinspection unchecked
|
||||
notification.actionButtonTextWithGoTo("navigation.support")
|
||||
.onAction(() -> navigation.navigateTo(MainView.class, DisputesView.class, TraderDisputeView.class))
|
||||
.show();
|
||||
|
@ -165,7 +165,6 @@ public class FeeOptionWindow extends Overlay<FeeOptionWindow> {
|
||||
cleanup();
|
||||
onHidden();
|
||||
|
||||
//noinspection unchecked
|
||||
new Popup().warning(missingBsq)
|
||||
.actionButtonTextWithGoTo("navigation.dao.wallet.receive")
|
||||
.onAction(() -> {
|
||||
|
@ -226,23 +226,23 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
|
||||
final boolean isSepa = paymentMethod.equals(PaymentMethod.SEPA);
|
||||
final String makerPaymentAccountId = offer.getMakerPaymentAccountId();
|
||||
final PaymentAccount myPaymentAccount = user.getPaymentAccount(makerPaymentAccountId);
|
||||
String countryCode = offer.getCountryCode();
|
||||
if (offer.isMyOffer(keyRing) && makerPaymentAccountId != null && myPaymentAccount != null) {
|
||||
addLabelTextField(gridPane, ++rowIndex, Res.get("offerDetailsWindow.myTradingAccount"), myPaymentAccount.getAccountName());
|
||||
} else {
|
||||
final String method = Res.get(paymentMethod.getId());
|
||||
String methodWithBankId = method + bankId;
|
||||
String paymentMethodLabel = Res.get("shared.paymentMethod");
|
||||
if (isNationalBanks || isSpecificBanks || isSepa) {
|
||||
if (BankUtil.isBankIdRequired(offer.getCountryCode()))
|
||||
if (countryCode != null && (isNationalBanks || isSpecificBanks || isSepa)) {
|
||||
if (BankUtil.isBankIdRequired(countryCode))
|
||||
addLabelTextField(gridPane, ++rowIndex,
|
||||
paymentMethodLabel + " " + Res.get("offerDetailsWindow.offererBankId"),
|
||||
methodWithBankId);
|
||||
else if (BankUtil.isBankNameRequired(offer.getCountryCode()))
|
||||
else if (BankUtil.isBankNameRequired(countryCode))
|
||||
addLabelTextField(gridPane, ++rowIndex,
|
||||
paymentMethodLabel + " " + Res.get("offerDetailsWindow.offerersBankName"),
|
||||
methodWithBankId);
|
||||
}
|
||||
if (paymentMethod.equals(PaymentMethod.CASH_DEPOSIT)) {
|
||||
} else if (paymentMethod.equals(PaymentMethod.CASH_DEPOSIT)) {
|
||||
addLabelTextField(gridPane, ++rowIndex,
|
||||
paymentMethodLabel + " " + Res.get("offerDetailsWindow.offererBankId"),
|
||||
methodWithBankId);
|
||||
@ -294,7 +294,7 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
|
||||
}
|
||||
|
||||
rows = 4;
|
||||
String paymentMethodCountryCode = offer.getCountryCode();
|
||||
String paymentMethodCountryCode = countryCode;
|
||||
if (paymentMethodCountryCode != null)
|
||||
rows++;
|
||||
if (offer.getOfferFeePaymentTxId() != null)
|
||||
@ -385,7 +385,8 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
|
||||
});
|
||||
|
||||
button.setOnAction(e -> {
|
||||
if (user.getAcceptedArbitrators().size() > 0) {
|
||||
if (user.getAcceptedArbitrators() != null &&
|
||||
user.getAcceptedArbitrators().size() > 0) {
|
||||
button.setDisable(true);
|
||||
cancelButton.setDisable(true);
|
||||
busyAnimation.play();
|
||||
@ -398,8 +399,6 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
|
||||
}
|
||||
} else {
|
||||
new Popup<>().warning(Res.get("offerDetailsWindow.warn.noArbitrator")).show();
|
||||
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class,
|
||||
ArbitratorSelectionView.class);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
package bisq.desktop.main.overlays.windows;
|
||||
|
||||
import bisq.desktop.main.overlays.Overlay;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
|
||||
import bisq.core.app.BisqEnvironment;
|
||||
import bisq.core.btc.BaseCurrencyNetwork;
|
||||
@ -44,7 +45,6 @@ import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static bisq.desktop.util.FormBuilder.addLabelComboBox;
|
||||
import static bisq.desktop.util.FormBuilder.addMultilineLabel;
|
||||
|
||||
public class SelectBaseCurrencyWindow extends Overlay<SelectBaseCurrencyWindow> {
|
||||
@ -90,15 +90,15 @@ public class SelectBaseCurrencyWindow extends Overlay<SelectBaseCurrencyWindow>
|
||||
Label label = addMultilineLabel(gridPane, ++rowIndex, Res.get("selectBaseCurrencyWindow.msg", BisqEnvironment.getBaseCurrencyNetwork().getCurrencyName()), 10);
|
||||
GridPane.setMargin(label, new Insets(0, 0, 10, 0));
|
||||
|
||||
Tuple2<Label, ComboBox> tuple = addLabelComboBox(gridPane, ++rowIndex, Res.get("selectBaseCurrencyWindow.select"));
|
||||
//noinspection unchecked
|
||||
Tuple2<Label, ComboBox<BaseCurrencyNetwork>> tuple = FormBuilder.addLabelComboBox(gridPane, ++rowIndex, Res.get("selectBaseCurrencyWindow.select"));
|
||||
|
||||
comboBox = tuple.second;
|
||||
comboBox.setPromptText(Res.get("shared.select"));
|
||||
List<BaseCurrencyNetwork> baseCurrencyNetworks = Arrays.asList(BaseCurrencyNetwork.values());
|
||||
// show ony mainnet in production version
|
||||
if (!DevEnv.isDevMode())
|
||||
baseCurrencyNetworks = baseCurrencyNetworks.stream()
|
||||
.filter(e -> e.isMainnet())
|
||||
.filter(BaseCurrencyNetwork::isMainnet)
|
||||
.collect(Collectors.toList());
|
||||
comboBox.setItems(FXCollections.observableArrayList(baseCurrencyNetworks));
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
package bisq.desktop.main.overlays.windows;
|
||||
|
||||
import bisq.desktop.main.overlays.Overlay;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
|
||||
@ -44,7 +45,6 @@ import java.util.function.Consumer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static bisq.desktop.util.FormBuilder.addLabelComboBox;
|
||||
import static bisq.desktop.util.FormBuilder.addMultilineLabel;
|
||||
|
||||
public class SelectDepositTxWindow extends Overlay<SelectDepositTxWindow> {
|
||||
@ -96,8 +96,8 @@ public class SelectDepositTxWindow extends Overlay<SelectDepositTxWindow> {
|
||||
Label label = addMultilineLabel(gridPane, ++rowIndex, Res.get("selectDepositTxWindow.msg"), 10);
|
||||
GridPane.setMargin(label, new Insets(0, 0, 10, 0));
|
||||
|
||||
Tuple2<Label, ComboBox> tuple = addLabelComboBox(gridPane, ++rowIndex, Res.get("selectDepositTxWindow.select"));
|
||||
//noinspection unchecked
|
||||
Tuple2<Label, ComboBox<Transaction>> tuple = FormBuilder.addLabelComboBox(gridPane, ++rowIndex, Res.get("selectDepositTxWindow.select"));
|
||||
|
||||
transactionsComboBox = tuple.second;
|
||||
transactionsComboBox.setPromptText(Res.get("shared.select"));
|
||||
transactionsComboBox.setConverter(new StringConverter<Transaction>() {
|
||||
|
@ -251,7 +251,7 @@ public class TorNetworkSettingsWindow extends Overlay<TorNetworkSettingsWindow>
|
||||
// providedBridges
|
||||
providedBridgesRadioButton = addRadioButton(gridPane, ++rowIndex, toggleGroup, Res.get("torNetworkSettingWindow.providedBridges"));
|
||||
providedBridgesRadioButton.setUserData(BridgeOption.PROVIDED);
|
||||
final Tuple2<Label, ComboBox> labelComboBoxTuple2 = addLabelComboBox(gridPane, ++rowIndex, Res.get("torNetworkSettingWindow.transportType"));
|
||||
final Tuple2<Label, ComboBox<Transport>> labelComboBoxTuple2 = addLabelComboBox(gridPane, ++rowIndex, Res.get("torNetworkSettingWindow.transportType"));
|
||||
transportTypeLabel = labelComboBoxTuple2.first;
|
||||
transportTypeComboBox = labelComboBoxTuple2.second;
|
||||
transportTypeComboBox.setItems(FXCollections.observableArrayList(Arrays.asList(
|
||||
|
@ -89,19 +89,14 @@ public class PortfolioView extends ActivatableViewAndModel<TabPane, Activatable>
|
||||
|
||||
tabChangeListener = (ov, oldValue, newValue) -> {
|
||||
if (newValue == openOffersTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, PortfolioView.class, OpenOffersView.class);
|
||||
else if (newValue == pendingTradesTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, PortfolioView.class, PendingTradesView.class);
|
||||
else if (newValue == closedTradesTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, PortfolioView.class, ClosedTradesView.class);
|
||||
else if (newValue == failedTradesTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, PortfolioView.class, FailedTradesView.class);
|
||||
else if (newValue == editOpenOfferTab) {
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, PortfolioView.class, EditOfferView.class);
|
||||
}
|
||||
|
||||
@ -125,7 +120,6 @@ public class PortfolioView extends ActivatableViewAndModel<TabPane, Activatable>
|
||||
editOfferView = null;
|
||||
}
|
||||
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, this.getClass(), OpenOffersView.class);
|
||||
}
|
||||
|
||||
@ -143,19 +137,14 @@ public class PortfolioView extends ActivatableViewAndModel<TabPane, Activatable>
|
||||
navigation.addListener(navigationListener);
|
||||
|
||||
if (root.getSelectionModel().getSelectedItem() == openOffersTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, PortfolioView.class, OpenOffersView.class);
|
||||
else if (root.getSelectionModel().getSelectedItem() == pendingTradesTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, PortfolioView.class, PendingTradesView.class);
|
||||
else if (root.getSelectionModel().getSelectedItem() == closedTradesTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, PortfolioView.class, ClosedTradesView.class);
|
||||
else if (root.getSelectionModel().getSelectedItem() == failedTradesTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, PortfolioView.class, FailedTradesView.class);
|
||||
else if (root.getSelectionModel().getSelectedItem() == editOpenOfferTab) {
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, PortfolioView.class, EditOfferView.class);
|
||||
if (editOfferView != null) editOfferView.onTabSelected(true);
|
||||
}
|
||||
|
@ -189,7 +189,6 @@ public class EditOfferView extends MutableOfferView<EditOfferViewModel> {
|
||||
//edit offer
|
||||
model.onPublishOffer(() -> {
|
||||
log.debug("Edit offer was successful");
|
||||
//noinspection unchecked
|
||||
new Popup<>().feedback(Res.get("editOffer.success")).show();
|
||||
spinnerInfoLabel.setText("");
|
||||
close();
|
||||
|
@ -197,7 +197,6 @@ public class OpenOffersView extends ActivatableViewAndModel<VBox, OpenOffersView
|
||||
|
||||
String key = "WithdrawFundsAfterRemoveOfferInfo";
|
||||
if (DontShowAgainLookup.showAgain(key))
|
||||
//noinspection unchecked
|
||||
new Popup<>().instruction(Res.get("offerbook.withdrawFundsHint", Res.get("navigation.funds.availableForWithdrawal")))
|
||||
.actionButtonTextWithGoTo("navigation.funds.availableForWithdrawal")
|
||||
.onAction(() -> navigation.navigateTo(MainView.class, FundsView.class, WithdrawalView.class))
|
||||
|
@ -485,7 +485,6 @@ public class PendingTradesDataModel extends ActivatableDataModel {
|
||||
}
|
||||
|
||||
private void sendOpenNewDisputeMessage(Dispute dispute, boolean reOpen) {
|
||||
//noinspection unchecked
|
||||
disputeManager.sendOpenNewDisputeMessage(dispute,
|
||||
reOpen,
|
||||
() -> navigation.navigateTo(MainView.class, DisputesView.class),
|
||||
|
@ -69,13 +69,10 @@ public class SettingsView extends ActivatableViewAndModel<TabPane, Activatable>
|
||||
|
||||
tabChangeListener = (ov, oldValue, newValue) -> {
|
||||
if (newValue == preferencesTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, SettingsView.class, PreferencesView.class);
|
||||
else if (newValue == networkTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, SettingsView.class, NetworkSettingsView.class);
|
||||
else if (newValue == aboutTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, SettingsView.class, AboutView.class);
|
||||
};
|
||||
}
|
||||
@ -87,13 +84,10 @@ public class SettingsView extends ActivatableViewAndModel<TabPane, Activatable>
|
||||
|
||||
Tab selectedItem = root.getSelectionModel().getSelectedItem();
|
||||
if (selectedItem == preferencesTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, SettingsView.class, PreferencesView.class);
|
||||
else if (selectedItem == networkTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, SettingsView.class, NetworkSettingsView.class);
|
||||
else if (selectedItem == aboutTab)
|
||||
//noinspection unchecked
|
||||
navigation.navigateTo(MainView.class, SettingsView.class, AboutView.class);
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ import bisq.desktop.components.AutoTooltipLabel;
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.components.TitledGroupBg;
|
||||
import bisq.desktop.main.overlays.popups.Popup;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.ImageUtil;
|
||||
import bisq.desktop.util.Layout;
|
||||
|
||||
@ -181,7 +182,6 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Activatab
|
||||
GridPane.setColumnSpan(titledGroupBg, 4);
|
||||
|
||||
// selectBaseCurrencyNetwork
|
||||
//noinspection unchecked
|
||||
/* selectBaseCurrencyNetworkComboBox = addLabelComboBox(root, gridRow,
|
||||
Res.getWithCol("settings.preferences.selectCurrencyNetwork"), Layout.FIRST_ROW_DISTANCE).second;
|
||||
|
||||
@ -198,22 +198,13 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Activatab
|
||||
}
|
||||
});*/
|
||||
|
||||
// userLanguage
|
||||
//noinspection unchecked
|
||||
userLanguageComboBox = addLabelComboBox(root, gridRow,
|
||||
userLanguageComboBox = FormBuilder.<String>addLabelComboBox(root, gridRow,
|
||||
Res.getWithCol("shared.language"), Layout.FIRST_ROW_DISTANCE).second;
|
||||
|
||||
// userCountry
|
||||
//noinspection unchecked
|
||||
userCountryComboBox = addLabelComboBox(root, ++gridRow,
|
||||
userCountryComboBox = FormBuilder.<Country>addLabelComboBox(root, ++gridRow,
|
||||
Res.getWithCol("shared.country")).second;
|
||||
|
||||
// blockChainExplorer
|
||||
//noinspection unchecked
|
||||
blockChainExplorerComboBox = addLabelComboBox(root, ++gridRow,
|
||||
blockChainExplorerComboBox = FormBuilder.<BlockChainExplorer>addLabelComboBox(root, ++gridRow,
|
||||
Res.get("setting.preferences.explorer")).second;
|
||||
|
||||
// transactionFee
|
||||
Tuple3<Label, InputTextField, CheckBox> tuple = addLabelInputTextFieldCheckBox(root, ++gridRow,
|
||||
Res.get("setting.preferences.txFee"), Res.get("setting.preferences.useCustomValue"));
|
||||
transactionFeeInputTextField = tuple.second;
|
||||
@ -313,8 +304,8 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Activatab
|
||||
Layout.GROUP_DISTANCE);
|
||||
GridPane.setColumnSpan(titledGroupBg, 4);
|
||||
|
||||
//noinspection unchecked
|
||||
preferredTradeCurrencyComboBox = addLabelComboBox(root, gridRow, Res.get("setting.preferences.prefCurrency"),
|
||||
|
||||
preferredTradeCurrencyComboBox = FormBuilder.<TradeCurrency>addLabelComboBox(root, gridRow, Res.get("setting.preferences.prefCurrency"),
|
||||
Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
|
||||
preferredTradeCurrencyComboBox.setConverter(new StringConverter<TradeCurrency>() {
|
||||
@Override
|
||||
@ -329,9 +320,8 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Activatab
|
||||
}
|
||||
});
|
||||
|
||||
Tuple2<Label, ListView> fiatTuple = addLabelListView(root, ++gridRow, Res.get("setting.preferences.displayFiat"));
|
||||
Tuple2<Label, ListView<FiatCurrency>> fiatTuple = FormBuilder.addLabelListView(root, ++gridRow, Res.get("setting.preferences.displayFiat"));
|
||||
GridPane.setValignment(fiatTuple.first, VPos.TOP);
|
||||
//noinspection unchecked
|
||||
fiatCurrenciesListView = fiatTuple.second;
|
||||
fiatCurrenciesListView.setMinHeight(2 * Layout.LIST_ROW_HEIGHT + 2);
|
||||
fiatCurrenciesListView.setPrefHeight(3 * Layout.LIST_ROW_HEIGHT + 2);
|
||||
@ -377,10 +367,9 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Activatab
|
||||
}
|
||||
});
|
||||
|
||||
Tuple2<Label, ListView> cryptoCurrenciesTuple = addLabelListView(root, gridRow, Res.get("setting.preferences.displayAltcoins"));
|
||||
Tuple2<Label, ListView<CryptoCurrency>> cryptoCurrenciesTuple = FormBuilder.addLabelListView(root, gridRow, Res.get("setting.preferences.displayAltcoins"));
|
||||
GridPane.setValignment(cryptoCurrenciesTuple.first, VPos.TOP);
|
||||
GridPane.setMargin(cryptoCurrenciesTuple.first, new Insets(0, 0, 0, 20));
|
||||
//noinspection unchecked
|
||||
cryptoCurrenciesListView = cryptoCurrenciesTuple.second;
|
||||
GridPane.setColumnIndex(cryptoCurrenciesTuple.first, 2);
|
||||
GridPane.setColumnIndex(cryptoCurrenciesListView, 3);
|
||||
@ -428,8 +417,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Activatab
|
||||
}
|
||||
});
|
||||
|
||||
//noinspection unchecked
|
||||
fiatCurrenciesComboBox = addLabelComboBox(root, ++gridRow).second;
|
||||
fiatCurrenciesComboBox = FormBuilder.<FiatCurrency>addLabelComboBox(root, ++gridRow).second;
|
||||
fiatCurrenciesComboBox.setPromptText(Res.get("setting.preferences.addFiat"));
|
||||
fiatCurrenciesComboBox.setConverter(new StringConverter<FiatCurrency>() {
|
||||
@Override
|
||||
@ -443,8 +431,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Activatab
|
||||
}
|
||||
});
|
||||
|
||||
Tuple2<Label, ComboBox> labelComboBoxTuple2 = addLabelComboBox(root, gridRow);
|
||||
//noinspection unchecked
|
||||
Tuple2<Label, ComboBox<CryptoCurrency>> labelComboBoxTuple2 = FormBuilder.addLabelComboBox(root, gridRow);
|
||||
cryptoCurrenciesComboBox = labelComboBoxTuple2.second;
|
||||
GridPane.setColumnIndex(cryptoCurrenciesComboBox, 3);
|
||||
cryptoCurrenciesComboBox.setPromptText(Res.get("setting.preferences.addAltcoin"));
|
||||
|
@ -647,20 +647,20 @@ public class FormBuilder {
|
||||
// Label + ComboBox
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static Tuple2<Label, ComboBox> addLabelComboBox(GridPane gridPane, int rowIndex) {
|
||||
public static <T> Tuple2<Label, ComboBox<T>> addLabelComboBox(GridPane gridPane, int rowIndex) {
|
||||
return addLabelComboBox(gridPane, rowIndex, null, 0);
|
||||
}
|
||||
|
||||
public static Tuple2<Label, ComboBox> addLabelComboBox(GridPane gridPane, int rowIndex, String title) {
|
||||
public static <T> Tuple2<Label, ComboBox<T>> addLabelComboBox(GridPane gridPane, int rowIndex, String title) {
|
||||
return addLabelComboBox(gridPane, rowIndex, title, 0);
|
||||
}
|
||||
|
||||
public static Tuple2<Label, ComboBox> addLabelComboBox(GridPane gridPane, int rowIndex, String title, double top) {
|
||||
public static <T> Tuple2<Label, ComboBox<T>> addLabelComboBox(GridPane gridPane, int rowIndex, String title, double top) {
|
||||
Label label = null;
|
||||
if (title != null)
|
||||
label = addLabel(gridPane, rowIndex, title, top);
|
||||
|
||||
ComboBox comboBox = new ComboBox();
|
||||
ComboBox<T> comboBox = new ComboBox<>();
|
||||
GridPane.setRowIndex(comboBox, rowIndex);
|
||||
GridPane.setColumnIndex(comboBox, 1);
|
||||
GridPane.setMargin(comboBox, new Insets(top, 0, 0, 0));
|
||||
@ -669,12 +669,17 @@ public class FormBuilder {
|
||||
return new Tuple2<>(label, comboBox);
|
||||
}
|
||||
|
||||
public static Tuple2<Label, SearchComboBox> addLabelSearchComboBox(GridPane gridPane, int rowIndex, String title, double top) {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Label + SearchComboBox
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static <T> Tuple2<Label, SearchComboBox<T>> addLabelSearchComboBox(GridPane gridPane, int rowIndex, String title, double top) {
|
||||
Label label = null;
|
||||
if (title != null)
|
||||
label = addLabel(gridPane, rowIndex, title, top);
|
||||
|
||||
SearchComboBox comboBox = new SearchComboBox();
|
||||
SearchComboBox<T> comboBox = new SearchComboBox<>();
|
||||
GridPane.setRowIndex(comboBox, rowIndex);
|
||||
GridPane.setColumnIndex(comboBox, 1);
|
||||
GridPane.setMargin(comboBox, new Insets(top, 0, 0, 0));
|
||||
@ -683,43 +688,45 @@ public class FormBuilder {
|
||||
return new Tuple2<>(label, comboBox);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// HBox + AutoTooltipLabel + ComboBox
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static Tuple3<HBox, AutoTooltipLabel, ComboBox> addHBoxLabelComboBox(GridPane gridPane, int rowIndex, String title, double top) {
|
||||
public static <T> Tuple3<HBox, AutoTooltipLabel, ComboBox<T>> addHBoxLabelComboBox(GridPane gridPane, int rowIndex, String title, double top) {
|
||||
HBox hBox = new HBox();
|
||||
hBox.setAlignment(Pos.CENTER_LEFT);
|
||||
hBox.setSpacing(4);
|
||||
|
||||
final AutoTooltipLabel label = new AutoTooltipLabel(title);
|
||||
final ComboBox<Object> comboBox = new ComboBox<>();
|
||||
final ComboBox<T> comboBox = new ComboBox<>();
|
||||
hBox.getChildren().addAll(label, comboBox);
|
||||
|
||||
GridPane.setRowIndex(hBox, rowIndex);
|
||||
GridPane.setColumnSpan(hBox, 2);
|
||||
GridPane.setMargin(hBox, new Insets(top, 0,0,24));
|
||||
GridPane.setMargin(hBox, new Insets(top, 0, 0, 24));
|
||||
gridPane.getChildren().add(hBox);
|
||||
|
||||
return new Tuple3<>(hBox, label, comboBox);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Label + ComboBox + ComboBox
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static Tuple3<Label, ComboBox, ComboBox> addLabelComboBoxComboBox(GridPane gridPane, int rowIndex, String title) {
|
||||
public static <T, R> Tuple3<Label, ComboBox<R>, ComboBox<T>> addLabelComboBoxComboBox(GridPane gridPane, int rowIndex, String title) {
|
||||
return addLabelComboBoxComboBox(gridPane, rowIndex, title, 0);
|
||||
}
|
||||
|
||||
public static Tuple3<Label, ComboBox, ComboBox> addLabelComboBoxComboBox(GridPane gridPane, int rowIndex, String title, double top) {
|
||||
public static <T, R> Tuple3<Label, ComboBox<T>, ComboBox<R>> addLabelComboBoxComboBox(GridPane gridPane, int rowIndex, String title, double top) {
|
||||
Label label = addLabel(gridPane, rowIndex, title, top);
|
||||
|
||||
HBox hBox = new HBox();
|
||||
hBox.setSpacing(10);
|
||||
|
||||
ComboBox comboBox1 = new ComboBox();
|
||||
ComboBox comboBox2 = new ComboBox();
|
||||
ComboBox<T> comboBox1 = new ComboBox<>();
|
||||
ComboBox<R> comboBox2 = new ComboBox<>();
|
||||
hBox.getChildren().addAll(comboBox1, comboBox2);
|
||||
|
||||
GridPane.setRowIndex(hBox, rowIndex);
|
||||
@ -734,18 +741,18 @@ public class FormBuilder {
|
||||
// Label + ComboBox + Button
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static Tuple3<Label, ComboBox, Button> addLabelComboBoxButton(GridPane gridPane,
|
||||
int rowIndex,
|
||||
String title,
|
||||
String buttonTitle) {
|
||||
public static <T> Tuple3<Label, ComboBox<T>, Button> addLabelComboBoxButton(GridPane gridPane,
|
||||
int rowIndex,
|
||||
String title,
|
||||
String buttonTitle) {
|
||||
return addLabelComboBoxButton(gridPane, rowIndex, title, buttonTitle, 0);
|
||||
}
|
||||
|
||||
public static Tuple3<Label, ComboBox, Button> addLabelComboBoxButton(GridPane gridPane,
|
||||
int rowIndex,
|
||||
String title,
|
||||
String buttonTitle,
|
||||
double top) {
|
||||
public static <T> Tuple3<Label, ComboBox<T>, Button> addLabelComboBoxButton(GridPane gridPane,
|
||||
int rowIndex,
|
||||
String title,
|
||||
String buttonTitle,
|
||||
double top) {
|
||||
Label label = addLabel(gridPane, rowIndex, title, top);
|
||||
|
||||
HBox hBox = new HBox();
|
||||
@ -754,7 +761,7 @@ public class FormBuilder {
|
||||
Button button = new AutoTooltipButton(buttonTitle);
|
||||
button.setDefaultButton(true);
|
||||
|
||||
ComboBox comboBox = new ComboBox();
|
||||
ComboBox<T> comboBox = new ComboBox<>();
|
||||
|
||||
hBox.getChildren().addAll(comboBox, button);
|
||||
|
||||
@ -766,28 +773,29 @@ public class FormBuilder {
|
||||
return new Tuple3<>(label, comboBox, button);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Label + ComboBox + Label
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static Tuple3<Label, ComboBox, TextField> addLabelComboBoxLabel(GridPane gridPane,
|
||||
int rowIndex,
|
||||
String title,
|
||||
String textFieldText) {
|
||||
public static <T> Tuple3<Label, ComboBox<T>, TextField> addLabelComboBoxLabel(GridPane gridPane,
|
||||
int rowIndex,
|
||||
String title,
|
||||
String textFieldText) {
|
||||
return addLabelComboBoxLabel(gridPane, rowIndex, title, textFieldText, 0);
|
||||
}
|
||||
|
||||
public static Tuple3<Label, ComboBox, TextField> addLabelComboBoxLabel(GridPane gridPane,
|
||||
int rowIndex,
|
||||
String title,
|
||||
String textFieldText,
|
||||
double top) {
|
||||
public static <T> Tuple3<Label, ComboBox<T>, TextField> addLabelComboBoxLabel(GridPane gridPane,
|
||||
int rowIndex,
|
||||
String title,
|
||||
String textFieldText,
|
||||
double top) {
|
||||
Label label = addLabel(gridPane, rowIndex, title, top);
|
||||
|
||||
HBox hBox = new HBox();
|
||||
hBox.setSpacing(10);
|
||||
|
||||
ComboBox comboBox = new ComboBox();
|
||||
ComboBox<T> comboBox = new ComboBox<>();
|
||||
TextField textField = new TextField(textFieldText);
|
||||
textField.setEditable(false);
|
||||
textField.setMouseTransparent(true);
|
||||
@ -1192,14 +1200,14 @@ public class FormBuilder {
|
||||
// Label + List
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static Tuple2<Label, ListView> addLabelListView(GridPane gridPane, int rowIndex, String title) {
|
||||
public static <T> Tuple2<Label, ListView<T>> addLabelListView(GridPane gridPane, int rowIndex, String title) {
|
||||
return addLabelListView(gridPane, rowIndex, title, 0);
|
||||
}
|
||||
|
||||
public static Tuple2<Label, ListView> addLabelListView(GridPane gridPane, int rowIndex, String title, double top) {
|
||||
public static <T> Tuple2<Label, ListView<T>> addLabelListView(GridPane gridPane, int rowIndex, String title, double top) {
|
||||
Label label = addLabel(gridPane, rowIndex, title, top);
|
||||
|
||||
ListView listView = new ListView();
|
||||
ListView<T> listView = new ListView<>();
|
||||
GridPane.setRowIndex(listView, rowIndex);
|
||||
GridPane.setColumnIndex(listView, 1);
|
||||
GridPane.setMargin(listView, new Insets(top, 0, 0, 0));
|
||||
@ -1268,7 +1276,7 @@ public class FormBuilder {
|
||||
|
||||
public static Button getIconButton(GlyphIcons icon, String styleClass) {
|
||||
if (icon.fontFamily().equals(MATERIAL_DESIGN_ICONS)) {
|
||||
final Button textIcon = MaterialDesignIconFactory.get().createIconButton(icon, "","2em", null, ContentDisplay.CENTER);
|
||||
Button textIcon = MaterialDesignIconFactory.get().createIconButton(icon, "", "2em", null, ContentDisplay.CENTER);
|
||||
textIcon.setId("icon-button");
|
||||
textIcon.getGraphic().getStyleClass().add(styleClass);
|
||||
textIcon.setPrefWidth(20);
|
||||
|
@ -24,6 +24,8 @@ import bisq.desktop.main.overlays.popups.Popup;
|
||||
import bisq.core.app.BisqEnvironment;
|
||||
import bisq.core.btc.wallet.WalletsManager;
|
||||
import bisq.core.btc.wallet.WalletsSetup;
|
||||
import bisq.core.locale.Country;
|
||||
import bisq.core.locale.CountryUtil;
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
@ -45,6 +47,8 @@ import bisq.common.proto.persistable.PersistableList;
|
||||
import bisq.common.proto.persistable.PersistenceProtoResolver;
|
||||
import bisq.common.storage.FileUtil;
|
||||
import bisq.common.storage.Storage;
|
||||
import bisq.common.util.Tuple2;
|
||||
import bisq.common.util.Tuple3;
|
||||
import bisq.common.util.Utilities;
|
||||
|
||||
import org.bitcoinj.core.Address;
|
||||
@ -68,6 +72,8 @@ import javafx.stage.StageStyle;
|
||||
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ScrollBar;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.control.Tooltip;
|
||||
@ -79,6 +85,8 @@ import javafx.geometry.Orientation;
|
||||
|
||||
import javafx.beans.property.DoubleProperty;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
|
||||
import javafx.util.StringConverter;
|
||||
|
||||
import java.net.URI;
|
||||
@ -98,6 +106,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@ -392,7 +401,6 @@ public class GUIUtil {
|
||||
|
||||
public static <T> T getParentOfType(Node node, Class<T> t) {
|
||||
Node parent = node.getParent();
|
||||
|
||||
while (parent != null) {
|
||||
if (parent.getClass().isAssignableFrom(t)) {
|
||||
break;
|
||||
@ -400,7 +408,6 @@ public class GUIUtil {
|
||||
parent = parent.getParent();
|
||||
}
|
||||
}
|
||||
|
||||
//noinspection unchecked
|
||||
return parent != null ? (T) parent : null;
|
||||
}
|
||||
@ -562,4 +569,86 @@ public class GUIUtil {
|
||||
.closeButtonText(Res.get("shared.cancel"))
|
||||
.show();
|
||||
}
|
||||
|
||||
public static Tuple2<ComboBox<TradeCurrency>, Integer> addRegionCountryTradeCurrencyComboBoxes(GridPane gridPane,
|
||||
int gridRow,
|
||||
Consumer<Country> onCountrySelectedHandler,
|
||||
Consumer<TradeCurrency> onTradeCurrencySelectedHandler) {
|
||||
gridRow = addRegionCountry(gridPane, gridRow, onCountrySelectedHandler);
|
||||
|
||||
ComboBox<TradeCurrency> currencyComboBox = FormBuilder.<TradeCurrency>addLabelComboBox(gridPane, ++gridRow,
|
||||
Res.getWithCol("shared.currency")).second;
|
||||
currencyComboBox.setPromptText(Res.get("list.currency.select"));
|
||||
currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getAllSortedFiatCurrencies()));
|
||||
|
||||
currencyComboBox.setConverter(new StringConverter<TradeCurrency>() {
|
||||
@Override
|
||||
public String toString(TradeCurrency currency) {
|
||||
return currency.getNameAndCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TradeCurrency fromString(String string) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
currencyComboBox.setDisable(true);
|
||||
|
||||
currencyComboBox.setOnAction(e -> {
|
||||
onTradeCurrencySelectedHandler.accept(currencyComboBox.getSelectionModel().getSelectedItem());
|
||||
});
|
||||
|
||||
return new Tuple2<>(currencyComboBox, gridRow);
|
||||
}
|
||||
|
||||
public static int addRegionCountry(GridPane gridPane,
|
||||
int gridRow,
|
||||
Consumer<Country> onCountrySelectedHandler) {
|
||||
Tuple3<Label, ComboBox<bisq.core.locale.Region>, ComboBox<Country>> tuple3 = FormBuilder.addLabelComboBoxComboBox(gridPane, ++gridRow, Res.get("payment.country"));
|
||||
|
||||
ComboBox<bisq.core.locale.Region> regionComboBox = tuple3.second;
|
||||
regionComboBox.setPromptText(Res.get("payment.select.region"));
|
||||
regionComboBox.setConverter(new StringConverter<bisq.core.locale.Region>() {
|
||||
@Override
|
||||
public String toString(bisq.core.locale.Region region) {
|
||||
return region.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public bisq.core.locale.Region fromString(String s) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
regionComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllRegions()));
|
||||
|
||||
ComboBox<Country> countryComboBox = tuple3.third;
|
||||
countryComboBox.setVisibleRowCount(15);
|
||||
countryComboBox.setDisable(true);
|
||||
countryComboBox.setPromptText(Res.get("payment.select.country"));
|
||||
countryComboBox.setConverter(new StringConverter<Country>() {
|
||||
@Override
|
||||
public String toString(Country country) {
|
||||
return country.name + " (" + country.code + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Country fromString(String s) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
regionComboBox.setOnAction(e -> {
|
||||
bisq.core.locale.Region selectedItem = regionComboBox.getSelectionModel().getSelectedItem();
|
||||
if (selectedItem != null) {
|
||||
countryComboBox.setDisable(false);
|
||||
countryComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllCountriesForRegion(selectedItem)));
|
||||
}
|
||||
});
|
||||
|
||||
countryComboBox.setOnAction(e -> {
|
||||
onCountrySelectedHandler.accept(countryComboBox.getSelectionModel().getSelectedItem());
|
||||
});
|
||||
|
||||
return gridRow;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user