RFR: JDK-8305248: TableView not rendered correctly after column is made visible if fixed cell size is set

Andy Goryachev angorya at openjdk.org
Thu Mar 30 21:10:35 UTC 2023


On Thu, 30 Mar 2023 19:58:31 GMT, Marius Hanl <mhanl at openjdk.org> wrote:

> The determined `prefWidth` of a `TableCell` could be `0.0` when a `fixedCellSize` is set.
> This happened because the `TableCell` may not have a skin since it was never added to the scene graph yet.
> 
> The fix is to make sure we get the `prefWidth` after the `TableCell` was added to the scene graph.
> That is also the reason why the problem only happened the first time and never again after (skin is then already created).

thank you for a quick turnaround!
tested with the MonkeyTester with and without fixed cell height, different models, different resize policies.

https://github.com/andy-goryachev-oracle/Test/blob/main/src/goryachev/monkey/MonkeyTesterApp.java

if you want to make one change (assuming if it's safe to do so), i'll re-approve.

modules/javafx.controls/src/main/java/javafx/scene/control/skin/TableRowSkinBase.java line 358:

> 356:                 // Note: We have to determine the pref width here because the add operation above may trigger the skin
> 357:                 // creation first, which is what makes it possible to get a correct value here in the first place.
> 358:                 width = tableCell.prefWidth(height);

I wonder if it's safe to move this call (one one after else:430) before the if statement on line 352?

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

Marked as reviewed by angorya (Committer).

PR Review: https://git.openjdk.org/jfx/pull/1077#pullrequestreview-1365923242
PR Review Comment: https://git.openjdk.org/jfx/pull/1077#discussion_r1153783393


More information about the openjfx-dev mailing list