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

TreeTableView's selectedItems reports changes that include null items when when a TreeItem is collapsed.

XMLWordPrintable

      As a TreeTableView item is expanded and collapsed, the change notifications for selectedItems can sometimes contain null items. It looks like the changes are derived from selected indexes which creates change notifications that don't always make sense.

      The below example also includes a case that I find confusing. The notification for childOne being removed from selectedItems doesn't make sense since it was never selected. Another issue related to having more accurate change notifications is https://javafx-jira.kenai.com/browse/RT-37360.

      Steps to reproduce:

      1. Run the below example.
      2. Select item "three".
      3. Expand item "two".
      4. Collapse item "two".

      https://gist.github.com/ryanjaeb/613028767e336a206d7c

      You'll get the following output:

      --- initial selection on program start ---
      Change event...
       Change:
        Added: one
       
      -- caused by selecting item "three"--
      Change event...
       Change:
        Removed: one
        Added: three
       
      -- caused by expanding item "two"--
      Change event...
       Change:
        Removed: childOne
      Change event...
       Change:
        Added: three
       
      -- caused by collapsing item "two"--
      Change event...
       Change:
        Removed: TreeItem was null.
      Change event...
       Change:
        Added: three

            jgiles Jonathan Giles
            rjaebjfx Ryan Jaeb (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: