use of bisq.core.locale.TradeCurrency in project bisq-desktop by bisq-network.
the class PopmoneyForm method addFormForAddAccount.
@Override
public void addFormForAddAccount() {
gridRowFrom = gridRow + 1;
InputTextField holderNameInputTextField = addLabelInputTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.owner")).second;
holderNameInputTextField.setValidator(inputValidator);
holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
account.setHolderName(newValue);
updateFromInputs();
});
accountIdInputTextField = addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.popmoney.accountId")).second;
accountIdInputTextField.setValidator(validator);
accountIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
account.setAccountId(newValue);
updateFromInputs();
});
final TradeCurrency singleTradeCurrency = account.getSingleTradeCurrency();
final String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "";
addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.currency"), nameAndCode);
addLimitations();
addAccountNameTextFieldWithAutoFillCheckBox();
}
use of bisq.core.locale.TradeCurrency in project bisq-desktop by bisq-network.
the class PopmoneyForm method addFormForDisplayAccount.
@Override
public void addFormForDisplayAccount() {
gridRowFrom = gridRow;
addLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), account.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.paymentMethod"), Res.get(account.getPaymentMethod().getId()));
addLabelTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.owner"), account.getHolderName());
TextField field = addLabelTextField(gridPane, ++gridRow, Res.get("payment.popmoney.accountId"), account.getAccountId()).second;
field.setMouseTransparent(false);
final TradeCurrency singleTradeCurrency = account.getSingleTradeCurrency();
final String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "";
addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.currency"), nameAndCode);
addLimitations();
}
use of bisq.core.locale.TradeCurrency in project bisq-desktop by bisq-network.
the class SepaForm method updateCountriesSelection.
private void updateCountriesSelection(boolean isEditable, List<CheckBox> checkBoxList) {
checkBoxList.stream().forEach(checkBox -> {
String countryCode = (String) checkBox.getUserData();
TradeCurrency selectedCurrency = sepaAccount.getSelectedTradeCurrency();
if (selectedCurrency == null) {
Country country = CountryUtil.getDefaultCountry();
if (CountryUtil.getAllSepaCountries().contains(country))
selectedCurrency = CurrencyUtil.getCurrencyByCountryCode(country.code);
}
boolean selected;
if (isEditable && selectedCurrency != null) {
selected = true;
sepaAccount.addAcceptedCountry(countryCode);
} else {
selected = sepaAccount.getAcceptedCountryCodes().contains(countryCode);
}
checkBox.setSelected(selected);
});
}
use of bisq.core.locale.TradeCurrency in project bisq-desktop by bisq-network.
the class SepaForm method addFormForDisplayAccount.
@Override
public void addFormForDisplayAccount() {
gridRowFrom = gridRow;
FormBuilder.addLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), sepaAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.paymentMethod"), Res.get(sepaAccount.getPaymentMethod().getId()));
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.owner"), sepaAccount.getHolderName());
FormBuilder.addLabelTextField(gridPane, ++gridRow, "IBAN:", sepaAccount.getIban()).second.setMouseTransparent(false);
FormBuilder.addLabelTextField(gridPane, ++gridRow, "BIC:", sepaAccount.getBic()).second.setMouseTransparent(false);
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.get("payment.bank.country"), sepaAccount.getCountry() != null ? sepaAccount.getCountry().name : "");
TradeCurrency singleTradeCurrency = sepaAccount.getSingleTradeCurrency();
String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null";
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.currency"), nameAndCode);
String countries;
Tooltip tooltip = null;
if (CountryUtil.containsAllSepaEuroCountries(sepaAccount.getAcceptedCountryCodes())) {
countries = Res.getWithCol("shared.allEuroCountries");
} else {
countries = CountryUtil.getCodesString(sepaAccount.getAcceptedCountryCodes());
tooltip = new Tooltip(CountryUtil.getNamesByCodesString(sepaAccount.getAcceptedCountryCodes()));
}
TextField acceptedCountries = FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.get("payment.accepted.countries"), countries).second;
if (tooltip != null) {
acceptedCountries.setMouseTransparent(false);
acceptedCountries.setTooltip(tooltip);
}
addLimitations();
}
use of bisq.core.locale.TradeCurrency in project bisq-desktop by bisq-network.
the class SepaInstantForm method addFormForAddAccount.
@Override
public void addFormForAddAccount() {
gridRowFrom = gridRow + 1;
InputTextField holderNameInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.owner")).second;
holderNameInputTextField.setValidator(inputValidator);
holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
sepaInstantAccount.setHolderName(newValue);
updateFromInputs();
});
ibanInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, "IBAN:").second;
ibanInputTextField.setValidator(ibanValidator);
ibanInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
sepaInstantAccount.setIban(newValue);
updateFromInputs();
});
InputTextField bicInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, "BIC:").second;
bicInputTextField.setValidator(bicValidator);
bicInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
sepaInstantAccount.setBic(newValue);
updateFromInputs();
});
FormBuilder.addLabel(gridPane, ++gridRow, Res.getWithCol("payment.bank.country"));
HBox hBox = new HBox();
hBox.setSpacing(10);
ComboBox<Country> countryComboBox = new ComboBox<>();
currencyComboBox = new ComboBox<>();
currencyTextField = new TextField("");
currencyTextField.setEditable(false);
currencyTextField.setMouseTransparent(true);
currencyTextField.setFocusTraversable(false);
currencyTextField.setMinWidth(300);
currencyTextField.setVisible(false);
currencyTextField.setManaged(false);
currencyComboBox.setVisible(false);
currencyComboBox.setManaged(false);
hBox.getChildren().addAll(countryComboBox, currencyTextField, currencyComboBox);
GridPane.setRowIndex(hBox, gridRow);
GridPane.setColumnIndex(hBox, 1);
gridPane.getChildren().add(hBox);
countryComboBox.setPromptText(Res.get("payment.select.bank.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();
sepaInstantAccount.setCountry(selectedItem);
TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(selectedItem.code);
setupCurrency(selectedItem, currency);
updateCountriesSelection(true, euroCountryCheckBoxes);
updateCountriesSelection(true, nonEuroCountryCheckBoxes);
updateFromInputs();
});
addEuroCountriesGrid(true);
addNonEuroCountriesGrid(true);
addLimitations();
addAccountNameTextFieldWithAutoFillCheckBox();
countryComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllSepaInstantCountries()));
Country country = CountryUtil.getDefaultCountry();
if (CountryUtil.getAllSepaInstantCountries().contains(country)) {
countryComboBox.getSelectionModel().select(country);
sepaInstantAccount.setCountry(country);
TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(country.code);
setupCurrency(country, currency);
}
updateFromInputs();
}
Aggregations