On Tue, 27 May 2025 16:09:52 GMT, Ziad El Midaoui <zelmida...@openjdk.org> 
wrote:

>> When the Root TreeItem is set to null, need to relayout to show the children 
>> items
>
> 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();
         });

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

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

Reply via email to