RFR: 8092102: Labeled: textTruncated property [v15]

Karthik P K kpk at openjdk.org
Tue May 7 15:00:03 UTC 2024


On Mon, 6 May 2024 15:23:20 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> Adds **Labeled.textTruncated** 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 is being set by the code which computes the actual text string to be displayed (and which inserts the ellipsis string) in `LabeledSkinBase.updateDisplayedText(double,double)`.
>> 
>> 
>> **Alternative**
>> 
>> None exists as this requires changes to the core (Utils).
>> 
>> 
>> **See Also**
>> 
>> * [JDK-8327483](https://bugs.openjdk.org/browse/JDK-8327483) TreeView: Allow for tooltip when cell text is truncated
>> * [JDK-8205211](https://bugs.openjdk.org/browse/JDK-8205211) Ability to show Tooltip only when text is shown with ellipsis (...)
>
> Andy Goryachev has updated the pull request incrementally with one additional commit since the last revision:
> 
>   comments

Looks good to me overall. Added a minor comment inline.

modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/skin/Utils.java line 218:

> 216:      * Computes the actual text to be shown in the Labeled with the text wrapping disabled:
> 217:      * unmodified if it fits into available area,
> 218:      * or with the ellipsis string inserted into strategic place(s) if it does not.

ellipsis string can be referenced similar to textTruncated?

modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/skin/Utils.java line 446:

> 444:      * Computes the actual text to be shown in the Labeled with the text wrapping enabled:
> 445:      * unmodified if it fits into available area,
> 446:      * or with the ellipsis string inserted into strategic place(s) if it does not.

Similar to previous comment. ellipsis string can be referenced similar to textTruncated?

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

PR Review: https://git.openjdk.org/jfx/pull/1389#pullrequestreview-2043344480
PR Review Comment: https://git.openjdk.org/jfx/pull/1389#discussion_r1592565769
PR Review Comment: https://git.openjdk.org/jfx/pull/1389#discussion_r1592566139


More information about the openjfx-dev mailing list