Skip to content

Commit

Permalink
Allow for word wrapping on "Accepted taker countries" field
Browse files Browse the repository at this point in the history
  • Loading branch information
wp07e committed Jun 13, 2024
1 parent 17c6303 commit 06ec2da
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ private void addContent() {
tooltip = new Tooltip(CountryUtil.getNamesByCodesString(acceptedCountryCodes));
}
}
Label acceptedCountries = addConfirmationLabelLabel(gridPane, ++rowIndex,
Label acceptedCountries = addConfirmationLabelLabel(gridPane, true, ++rowIndex,
Res.get("shared.acceptedTakerCountries"), countries).second;
if (tooltip != null) {
acceptedCountries.setMouseTransparent(false);
Expand Down
30 changes: 28 additions & 2 deletions desktop/src/main/java/haveno/desktop/util/FormBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -379,15 +379,30 @@ public static Tuple2<TextField, Button> addTextFieldWithEditButton(GridPane grid
///////////////////////////////////////////////////////////////////////////////////////////
// Confirmation Fields
///////////////////////////////////////////////////////////////////////////////////////////
public static Tuple2<Label, Label> addConfirmationLabelLabel(GridPane gridPane,
int rowIndex,
String title1,
String title2,
double top) {
return addConfirmationLabelLabel(gridPane, false, rowIndex, title1, title2, top);
}
public static Tuple2<Label, Label> addConfirmationLabelLabel(GridPane gridPane,
int rowIndex,
String title1,
String title2) {
return addConfirmationLabelLabel(gridPane, false, rowIndex, title1, title2, 0);
}

public static Tuple2<Label, Label> addConfirmationLabelLabel(GridPane gridPane,
boolean isWrapped,
int rowIndex,
String title1,
String title2) {
return addConfirmationLabelLabel(gridPane, rowIndex, title1, title2, 0);
return addConfirmationLabelLabel(gridPane, isWrapped, rowIndex, title1, title2, 0);
}

public static Tuple2<Label, Label> addConfirmationLabelLabel(GridPane gridPane,
boolean isWrapped,
int rowIndex,
String title1,
String title2,
Expand All @@ -396,6 +411,7 @@ public static Tuple2<Label, Label> addConfirmationLabelLabel(GridPane gridPane,
label1.getStyleClass().add("confirmation-label");
Label label2 = addLabel(gridPane, rowIndex, title2);
label2.getStyleClass().add("confirmation-value");
label2.setWrapText(isWrapped);
GridPane.setColumnIndex(label2, 1);
GridPane.setMargin(label1, new Insets(top, 0, 0, 0));
GridPane.setHalignment(label1, HPos.LEFT);
Expand Down Expand Up @@ -451,12 +467,21 @@ public static Tuple2<Label, TextArea> addConfirmationLabelTextArea(GridPane grid
String title1,
String title2,
double top) {
return addConfirmationLabelTextArea(gridPane, false, rowIndex, title1, title2, top);
}

public static Tuple2<Label, TextArea> addConfirmationLabelTextArea(GridPane gridPane,
boolean isWrapped,
int rowIndex,
String title1,
String title2,
double top) {
Label label = addLabel(gridPane, rowIndex, title1);
label.getStyleClass().add("confirmation-label");

TextArea textArea = addTextArea(gridPane, rowIndex, title2);
((JFXTextArea) textArea).setLabelFloat(false);

textArea.setWrapText(isWrapped);
GridPane.setColumnIndex(textArea, 1);
GridPane.setMargin(label, new Insets(top, 0, 0, 0));
GridPane.setHalignment(label, HPos.LEFT);
Expand All @@ -466,6 +491,7 @@ public static Tuple2<Label, TextArea> addConfirmationLabelTextArea(GridPane grid
}



///////////////////////////////////////////////////////////////////////////////////////////
// Label + TextFieldWithIcon
///////////////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 06ec2da

Please sign in to comment.