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

Mouse click on TreeView open triangle causes unnecessary selection

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • jfx11, jfx20, 8, jfx17, jfx18, jfx19, jfx21, jfx22, jfx23
    • javafx
    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      This is directly related to JDK-8293018. The problem is caused by the unnecessary selection triggered by using the mouse to expand an item with a lower row number (visually higher) than the current selection. The problem ONLY occurs if the node being expanded has its children populated AFTER the mouse click (see https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/TreeItem.html).

      As far as I am aware this bug has existed on all platforms for all versions.

      I do not believe that the constraint

      assertEquals(isLeaf(), leafProperty().get())

      is the issue here, the problem is that expanding the tree item should not trigger a selection at all.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Use the same code listed in JDK-8293018. Select a mid-tree node, then click any 'open triangle' control above the selection.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The current selection should not change.
      ACTUAL -
      The current selection changes.

      There also appears to be an internal crash as a blue outline replaces the previously selected tree item.

      ---------- BEGIN SOURCE ----------
      See JDK-8293018.
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      My hack involves turning off the current selection when the 'open triangle' row is lower than the currently selected row (but before adding new nodes), and then executing:
         
            Platform.runLater ( () -> model.select (previouslySelectedItem));

      after the nodes have been added.

      FREQUENCY : always


            adev Anupam Dev
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: