Fix wrong paddings for bank accounts with holder id

This commit is contained in:
Christoph Atteneder 2018-11-28 12:53:10 +01:00
parent 0f3186b54e
commit 888e4f5bc5
No known key found for this signature in database
GPG Key ID: CD5DC1C529CDFD3B
3 changed files with 22 additions and 23 deletions

View File

@ -419,7 +419,7 @@ abstract class BankForm extends GeneralBankForm {
private void addHolderNameAndIdForDisplayAccount() {
String countryCode = bankAccountPayload.getCountryCode();
if (BankUtil.isHolderIdRequired(countryCode)) {
Tuple4<Label, TextField, Label, TextField> tuple = addLabelTextFieldLabelTextField(gridPane, ++gridRow,
Tuple4<Label, TextField, Label, TextField> tuple = addCompactTopLabelTextFieldTopLabelTextField(gridPane, ++gridRow,
Res.get("payment.account.owner"), BankUtil.getHolderIdLabel(countryCode));
TextField holderNameTextField = tuple.second;
holderNameTextField.setText(bankAccountPayload.getHolderName());

View File

@ -18,7 +18,6 @@
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;
@ -196,46 +195,46 @@ public class CashDepositForm extends GeneralBankForm {
String countryCode = cashDepositAccountPayload.getCountryCode();
addTopLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), paymentAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"),
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"),
Res.get(paymentAccount.getPaymentMethod().getId()));
FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("payment.country"),
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.country"),
getCountryBasedPaymentAccount().getCountry() != null ? getCountryBasedPaymentAccount().getCountry().name : "");
TradeCurrency singleTradeCurrency = paymentAccount.getSingleTradeCurrency();
String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "null";
FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"),
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"),
nameAndCode);
addHolderNameAndIdForDisplayAccount();
FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("payment.email"),
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.email"),
cashDepositAccountPayload.getHolderEmail());
if (BankUtil.isBankNameRequired(countryCode))
FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("payment.bank.name"),
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.bank.name"),
cashDepositAccountPayload.getBankName()).second.setMouseTransparent(false);
if (BankUtil.isBankIdRequired(countryCode))
FormBuilder.addTopLabelTextField(gridPane, ++gridRow, BankUtil.getBankIdLabel(countryCode),
addCompactTopLabelTextField(gridPane, ++gridRow, BankUtil.getBankIdLabel(countryCode),
cashDepositAccountPayload.getBankId()).second.setMouseTransparent(false);
if (BankUtil.isBranchIdRequired(countryCode))
FormBuilder.addTopLabelTextField(gridPane, ++gridRow, BankUtil.getBranchIdLabel(countryCode),
addCompactTopLabelTextField(gridPane, ++gridRow, BankUtil.getBranchIdLabel(countryCode),
cashDepositAccountPayload.getBranchId()).second.setMouseTransparent(false);
if (BankUtil.isNationalAccountIdRequired(countryCode))
FormBuilder.addTopLabelTextField(gridPane, ++gridRow, BankUtil.getNationalAccountIdLabel(countryCode),
addCompactTopLabelTextField(gridPane, ++gridRow, BankUtil.getNationalAccountIdLabel(countryCode),
cashDepositAccountPayload.getNationalAccountId()).second.setMouseTransparent(false);
if (BankUtil.isAccountNrRequired(countryCode))
FormBuilder.addTopLabelTextField(gridPane, ++gridRow, BankUtil.getAccountNrLabel(countryCode),
addCompactTopLabelTextField(gridPane, ++gridRow, BankUtil.getAccountNrLabel(countryCode),
cashDepositAccountPayload.getAccountNr()).second.setMouseTransparent(false);
if (BankUtil.isAccountTypeRequired(countryCode))
FormBuilder.addTopLabelTextField(gridPane, ++gridRow, BankUtil.getAccountTypeLabel(countryCode),
addCompactTopLabelTextField(gridPane, ++gridRow, BankUtil.getAccountTypeLabel(countryCode),
cashDepositAccountPayload.getAccountType()).second.setMouseTransparent(false);
String requirements = cashDepositAccountPayload.getRequirements();
boolean showRequirements = requirements != null && !requirements.isEmpty();
if (showRequirements) {
TextArea textArea = addTopLabelTextArea(gridPane, ++gridRow, Res.get("payment.extras"), "").second;
TextArea textArea = addCompactTopLabelTextArea(gridPane, ++gridRow, Res.get("payment.extras"), "").second;
textArea.setMinHeight(30);
textArea.setMaxHeight(30);
textArea.setEditable(false);
@ -466,14 +465,14 @@ public class CashDepositForm extends GeneralBankForm {
private void addHolderNameAndIdForDisplayAccount() {
String countryCode = cashDepositAccountPayload.getCountryCode();
if (BankUtil.isHolderIdRequired(countryCode)) {
Tuple4<Label, TextField, Label, TextField> tuple = FormBuilder.addLabelTextFieldLabelTextField(gridPane, ++gridRow,
Tuple4<Label, TextField, Label, TextField> tuple = addCompactTopLabelTextFieldTopLabelTextField(gridPane, ++gridRow,
Res.get("payment.account.owner"), BankUtil.getHolderIdLabel(countryCode));
TextField holderNameTextField = tuple.second;
holderNameTextField.setText(cashDepositAccountPayload.getHolderName());
holderNameTextField.setMinWidth(300);
tuple.forth.setText(cashDepositAccountPayload.getHolderTaxId());
} else {
FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.owner"),
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.owner"),
cashDepositAccountPayload.getHolderName());
}
}

View File

@ -656,28 +656,28 @@ public class FormBuilder {
// Label + TextField + Label + TextField
///////////////////////////////////////////////////////////////////////////////////////////
public static Tuple4<Label, TextField, Label, TextField> addLabelTextFieldLabelTextField(GridPane gridPane, int rowIndex, String title1, String title2) {
Label label1 = addLabel(gridPane, rowIndex, title1, 0);
public static Tuple4<Label, TextField, Label, TextField> addCompactTopLabelTextFieldTopLabelTextField(GridPane gridPane, int rowIndex, String title1, String title2) {
TextField textField1 = new BisqTextField();
textField1.setEditable(false);
textField1.setMouseTransparent(true);
textField1.setFocusTraversable(false);
Label label2 = new AutoTooltipLabel(title2);
HBox.setMargin(label2, new Insets(5, 0, 0, 0));
final Tuple2<Label, VBox> topLabelWithVBox1 = getTopLabelWithVBox(title1, textField1);
TextField textField2 = new BisqTextField();
textField2.setEditable(false);
textField2.setMouseTransparent(true);
textField2.setFocusTraversable(false);
final Tuple2<Label, VBox> topLabelWithVBox2 = getTopLabelWithVBox(title2, textField2);
HBox hBox = new HBox();
hBox.setSpacing(10);
hBox.getChildren().addAll(textField1, label2, textField2);
hBox.getChildren().addAll(topLabelWithVBox1.second, topLabelWithVBox2.second);
GridPane.setRowIndex(hBox, rowIndex);
GridPane.setColumnIndex(hBox, 1);
gridPane.getChildren().add(hBox);
return new Tuple4<>(label1, textField1, label2, textField2);
return new Tuple4<>(topLabelWithVBox1.first, textField1, topLabelWithVBox2.first, textField2);
}