-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
8, 9, 10
-
Windows 10, macOS 10.13
64-bit
A TreeView control using SelectionMode.MULTIPLE has many issues.
- The SelectedItems list does not get Remove change notifications in many cases.
- IndexOutOfBoundsException is thrown while changing the selection in some cases
- Clicking the collapse/expand widget changes the selection some cases
Source code for test app attached.
To reproduce:
Under /Root/1 Item1/2 Item 1/3 Item 1
- select "4 Item1"
- multi-select (ctrl- or command- click so '4 Item 1' remains selected) "4 Item 2"
- single-select "4 Item 4"
This results in an IndexOutOfBoundException.
However if you select the first two items in the opposite order "4 Item 2" + "4 Item 1", then single-select "4 Item 4", no exception is thrown. However you will notice that the SelectedItems list does not get Remove notifications for the previously selected items.
In fact the only time a Remove change is fired on teh SelectedItems list is when explicitly ctrl-clicking on a selected item to deselect it. Whenever items are implicitly de-selected due to a new single-selection, there is never an indication that they are removed from the selected items list.
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. E.g. in the test app select "1 Item 1" under Root, and "4 Item 3" under Root/1 Item 1/2 Item 1/3 Item 1. Then toggle the collapse widget for "3 Item 1" and see that "1 Item 1" remains selected and "3 Item 1" does not get selected.
- The SelectedItems list does not get Remove change notifications in many cases.
- IndexOutOfBoundsException is thrown while changing the selection in some cases
- Clicking the collapse/expand widget changes the selection some cases
Source code for test app attached.
To reproduce:
Under /Root/1 Item1/2 Item 1/3 Item 1
- select "4 Item1"
- multi-select (ctrl- or command- click so '4 Item 1' remains selected) "4 Item 2"
- single-select "4 Item 4"
This results in an IndexOutOfBoundException.
However if you select the first two items in the opposite order "4 Item 2" + "4 Item 1", then single-select "4 Item 4", no exception is thrown. However you will notice that the SelectedItems list does not get Remove notifications for the previously selected items.
In fact the only time a Remove change is fired on teh SelectedItems list is when explicitly ctrl-clicking on a selected item to deselect it. Whenever items are implicitly de-selected due to a new single-selection, there is never an indication that they are removed from the selected items list.
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. E.g. in the test app select "1 Item 1" under Root, and "4 Item 3" under Root/1 Item 1/2 Item 1/3 Item 1. Then toggle the collapse widget for "3 Item 1" and see that "1 Item 1" remains selected and "3 Item 1" does not get selected.
- relates to
-
JDK-8088686 Tree selection: incorrect change notification of selectedItems
- Open
-
JDK-8152396 ArrayIndexOutOfBoundsException when listening to selection changes on TreeTableView
- Resolved
-
JDK-8189354 Change.getRemoved() list contains incorrect selected items when a TreeItem is collapsed
- Resolved
-
JDK-8266539 [TreeView]: Change.getRemoved() contains null item when deselecting a TreeItem
- Resolved
-
JDK-8189354 Change.getRemoved() list contains incorrect selected items when a TreeItem is collapsed
- Resolved