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

TreeTableView in SelectionMode.MULTIPLE moves selection on invisible item expand

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      The selection in a TreeTableView gets shifted if a treeitem, which is currently not visible (because its parent is collapsed) is expanded by calling treeitem.setExpanded(true).
      The desired behavior would be that the selection remains untouched when an invisible item gets expanded.
      I'm not sure but the problem might be in the anonymous class of field TreeTableView#TreeTableViewArrayListSelectionModel.treeItemListener, in method handle().
      There, in the case "if (e.wasExpanded()) {", there is a check missing if the treeItem is actually visible.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Take a TreeTableView, add 3 simple items and another with 2-levels of children:
      - item1
      - item2
      - item3
      - groupItem1
        - groupItem2
          - child
      Collapse all groups to make groupItem2 invisible. Select item1. Then call groupItem2.setExpanded(true).

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The selection should remain untouched
      ACTUAL -
      The selection moves from item1 to item3.

      CUSTOMER SUBMITTED WORKAROUND :
      Don't call setExpanded(true) on invisible items or first expand all parents before expanding children.

      FREQUENCY : always


            angorya Andy Goryachev
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: