Re: RFR: 8092102: Labeled: truncated property [v2]
On Tue, 5 Mar 2024 14:16:59 GMT, Nir Lisker wrote: >> Andy Goryachev has updated the pull request with a new target base due to a >> merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains three additional >> commits since the last revision: >> >> - review comments >> - Merge remote-tracking branch 'origin/master' into 8092102.truncated >> - 8092102 Labeled: truncated property > > modules/javafx.controls/src/main/java/javafx/scene/control/Labeled.java line > 850: > >> 848: protected boolean computeValue() { >> 849: if (isWrapText()) { >> 850: return false; > > Are you sure that allowing text to wrap necessarily means it won't be > truncated? What if the max height doesn't allow another line? Good point. So the label will have its text truncated (by inserting the ellipsis string) when wrapText is on and the size is constrained by setting maxHeight. Interestingly, it will not truncate the text (again, ellipsis string) if the label is resized by the layout: ![Screenshot 2024-03-05 at 12 54 14](https://github.com/openjdk/jfx/assets/107069028/1ae47317-2d54-4bcd-942d-1a49ff9faeab) Using the latest MonkeyTester to test https://github.com/andy-goryachev-oracle/MonkeyTest uncomment the listener in LabelPage - PR Review Comment: https://git.openjdk.org/jfx/pull/1389#discussion_r1513493586
Re: RFR: 8092102: Labeled: truncated property [v2]
> 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 reacts to changes in the following properties: > - ellipsisString > - font > - height > - text > - width > - wrapText > > 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? > > **See Also** > > * [JDK-8091891](https://bugs.openjdk.org/browse/JDK-8091891) TreeView: There > is no tooltip available on truncated node > * [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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision: - review comments - Merge remote-tracking branch 'origin/master' into 8092102.truncated - 8092102 Labeled: truncated property - Changes: - all: https://git.openjdk.org/jfx/pull/1389/files - new: https://git.openjdk.org/jfx/pull/1389/files/7cbd46c7..8a5cb17e Webrevs: - full: https://webrevs.openjdk.org/?repo=jfx&pr=1389&range=01 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=1389&range=00-01 Stats: 1319 lines in 36 files changed: 1172 ins; 79 del; 68 mod Patch: https://git.openjdk.org/jfx/pull/1389.diff Fetch: git fetch https://git.openjdk.org/jfx.git pull/1389/head:pull/1389 PR: https://git.openjdk.org/jfx/pull/1389