diff --git a/webfx-kit/webfx-kit-javafxcontrols-emul/src/main/java/javafx/scene/control/TextArea.java b/webfx-kit/webfx-kit-javafxcontrols-emul/src/main/java/javafx/scene/control/TextArea.java index 52a9f4546..4d46a4a00 100644 --- a/webfx-kit/webfx-kit-javafxcontrols-emul/src/main/java/javafx/scene/control/TextArea.java +++ b/webfx-kit/webfx-kit-javafxcontrols-emul/src/main/java/javafx/scene/control/TextArea.java @@ -1,6 +1,8 @@ package javafx.scene.control; import dev.webfx.kit.registry.javafxcontrols.JavaFxControlsRegistry; +import javafx.beans.property.BooleanProperty; +import javafx.beans.property.SimpleBooleanProperty; /** * @author Bruno Salmon @@ -26,6 +28,13 @@ public TextArea(String text) { setText(text); } + private final BooleanProperty wrapTextProperty = new SimpleBooleanProperty(false); + + public final BooleanProperty wrapTextProperty() { return wrapTextProperty; } + public final boolean isWrapText() { return wrapTextProperty.getValue(); } + public final void setWrapText(boolean value) { wrapTextProperty.setValue(value); } + + static { JavaFxControlsRegistry.registerTextArea(); } diff --git a/webfx-kit/webfx-kit-javafxcontrols-peers-base/src/main/java/dev/webfx/kit/mapper/peers/javafxcontrols/base/TextAreaPeerBase.java b/webfx-kit/webfx-kit-javafxcontrols-peers-base/src/main/java/dev/webfx/kit/mapper/peers/javafxcontrols/base/TextAreaPeerBase.java index 92a2fb53d..9ed10fb10 100644 --- a/webfx-kit/webfx-kit-javafxcontrols-peers-base/src/main/java/dev/webfx/kit/mapper/peers/javafxcontrols/base/TextAreaPeerBase.java +++ b/webfx-kit/webfx-kit-javafxcontrols-peers-base/src/main/java/dev/webfx/kit/mapper/peers/javafxcontrols/base/TextAreaPeerBase.java @@ -1,5 +1,7 @@ package dev.webfx.kit.mapper.peers.javafxcontrols.base; +import dev.webfx.kit.mapper.peers.javafxgraphics.SceneRequester; +import javafx.beans.value.ObservableValue; import javafx.scene.control.TextArea; /** @@ -10,4 +12,20 @@ public class TextAreaPeerBase extends TextInputControlPeerBase { + @Override + public void bind(N buttonBase, SceneRequester sceneRequester) { + super.bind(buttonBase, sceneRequester); + requestUpdateOnPropertiesChange(sceneRequester + , node.wrapTextProperty() + ); + } + + @Override + public boolean updateProperty(ObservableValue changedProperty) { + return super.updateProperty(changedProperty) + || updateProperty(node.wrapTextProperty(), changedProperty, mixin::updateWrapText) + ; + } + + } diff --git a/webfx-kit/webfx-kit-javafxcontrols-peers-base/src/main/java/dev/webfx/kit/mapper/peers/javafxcontrols/base/TextAreaPeerMixin.java b/webfx-kit/webfx-kit-javafxcontrols-peers-base/src/main/java/dev/webfx/kit/mapper/peers/javafxcontrols/base/TextAreaPeerMixin.java index 4d249bf26..307c76210 100644 --- a/webfx-kit/webfx-kit-javafxcontrols-peers-base/src/main/java/dev/webfx/kit/mapper/peers/javafxcontrols/base/TextAreaPeerMixin.java +++ b/webfx-kit/webfx-kit-javafxcontrols-peers-base/src/main/java/dev/webfx/kit/mapper/peers/javafxcontrols/base/TextAreaPeerMixin.java @@ -9,4 +9,6 @@ public interface TextAreaPeerMixin , NM extends TextAreaPeerMixin> extends TextInputControlPeerMixin { + + void updateWrapText(boolean wrapText); } diff --git a/webfx-kit/webfx-kit-javafxcontrols-peers-gwt-j2cl/src/main/java/dev/webfx/kit/mapper/peers/javafxcontrols/gwtj2cl/html/HtmlTextAreaPeer.java b/webfx-kit/webfx-kit-javafxcontrols-peers-gwt-j2cl/src/main/java/dev/webfx/kit/mapper/peers/javafxcontrols/gwtj2cl/html/HtmlTextAreaPeer.java index 5b460806a..2676ebd43 100644 --- a/webfx-kit/webfx-kit-javafxcontrols-peers-gwt-j2cl/src/main/java/dev/webfx/kit/mapper/peers/javafxcontrols/gwtj2cl/html/HtmlTextAreaPeer.java +++ b/webfx-kit/webfx-kit-javafxcontrols-peers-gwt-j2cl/src/main/java/dev/webfx/kit/mapper/peers/javafxcontrols/gwtj2cl/html/HtmlTextAreaPeer.java @@ -20,4 +20,8 @@ public HtmlTextAreaPeer() { getElement().style.resize = "none"; // To disable the html text area resize feature } + @Override + public void updateWrapText(boolean wrapText) { + setElementStyleAttribute("word-break", wrapText ? "break-word" : "normal"); + } }