Allow word wrapping on "Accepted taker countries" field #989
Some checks are pending
CI / build (macos-13) (push) Waiting to run
CI / build (ubuntu-latest) (push) Waiting to run
CI / build (windows-latest) (push) Waiting to run
Codacy Coverage Reporter / Publish coverage (push) Waiting to run
CodeQL / Analyze (java) (push) Waiting to run

This commit is contained in:
PW 2024-06-24 07:24:52 -04:00 committed by GitHub
parent 3cac6d7c69
commit 7ebc1bfc11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 34 additions and 4 deletions

View file

@ -301,7 +301,7 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
tooltip = new Tooltip(CountryUtil.getNamesByCodesString(acceptedCountryCodes)); tooltip = new Tooltip(CountryUtil.getNamesByCodesString(acceptedCountryCodes));
} }
} }
Label acceptedCountries = addConfirmationLabelLabel(gridPane, ++rowIndex, Label acceptedCountries = addConfirmationLabelLabel(gridPane, true, ++rowIndex,
Res.get("shared.acceptedTakerCountries"), countries).second; Res.get("shared.acceptedTakerCountries"), countries).second;
if (tooltip != null) { if (tooltip != null) {
acceptedCountries.setMouseTransparent(false); acceptedCountries.setMouseTransparent(false);

View file

@ -57,6 +57,7 @@ import haveno.desktop.components.TxIdTextField;
import javafx.geometry.HPos; import javafx.geometry.HPos;
import javafx.geometry.Insets; import javafx.geometry.Insets;
import javafx.geometry.Pos; import javafx.geometry.Pos;
import javafx.geometry.VPos;
import javafx.scene.Node; import javafx.scene.Node;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.CheckBox; import javafx.scene.control.CheckBox;
@ -379,15 +380,30 @@ public class FormBuilder {
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Confirmation Fields // 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, public static Tuple2<Label, Label> addConfirmationLabelLabel(GridPane gridPane,
int rowIndex, int rowIndex,
String title1, String title1,
String title2) { String title2) {
return addConfirmationLabelLabel(gridPane, rowIndex, title1, title2, 0); return addConfirmationLabelLabel(gridPane, false, rowIndex, title1, title2, 0);
} }
public static Tuple2<Label, Label> addConfirmationLabelLabel(GridPane gridPane, public static Tuple2<Label, Label> addConfirmationLabelLabel(GridPane gridPane,
boolean isWrapped,
int rowIndex,
String title1,
String title2) {
return addConfirmationLabelLabel(gridPane, isWrapped, rowIndex, title1, title2, 0);
}
public static Tuple2<Label, Label> addConfirmationLabelLabel(GridPane gridPane,
boolean isWrapped,
int rowIndex, int rowIndex,
String title1, String title1,
String title2, String title2,
@ -396,10 +412,14 @@ public class FormBuilder {
label1.getStyleClass().add("confirmation-label"); label1.getStyleClass().add("confirmation-label");
Label label2 = addLabel(gridPane, rowIndex, title2); Label label2 = addLabel(gridPane, rowIndex, title2);
label2.getStyleClass().add("confirmation-value"); label2.getStyleClass().add("confirmation-value");
label2.setWrapText(isWrapped);
GridPane.setColumnIndex(label2, 1); GridPane.setColumnIndex(label2, 1);
GridPane.setMargin(label1, new Insets(top, 0, 0, 0)); GridPane.setMargin(label1, new Insets(top, 0, 0, 0));
GridPane.setHalignment(label1, HPos.LEFT); GridPane.setHalignment(label1, HPos.LEFT);
GridPane.setValignment(label1, VPos.TOP);
GridPane.setMargin(label2, new Insets(top, 0, 0, 0)); GridPane.setMargin(label2, new Insets(top, 0, 0, 0));
GridPane.setHalignment(label2, HPos.LEFT);
GridPane.setValignment(label2, VPos.TOP);
return new Tuple2<>(label1, label2); return new Tuple2<>(label1, label2);
} }
@ -451,12 +471,21 @@ public class FormBuilder {
String title1, String title1,
String title2, String title2,
double top) { 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 label = addLabel(gridPane, rowIndex, title1);
label.getStyleClass().add("confirmation-label"); label.getStyleClass().add("confirmation-label");
TextArea textArea = addTextArea(gridPane, rowIndex, title2); TextArea textArea = addTextArea(gridPane, rowIndex, title2);
((JFXTextArea) textArea).setLabelFloat(false); ((JFXTextArea) textArea).setLabelFloat(false);
textArea.setWrapText(isWrapped);
GridPane.setColumnIndex(textArea, 1); GridPane.setColumnIndex(textArea, 1);
GridPane.setMargin(label, new Insets(top, 0, 0, 0)); GridPane.setMargin(label, new Insets(top, 0, 0, 0));
GridPane.setHalignment(label, HPos.LEFT); GridPane.setHalignment(label, HPos.LEFT);
@ -466,6 +495,7 @@ public class FormBuilder {
} }
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// Label + TextFieldWithIcon // Label + TextFieldWithIcon
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////