Details
Description
A DESCRIPTION OF THE PROBLEM :
This is directly related to JDK-8293018. The problem is caused by the unnecessary selection triggered by using the mouse to expand an item with a lower row number (visually higher) than the current selection. The problem ONLY occurs if the node being expanded has its children populated AFTER the mouse click (see https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/TreeItem.html).
As far as I am aware this bug has existed on all platforms for all versions.
I do not believe that the constraint
assertEquals(isLeaf(), leafProperty().get())
is the issue here, the problem is that expanding the tree item should not trigger a selection at all.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Use the same code listed in JDK-8293018. Select a mid-tree node, then click any 'open triangle' control above the selection.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The current selection should not change.
ACTUAL -
The current selection changes.
There also appears to be an internal crash as a blue outline replaces the previously selected tree item.
---------- BEGIN SOURCE ----------
See JDK-8293018.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
My hack involves turning off the current selection when the 'open triangle' row is lower than the currently selected row (but before adding new nodes), and then executing:
Platform.runLater ( () -> model.select (previouslySelectedItem));
after the nodes have been added.
FREQUENCY : always
This is directly related to JDK-8293018. The problem is caused by the unnecessary selection triggered by using the mouse to expand an item with a lower row number (visually higher) than the current selection. The problem ONLY occurs if the node being expanded has its children populated AFTER the mouse click (see https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/TreeItem.html).
As far as I am aware this bug has existed on all platforms for all versions.
I do not believe that the constraint
assertEquals(isLeaf(), leafProperty().get())
is the issue here, the problem is that expanding the tree item should not trigger a selection at all.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Use the same code listed in JDK-8293018. Select a mid-tree node, then click any 'open triangle' control above the selection.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The current selection should not change.
ACTUAL -
The current selection changes.
There also appears to be an internal crash as a blue outline replaces the previously selected tree item.
---------- BEGIN SOURCE ----------
See JDK-8293018.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
My hack involves turning off the current selection when the 'open triangle' row is lower than the currently selected row (but before adding new nodes), and then executing:
Platform.runLater ( () -> model.select (previouslySelectedItem));
after the nodes have been added.
FREQUENCY : always
Attachments
Issue Links
- duplicates
-
JDK-8293018 TreeView selects wrong item when folder above is modified and opened
- Open