This commit is contained in:
BtcContributor 2021-02-24 12:17:27 +01:00
parent 314e6ce314
commit d2dd99fdb3
No known key found for this signature in database
GPG key ID: DA582457496C7F6D
3 changed files with 41 additions and 3 deletions

View file

@ -39,7 +39,7 @@ public class TextFieldWithCopyIcon extends AnchorPane {
private final StringProperty text = new SimpleStringProperty();
private final TextField textField;
private boolean copyWithoutCurrencyPostFix;
private boolean copyWithoutBeforeSlash;
///////////////////////////////////////////////////////////////////////////////////////////
// Constructor
@ -65,6 +65,12 @@ public class TextFieldWithCopyIcon extends AnchorPane {
copyText = strings[0]; // exclude the BTC postfix
else
copyText = text;
} else if (copyWithoutBeforeSlash) {
String[] strings = text.split(" ");
if (strings.length > 1)
copyText = strings[2]; // exclude the part before / (slash included)
else
copyText = text;
} else {
copyText = text;
}
@ -110,4 +116,8 @@ public class TextFieldWithCopyIcon extends AnchorPane {
this.copyWithoutCurrencyPostFix = copyWithoutCurrencyPostFix;
}
public void setCopyWithoutBeforeSlash(boolean copyWithoutBeforeSlash) {
this.copyWithoutBeforeSlash = copyWithoutBeforeSlash;
}
}

View file

@ -105,13 +105,13 @@ abstract class BankForm extends GeneralBankForm {
addCompactTopLabelTextFieldWithCopyIcon(gridPane, getIndexOfColumn(colIndex) == 0 ? ++gridRow : gridRow, getIndexOfColumn(colIndex++),
bankNameLabel + " / " +
bankIdLabel + ":",
data.getBankName() + " / " + data.getBankId());
data.getBankName() + " / " + data.getBankId(), true);
}
if (bankNameBranchIdCombined) {
addCompactTopLabelTextFieldWithCopyIcon(gridPane, getIndexOfColumn(colIndex) == 0 ? ++gridRow : gridRow, getIndexOfColumn(colIndex++),
bankNameLabel + " / " +
branchIdLabel + ":",
data.getBankName() + " / " + data.getBranchId());
data.getBankName() + " / " + data.getBranchId(), true);
}
if (!bankNameBankIdCombined && !bankNameBranchIdCombined && BankUtil.isBankNameRequired(countryCode))

View file

@ -1519,6 +1519,15 @@ public class FormBuilder {
return addTopLabelTextFieldWithCopyIcon(gridPane, rowIndex, colIndex, title, value, -Layout.FLOATING_LABEL_DISTANCE);
}
public static Tuple2<Label, TextFieldWithCopyIcon> addCompactTopLabelTextFieldWithCopyIcon(GridPane gridPane,
int rowIndex,
int colIndex,
String title,
String value,
boolean withoutBeforeSlash) {
return addTopLabelTextFieldWithCopyIcon(gridPane, rowIndex, colIndex, title, value, -Layout.FLOATING_LABEL_DISTANCE, withoutBeforeSlash);
}
public static Tuple2<Label, TextFieldWithCopyIcon> addTopLabelTextFieldWithCopyIcon(GridPane gridPane,
int rowIndex,
String title,
@ -1548,6 +1557,25 @@ public class FormBuilder {
return new Tuple2<>(topLabelWithVBox.first, textFieldWithCopyIcon);
}
public static Tuple2<Label, TextFieldWithCopyIcon> addTopLabelTextFieldWithCopyIcon(GridPane gridPane,
int rowIndex,
int colIndex,
String title,
String value,
double top,
boolean withoutBeforeSlash) {
TextFieldWithCopyIcon textFieldWithCopyIcon = new TextFieldWithCopyIcon();
textFieldWithCopyIcon.setText(value);
textFieldWithCopyIcon.setCopyWithoutBeforeSlash(true);
final Tuple2<Label, VBox> topLabelWithVBox = addTopLabelWithVBox(gridPane, rowIndex, title, textFieldWithCopyIcon, top);
topLabelWithVBox.second.setAlignment(Pos.TOP_LEFT);
GridPane.setColumnIndex(topLabelWithVBox.second, colIndex);
return new Tuple2<>(topLabelWithVBox.first, textFieldWithCopyIcon);
}
public static Tuple2<Label, TextFieldWithCopyIcon> addTopLabelTextFieldWithCopyIcon(GridPane gridPane,
int rowIndex,
int colIndex,