RFR: 8341281: Root TreeItem with null value breaks TreeTableView [v4]

Ziad El Midaoui zelmidaoui at openjdk.org
Tue Jun 3 11:08:01 UTC 2025


On Mon, 2 Jun 2025 15:38:04 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:

>> Ziad El Midaoui has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Minor change : new line added
>
> modules/javafx.controls/src/main/java/javafx/scene/control/skin/TreeTableViewSkin.java line 343:
> 
>> 341:             requestRebuildCells();
>> 342:         }
>> 343: 
> 
> This method updateItemCount() is invoked for multiple scenarios.
> Like for a scenario when a TreeItem is added or removed to root item. In this scenario, the issue does not occur as the root item is not changed and so it is not required to rebuild the cells.
> 
> The reported issue occurs only when the root item itself is changed.
> So, I think the fix should be added to a listener to root item. i.e. `lh.addChangeListener(control.rootProperty(), true, (src, prev, root) -> {`
> 
> 
> --- a/modules/javafx.controls/src/main/java/javafx/scene/control/skin/TreeTableViewSkin.java
> +++ b/modules/javafx.controls/src/main/java/javafx/scene/control/skin/TreeTableViewSkin.java
> @@ -164,6 +164,10 @@ public class TreeTableViewSkin<T> extends TableViewSkinBase<T, TreeItem<T>, Tree
>              }
>              // fix for JDK-8094887
>              control.edit(-1, null);
> +
> +            if (root == null || root.getValue() == null) {
> +                requestRebuildCells();
> +            }
>              updateItemCount();
>          });

Yes, It is actually more appropriate to put it there, I will push the new changes
Thank you for your suggestion.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1767#discussion_r2123471614


More information about the openjfx-dev mailing list