RFR: 8092102: Labeled: truncated property

Kevin Rushforth kcr at openjdk.org
Tue Mar 5 16:27:57 UTC 2024


On Mon, 4 Mar 2024 21:04:28 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

> Adds Labeled.truncated property which indicates when the text is visually truncated (and the ellipsis string is inserted) in order to fit the available width.
> 
> The new property reacts to changes in the following properties:
> - ellipsisString
> - font
> - text
> - width
> - wrapText
> 
> For some reason, line 859 generates a javadoc "co comment" warning, despite the javadoc comment present at the property declaration in line 832.
> 
> I don't think it's worth creating a headful test (headless won't work) due to relative simplicity of the code.
> 
> **Alternative**
> 
> The desired functionality can be just as easily achieved on an application level, by adding a similar property to a subclass.  What is the benefit of adding this functionality to the core?

Presuming we go forward with this, I left a couple comments on the API.

modules/javafx.controls/src/main/java/javafx/scene/control/Labeled.java line 834:

> 832:     private ObservableBooleanValue truncated;
> 833: 
> 834:     public final ObservableBooleanValue truncatedProperty() {

The return type should be `ReadOnlyBooleanProperty`. That almost certainly explains the other problem you are seeing, since javadoc does not recognize this as a boolean property.

modules/javafx.controls/src/main/java/javafx/scene/control/Labeled.java line 859:

> 857:     }
> 858:     // FIX why does this method emit "warning: no comment" javadoc warning?
> 859:     public final boolean isTruncated() {

See above.

-------------

PR Review: https://git.openjdk.org/jfx/pull/1389#pullrequestreview-1915597929
PR Review Comment: https://git.openjdk.org/jfx/pull/1389#discussion_r1511958192
PR Review Comment: https://git.openjdk.org/jfx/pull/1389#discussion_r1511958471


More information about the openjfx-dev mailing list