Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8189228

TreeView Multi-Selection does not work properly

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8, 9, 10
    • Fix Version/s: tbd
    • Component/s: javafx
    • Environment:

      Windows 10, macOS 10.13
      64-bit

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                aghaisas Ajit Ghaisas
                Reporter:
                swpalmer Scott Palmer
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: