mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 10:22:18 +01:00
Clean up PerfectMoneyForm
This commit is contained in:
parent
1134ce178c
commit
05277f8c5e
@ -19,7 +19,6 @@ package bisq.desktop.components.paymentmethods;
|
||||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.Layout;
|
||||
import bisq.desktop.util.validation.AliPayValidator;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
@ -34,13 +33,11 @@ import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.GridPane;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static bisq.desktop.util.FormBuilder.addTopLabelTextField;
|
||||
import static bisq.desktop.util.FormBuilder.addTopLabelTextFieldWithCopyIcon;
|
||||
|
||||
public class AliPayForm extends PaymentMethodForm {
|
||||
@ -91,15 +88,9 @@ public class AliPayForm extends PaymentMethodForm {
|
||||
|
||||
@Override
|
||||
public void addFormForDisplayAccount() {
|
||||
gridRowFrom = gridRow;
|
||||
addTopLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), aliPayAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"), Res.get(aliPayAccount.getPaymentMethod().getId()));
|
||||
TextField field = FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.no"), aliPayAccount.getAccountNr()).second;
|
||||
field.setMouseTransparent(false);
|
||||
final TradeCurrency singleTradeCurrency = aliPayAccount.getSingleTradeCurrency();
|
||||
final String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "";
|
||||
FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"), nameAndCode);
|
||||
addLimitations();
|
||||
addFormForAccountNumberDisplayAccount(aliPayAccount.getAccountName(),
|
||||
aliPayAccount.getPaymentMethod(), aliPayAccount.getAccountNr(),
|
||||
aliPayAccount.getSingleTradeCurrency());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,6 +22,7 @@ import bisq.desktop.components.InfoTextField;
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.main.overlays.popups.Popup;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.Layout;
|
||||
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.FiatCurrency;
|
||||
@ -31,6 +32,7 @@ import bisq.core.offer.Offer;
|
||||
import bisq.core.payment.AccountAgeWitnessService;
|
||||
import bisq.core.payment.CryptoCurrencyAccount;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.payload.PaymentMethod;
|
||||
import bisq.core.util.BSFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
@ -44,6 +46,7 @@ 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.TextField;
|
||||
import javafx.scene.control.ToggleButton;
|
||||
import javafx.scene.control.Tooltip;
|
||||
import javafx.scene.layout.FlowPane;
|
||||
@ -246,6 +249,20 @@ public abstract class PaymentMethodForm {
|
||||
flowPane.getChildren().add(checkBox);
|
||||
}
|
||||
|
||||
void addFormForAccountNumberDisplayAccount(String accountName, PaymentMethod paymentMethod, String accountNr,
|
||||
TradeCurrency singleTradeCurrency) {
|
||||
gridRowFrom = gridRow;
|
||||
addTopLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), accountName, Layout.FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"), Res.get(paymentMethod.getId()));
|
||||
TextField field = FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.no"), accountNr).second;
|
||||
field.setMouseTransparent(false);
|
||||
|
||||
final String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "";
|
||||
FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"), nameAndCode);
|
||||
|
||||
addLimitations();
|
||||
}
|
||||
|
||||
abstract protected void autoFillNameTextField();
|
||||
|
||||
abstract public void addFormForAddAccount();
|
||||
|
@ -19,12 +19,10 @@ package bisq.desktop.components.paymentmethods;
|
||||
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.Layout;
|
||||
import bisq.desktop.util.validation.PerfectMoneyValidator;
|
||||
|
||||
import bisq.core.locale.FiatCurrency;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
import bisq.core.payment.AccountAgeWitnessService;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.payment.PerfectMoneyAccount;
|
||||
@ -33,21 +31,13 @@ import bisq.core.payment.payload.PerfectMoneyAccountPayload;
|
||||
import bisq.core.util.BSFormatter;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.GridPane;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static bisq.desktop.util.FormBuilder.addTopLabelTextField;
|
||||
import static bisq.desktop.util.FormBuilder.addTopLabelTextFieldWithCopyIcon;
|
||||
|
||||
public class PerfectMoneyForm extends PaymentMethodForm {
|
||||
private static final Logger log = LoggerFactory.getLogger(PerfectMoneyForm.class);
|
||||
|
||||
private final PerfectMoneyAccount perfectMoneyAccount;
|
||||
private final PerfectMoneyValidator perfectMoneyValidator;
|
||||
@ -86,27 +76,14 @@ public class PerfectMoneyForm extends PaymentMethodForm {
|
||||
|
||||
@Override
|
||||
protected void autoFillNameTextField() {
|
||||
if (useCustomAccountNameToggleButton != null && !useCustomAccountNameToggleButton.isSelected()) {
|
||||
String accountNr = accountNrInputTextField.getText();
|
||||
accountNr = StringUtils.abbreviate(accountNr, 9);
|
||||
String method = Res.get(paymentAccount.getPaymentMethod().getId());
|
||||
accountNameTextField.setText(method.concat(": ").concat(accountNr));
|
||||
}
|
||||
setAccountNameWithString(accountNrInputTextField.getText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFormForDisplayAccount() {
|
||||
gridRowFrom = gridRow;
|
||||
addTopLabelTextField(gridPane, gridRow, Res.get("payment.account.name"), perfectMoneyAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
|
||||
FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.paymentMethod"), Res.get(perfectMoneyAccount.getPaymentMethod().getId()));
|
||||
TextField field = FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.no"), perfectMoneyAccount.getAccountNr()).second;
|
||||
field.setMouseTransparent(false);
|
||||
|
||||
final TradeCurrency singleTradeCurrency = perfectMoneyAccount.getSingleTradeCurrency();
|
||||
final String nameAndCode = singleTradeCurrency != null ? singleTradeCurrency.getNameAndCode() : "";
|
||||
FormBuilder.addTopLabelTextField(gridPane, ++gridRow, Res.get("shared.currency"), nameAndCode);
|
||||
|
||||
addLimitations();
|
||||
addFormForAccountNumberDisplayAccount(perfectMoneyAccount.getAccountName(),
|
||||
perfectMoneyAccount.getPaymentMethod(), perfectMoneyAccount.getAccountNr(),
|
||||
perfectMoneyAccount.getSingleTradeCurrency());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user