RFR: 8189354: ArrayIndexOutOfBoundsException when listening to selection changes on TreeTableView [v4]
mstr2
github.com+43553916+mstr2 at openjdk.java.net
Tue Apr 27 16:23:38 UTC 2021
On Tue, 27 Apr 2021 14:12:23 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
> I reread the description of [JDK-8189228](https://bugs.openjdk.java.net/browse/JDK-8189228) and it describes multiple problems. Are all of them addressed by this PR?
This PR lists the following issues:
1. The SelectedItems list does not get Remove change notifications in many cases
2. IndexOutOfBoundsException is thrown while changing the selection in some cases
3. If the collapse widget is toggled for the parent item of selected items, that parent item becomes selected. However, if none of the child items were selected, toggling the collapse/expand widget does not change the selection. But, if a parent of the the parent is also selected while child nodes are selected toggling the collapse widget doesn't select the item, and the parent item remains selected.
Regarding 1:
I think this is an artifact of the test program attached to the JBS issue; it is not a bug in JavaFX. The test program uses a `if {...} else if {...} else if {...} ...` branch to query the change, which is not a correct implementation and misses remove notifications that are part of replace notifications.
Regarding 2:
This PR fixes that.
Regarding 3:
The observation is partly correct: if a tree branch that contains selected items is collapsed, _and_ the primary selection is within that branch, then the collapsed branch remains selected. However, if the primary selection is not within the collapsed branch, it does not remain selected.
`TreeView:1390` _specifically_ tests whether the primary selection is within or outside of the collapsed branch. This seems very intentional, so I'm wondering what the expected behavior should be.
However, since this is clearly no unintentional behavior, I would suggest to create a new ticket if the specification should be changed to always keep the collapsed tree branch selected.
-------------
PR: https://git.openjdk.java.net/jfx/pull/480
More information about the openjfx-dev
mailing list