use of bisq.core.locale.TradeCurrency in project bisq-desktop by bisq-network.
the class CreateOfferView method addPaymentGroup.
private void addPaymentGroup() {
TitledGroupBg titledGroupBg = addTitledGroupBg(gridPane, gridRow, 2, Res.get("shared.selectTradingAccount"));
GridPane.setColumnSpan(titledGroupBg, 3);
// noinspection unchecked
paymentAccountsComboBox = addLabelComboBox(gridPane, gridRow, Res.getWithCol("shared.tradingAccount"), Layout.FIRST_ROW_DISTANCE).second;
paymentAccountsComboBox.setPromptText(Res.get("shared.selectTradingAccount"));
paymentAccountsComboBox.setMinWidth(300);
editOfferElements.add(paymentAccountsComboBox);
// we display either currencyComboBox (multi currency account) or currencyTextField (single)
Tuple2<Label, ComboBox> currencyComboBoxTuple = 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"));
currencyComboBox.setConverter(new StringConverter<TradeCurrency>() {
@Override
public String toString(TradeCurrency tradeCurrency) {
return tradeCurrency.getNameAndCode();
}
@Override
public TradeCurrency fromString(String s) {
return null;
}
});
Tuple2<Label, TextField> currencyTextFieldTuple = addLabelTextField(gridPane, gridRow, Res.getWithCol("shared.currency"), "", 5);
currencyTextFieldLabel = currencyTextFieldTuple.first;
editOfferElements.add(currencyTextFieldLabel);
currencyTextField = currencyTextFieldTuple.second;
editOfferElements.add(currencyTextField);
}
use of bisq.core.locale.TradeCurrency in project bisq-desktop by bisq-network.
the class SwishForm 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) -> {
swishAccount.setHolderName(newValue);
updateFromInputs();
});
mobileNrInputTextField = addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.mobile")).second;
mobileNrInputTextField.setValidator(swishValidator);
mobileNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
swishAccount.setMobileNr(newValue);
updateFromInputs();
});
TradeCurrency singleTradeCurrency = swishAccount.getSingleTradeCurrency();
String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null";
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 VenmoForm 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.venmo.venmoUserName"), account.getVenmoUserName()).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 WesternUnionForm method addFormForAddAccount.
@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);
holderNameInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.fullName")).second;
holderNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
westernUnionAccountPayload.setHolderName(newValue);
updateFromInputs();
});
holderNameInputTextField.setValidator(inputValidator);
cityInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.account.city")).second;
cityInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
westernUnionAccountPayload.setCity(newValue);
updateFromInputs();
});
final Tuple2<Label, InputTextField> tuple2 = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.account.state"));
stateLabel = tuple2.first;
stateInputTextField = tuple2.second;
stateInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
westernUnionAccountPayload.setState(newValue);
updateFromInputs();
});
applyIsStateRequired();
emailInputTextField = FormBuilder.addLabelInputTextField(gridPane, ++gridRow, Res.get("payment.email")).second;
emailInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
westernUnionAccountPayload.setEmail(newValue);
updateFromInputs();
});
emailInputTextField.setValidator(emailValidator);
addLimitations();
addAccountNameTextFieldWithAutoFillCheckBox();
updateFromInputs();
}
use of bisq.core.locale.TradeCurrency in project bisq-desktop by bisq-network.
the class WesternUnionForm method addFormForDisplayAccount.
@Override
public void addFormForDisplayAccount() {
gridRowFrom = gridRow;
String countryCode = westernUnionAccountPayload.getCountryCode();
FormBuilder.addLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), paymentAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.paymentMethod"), Res.get(paymentAccount.getPaymentMethod().getId()));
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.get("payment.country"), getCountryBasedPaymentAccount().getCountry() != null ? getCountryBasedPaymentAccount().getCountry().name : "");
TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency();
String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null";
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.getWithCol("shared.currency"), nameAndCode);
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.getWithCol("payment.account.fullName"), westernUnionAccountPayload.getHolderName());
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.get("payment.account.city"), westernUnionAccountPayload.getCity()).second.setMouseTransparent(false);
if (BankUtil.isStateRequired(westernUnionAccountPayload.getCountryCode()))
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.get("payment.account.state"), westernUnionAccountPayload.getState()).second.setMouseTransparent(false);
FormBuilder.addLabelTextField(gridPane, ++gridRow, Res.get("payment.email"), westernUnionAccountPayload.getEmail());
addLimitations();
}
Aggregations