use of javafx.scene.control.TextArea in project JFoenix by jfoenixadmin.
the class TextAreaDemo method start.
@Override
public void start(Stage stage) {
VBox main = new VBox();
main.setSpacing(50);
TextArea javafxTextArea = new TextArea();
javafxTextArea.setPromptText("JavaFX Text Area");
main.getChildren().add(javafxTextArea);
JFXTextArea jfxTextArea = new JFXTextArea();
jfxTextArea.setPromptText("JFoenix Text Area :D");
jfxTextArea.setLabelFloat(true);
RequiredFieldValidator validator = new RequiredFieldValidator();
// NOTE adding error class to text area is causing the cursor to disapper
validator.setErrorStyleClass("");
validator.setMessage("Please type something!");
validator.setIcon(new Icon(AwesomeIcon.WARNING, "1em", ";", "error"));
jfxTextArea.getValidators().add(validator);
jfxTextArea.focusedProperty().addListener((o, oldVal, newVal) -> {
if (!newVal)
jfxTextArea.validate();
});
main.getChildren().add(jfxTextArea);
StackPane pane = new StackPane();
pane.getChildren().add(main);
StackPane.setMargin(main, new Insets(100));
pane.setStyle("-fx-background-color:WHITE");
final Scene scene = new Scene(pane, 800, 600);
scene.getStylesheets().add(ButtonDemo.class.getResource("/resources/css/jfoenix-components.css").toExternalForm());
stage.setTitle("JFX Button Demo");
stage.setScene(scene);
stage.show();
}
use of javafx.scene.control.TextArea in project bitsquare by bitsquare.
the class USPostalMoneyOrderForm method addFormForBuyer.
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountContractData paymentAccountContractData) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Account holder name:", ((USPostalMoneyOrderAccountContractData) paymentAccountContractData).getHolderName());
TextArea textArea = addLabelTextArea(gridPane, ++gridRow, "Postal address:", "").second;
textArea.setPrefHeight(60);
textArea.setEditable(false);
textArea.setId("text-area-disabled");
textArea.setText(((USPostalMoneyOrderAccountContractData) paymentAccountContractData).getPostalAddress());
return gridRow;
}
use of javafx.scene.control.TextArea in project bitsquare by bitsquare.
the class CashDepositForm method addFormForBuyer.
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountContractData paymentAccountContractData) {
CashDepositAccountContractData data = (CashDepositAccountContractData) paymentAccountContractData;
String countryCode = data.getCountryCode();
String requirements = data.getRequirements();
boolean showRequirements = requirements != null && !requirements.isEmpty();
if (data.getHolderTaxId() != null)
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Account holder name / email / " + BankUtil.getHolderIdLabel(countryCode), data.getHolderName() + " / " + data.getHolderEmail() + " / " + data.getHolderTaxId());
else
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Account holder name / email:", data.getHolderName() + " / " + data.getHolderEmail());
if (!showRequirements)
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, "Country of bank:", CountryUtil.getNameAndCode(countryCode));
else
requirements += "\nCountry of bank: " + CountryUtil.getNameAndCode(countryCode);
// We don't want to display more than 6 rows to avoid scrolling, so if we get too many fields we combine them horizontally
int nrRows = 0;
if (BankUtil.isBankNameRequired(countryCode))
nrRows++;
if (BankUtil.isBankIdRequired(countryCode))
nrRows++;
if (BankUtil.isBranchIdRequired(countryCode))
nrRows++;
if (BankUtil.isAccountNrRequired(countryCode))
nrRows++;
if (BankUtil.isAccountTypeRequired(countryCode))
nrRows++;
String bankNameLabel = BankUtil.getBankNameLabel(countryCode);
String bankIdLabel = BankUtil.getBankIdLabel(countryCode);
String branchIdLabel = BankUtil.getBranchIdLabel(countryCode);
String accountNrLabel = BankUtil.getAccountNrLabel(countryCode);
String accountTypeLabel = BankUtil.getAccountTypeLabel(countryCode);
boolean accountNrAccountTypeCombined = false;
boolean bankNameBankIdCombined = false;
boolean bankIdBranchIdCombined = false;
boolean bankNameBranchIdCombined = false;
boolean branchIdAccountNrCombined = false;
if (nrRows > 2) {
// Try combine AccountNr + AccountType
accountNrAccountTypeCombined = BankUtil.isAccountNrRequired(countryCode) && BankUtil.isAccountTypeRequired(countryCode);
if (accountNrAccountTypeCombined)
nrRows--;
if (nrRows > 2) {
// Next we try BankName + BankId
bankNameBankIdCombined = BankUtil.isBankNameRequired(countryCode) && BankUtil.isBankIdRequired(countryCode);
if (bankNameBankIdCombined)
nrRows--;
if (nrRows > 2) {
// Next we try BankId + BranchId
bankIdBranchIdCombined = !bankNameBankIdCombined && BankUtil.isBankIdRequired(countryCode) && BankUtil.isBranchIdRequired(countryCode);
if (bankIdBranchIdCombined)
nrRows--;
if (nrRows > 2) {
// Next we try BankId + BranchId
bankNameBranchIdCombined = !bankNameBankIdCombined && !bankIdBranchIdCombined && BankUtil.isBankNameRequired(countryCode) && BankUtil.isBranchIdRequired(countryCode);
if (bankNameBranchIdCombined)
nrRows--;
if (nrRows > 2) {
branchIdAccountNrCombined = !bankNameBranchIdCombined && !bankIdBranchIdCombined && !accountNrAccountTypeCombined && BankUtil.isBranchIdRequired(countryCode) && BankUtil.isAccountNrRequired(countryCode);
if (branchIdAccountNrCombined)
nrRows--;
if (nrRows > 2)
log.warn("We still have too many rows....");
}
}
}
}
}
if (bankNameBankIdCombined) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankNameLabel.substring(0, bankNameLabel.length() - 1) + " / " + bankIdLabel.substring(0, bankIdLabel.length() - 1) + ":", data.getBankName() + " / " + data.getBankId());
}
if (bankNameBranchIdCombined) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankNameLabel.substring(0, bankNameLabel.length() - 1) + " / " + branchIdLabel.substring(0, branchIdLabel.length() - 1) + ":", data.getBankName() + " / " + data.getBranchId());
}
if (!bankNameBankIdCombined && !bankNameBranchIdCombined && BankUtil.isBankNameRequired(countryCode))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankNameLabel, data.getBankName());
if (!bankNameBankIdCombined && !bankNameBranchIdCombined && !branchIdAccountNrCombined && bankIdBranchIdCombined) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankIdLabel.substring(0, bankIdLabel.length() - 1) + " / " + branchIdLabel.substring(0, branchIdLabel.length() - 1) + ":", data.getBankId() + " / " + data.getBranchId());
}
if (!bankNameBankIdCombined && !bankIdBranchIdCombined && BankUtil.isBankIdRequired(countryCode))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, bankIdLabel, data.getBankId());
if (!bankNameBranchIdCombined && !bankIdBranchIdCombined && branchIdAccountNrCombined) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, branchIdLabel.substring(0, branchIdLabel.length() - 1) + " / " + accountNrLabel.substring(0, accountNrLabel.length() - 1) + ":", data.getBranchId() + " / " + data.getAccountNr());
}
if (!bankNameBranchIdCombined && !bankIdBranchIdCombined && !branchIdAccountNrCombined && BankUtil.isBranchIdRequired(countryCode))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, branchIdLabel, data.getBranchId());
if (!branchIdAccountNrCombined && accountNrAccountTypeCombined) {
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, accountNrLabel.substring(0, accountNrLabel.length() - 1) + " / " + accountTypeLabel, data.getAccountNr() + " / " + data.getAccountType());
}
if (!branchIdAccountNrCombined && !accountNrAccountTypeCombined && BankUtil.isAccountNrRequired(countryCode))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, accountNrLabel, data.getAccountNr());
if (!accountNrAccountTypeCombined && BankUtil.isAccountTypeRequired(countryCode))
addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, accountTypeLabel, data.getAccountType());
if (showRequirements) {
TextArea textArea = addLabelTextArea(gridPane, ++gridRow, "Extra requirements:", "").second;
textArea.setMinHeight(45);
textArea.setMaxHeight(45);
textArea.setEditable(false);
textArea.setId("text-area-disabled");
textArea.setText(requirements);
}
return gridRow;
}
use of javafx.scene.control.TextArea in project bitsquare by bitsquare.
the class CashDepositForm method addFormForAddAccount.
@Override
public void addFormForAddAccount() {
gridRowFrom = gridRow + 1;
Tuple3<Label, ComboBox, ComboBox> tuple3 = addLabelComboBoxComboBox(gridPane, ++gridRow, "Country:");
ComboBox<Region> regionComboBox = tuple3.second;
regionComboBox.setPromptText("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()));
ComboBox<Country> countryComboBox = tuple3.third;
countryComboBox.setVisibleRowCount(15);
countryComboBox.setDisable(true);
countryComboBox.setPromptText("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));
accountNrLabel.setText(BankUtil.getAccountNrLabel(countryCode));
accountTypeLabel.setText(BankUtil.getAccountTypeLabel(countryCode));
bankNameInputTextField.setText("");
bankIdInputTextField.setText("");
branchIdInputTextField.setText("");
accountNrInputTextField.setText("");
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));
} else {
validatorsApplied = false;
if (useHolderID)
holderIdInputTextField.setValidator(null);
bankNameInputTextField.setValidator(null);
bankIdInputTextField.setValidator(null);
branchIdInputTextField.setValidator(null);
accountNrInputTextField.setValidator(null);
}
holderNameInputTextField.resetValidation();
holderEmailInputTextField.resetValidation();
bankNameInputTextField.resetValidation();
bankIdInputTextField.resetValidation();
branchIdInputTextField.resetValidation();
accountNrInputTextField.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 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)));
}
});
currencyComboBox = addLabelComboBox(gridPane, ++gridRow, "Currency:").second;
currencyComboBox.setPromptText("Select currency");
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("Are you sure you want to choose a currency other than the country's default currency?").actionButtonText("Yes").onAction(() -> {
paymentAccount.setSingleTradeCurrency(selectedItem);
autoFillNameTextField();
}).closeButtonText("No, restore default currency").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);
addAcceptedBanksForAddAccount();
addHolderNameAndId();
bankNameTuple = addLabelInputTextField(gridPane, ++gridRow, "Bank name:");
bankNameInputTextField = bankNameTuple.second;
bankNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
cashDepositAccountContractData.setBankName(newValue);
updateFromInputs();
});
bankIdTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getBankIdLabel(""));
bankIdLabel = bankIdTuple.first;
bankIdInputTextField = bankIdTuple.second;
bankIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
cashDepositAccountContractData.setBankId(newValue);
updateFromInputs();
});
branchIdTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getBranchIdLabel(""));
branchIdLabel = branchIdTuple.first;
branchIdInputTextField = branchIdTuple.second;
branchIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
cashDepositAccountContractData.setBranchId(newValue);
updateFromInputs();
});
accountNrTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getAccountNrLabel(""));
accountNrLabel = accountNrTuple.first;
accountNrInputTextField = accountNrTuple.second;
accountNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
cashDepositAccountContractData.setAccountNr(newValue);
updateFromInputs();
});
accountTypeTuple = addLabelComboBox(gridPane, ++gridRow, "");
accountTypeLabel = accountTypeTuple.first;
accountTypeComboBox = accountTypeTuple.second;
accountTypeComboBox.setPromptText("Select account type");
accountTypeComboBox.setOnAction(e -> {
if (BankUtil.isAccountTypeRequired(cashDepositAccountContractData.getCountryCode())) {
cashDepositAccountContractData.setAccountType(accountTypeComboBox.getSelectionModel().getSelectedItem());
updateFromInputs();
}
});
TextArea requirementsTextArea = addLabelTextArea(gridPane, ++gridRow, "Extra requirements:", "").second;
requirementsTextArea.setMinHeight(30);
requirementsTextArea.setMaxHeight(30);
requirementsTextArea.textProperty().addListener((ov, oldValue, newValue) -> {
cashDepositAccountContractData.setRequirements(newValue);
updateFromInputs();
});
addAllowedPeriod();
addAccountNameTextFieldWithAutoFillCheckBox();
updateFromInputs();
}
use of javafx.scene.control.TextArea in project bitsquare by bitsquare.
the class CashDepositForm method addFormForDisplayAccount.
@Override
public void addFormForDisplayAccount() {
gridRowFrom = gridRow;
String countryCode = cashDepositAccountContractData.getCountryCode();
addLabelTextField(gridPane, gridRow, "Account name:", paymentAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
addLabelTextField(gridPane, ++gridRow, "Payment method:", BSResources.get(paymentAccount.getPaymentMethod().getId()));
addLabelTextField(gridPane, ++gridRow, "Country:", getCountryBasedPaymentAccount().getCountry() != null ? getCountryBasedPaymentAccount().getCountry().name : "");
addLabelTextField(gridPane, ++gridRow, "Currency:", paymentAccount.getSingleTradeCurrency().getNameAndCode());
addAcceptedBanksForDisplayAccount();
addHolderNameAndIdForDisplayAccount();
addLabelTextField(gridPane, ++gridRow, "Account holder email:", cashDepositAccountContractData.getHolderEmail());
if (BankUtil.isBankNameRequired(countryCode))
addLabelTextField(gridPane, ++gridRow, "Bank name:", cashDepositAccountContractData.getBankName()).second.setMouseTransparent(false);
if (BankUtil.isBankIdRequired(countryCode))
addLabelTextField(gridPane, ++gridRow, BankUtil.getBankIdLabel(countryCode), cashDepositAccountContractData.getBankId()).second.setMouseTransparent(false);
if (BankUtil.isBranchIdRequired(countryCode))
addLabelTextField(gridPane, ++gridRow, BankUtil.getBranchIdLabel(countryCode), cashDepositAccountContractData.getBranchId()).second.setMouseTransparent(false);
if (BankUtil.isAccountNrRequired(countryCode))
addLabelTextField(gridPane, ++gridRow, BankUtil.getAccountNrLabel(countryCode), cashDepositAccountContractData.getAccountNr()).second.setMouseTransparent(false);
if (BankUtil.isAccountTypeRequired(countryCode))
addLabelTextField(gridPane, ++gridRow, BankUtil.getAccountTypeLabel(countryCode), cashDepositAccountContractData.getAccountType()).second.setMouseTransparent(false);
String requirements = cashDepositAccountContractData.getRequirements();
boolean showRequirements = requirements != null && !requirements.isEmpty();
if (showRequirements) {
TextArea textArea = addLabelTextArea(gridPane, ++gridRow, "Extra requirements:", "").second;
textArea.setMinHeight(30);
textArea.setMaxHeight(30);
textArea.setEditable(false);
textArea.setId("text-area-disabled");
textArea.setText(requirements);
}
addAllowedPeriod();
}
Aggregations