swingx
  1. swingx
  2. SWINGX-516

treenode/cell not being selected on a single click

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.0
    • Fix Version/s: 1.6
    • Component/s: TreeTable
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      516

      Description

      Hi!

      I found what appears to be a bug in the JXTreeTable component.

      Fro a user view, the result of this bug is a treenode/cell not being selected on
      a single click, it is easy to test this. Click once on a unselected
      cell/treenode in the first column, and it will not be selected. To select it, it
      needs to be clicked twice slowly, or double clicked.

      I've tried to dug up the root cause of this, and it seems to be a combination of
      two things:
      In JXTreeTable.processMouseEvent(MouseEvent e), there's a fix for "Issue
      #332-swing: hacking around selection loss.", which stops the handling of any
      mouse events, if they made the tree expand.
      Digging a bit deeper, this relies on the JXTreeTable.expansionChangedFlag
      variable being set, which is expected to become only true when the tree is
      actually expanded.
      The problem is that this variable is set every time a different row is selected.
      This seems to be triggered from the stacktrace which I've copied to the end of
      this mail.

      I'm guessing a proper fix would be for makeVisible() or expandPath() to only
      expand the path, if it actually is not expanded yet, and thus only updating the
      flag in those cases.

      I found this in the 2007_04_15 build, but cvs shows no fixes regarding it since.

      Cheers!
      Jeroen.

      Thread [AWT-EventQueue-1] (Suspended (breakpoint at line 503 in
      JXTreeTable$TreeTableHacker))
      JXTreeTable$TreeTableHackerExt(JXTreeTable$TreeTableHacker).expansionChanged()
      line: 503
      JXTreeTable$TreeTableCellRenderer.setExpandedState(TreePath, boolean) line: 1959
      JXTreeTable$TreeTableCellRenderer(JTree).expandPath(TreePath) line: 1742
      JXTreeTable$TreeTableCellRenderer(JTree).makeVisible(TreePath) line: 1601
      BasicTreeUI$Handler.valueChanged(TreeSelectionEvent) line: 3591
      JXTreeTable$ListToTreeSelectionModelWrapper(DefaultTreeSelectionModel).fireValueChanged(TreeSelectionEvent)
      line: 629
      JXTreeTable$ListToTreeSelectionModelWrapper(DefaultTreeSelectionModel).notifyPathChange(Vector<PathPlaceHolder>,
      TreePath) line: 1078
      JXTreeTable$ListToTreeSelectionModelWrapper(DefaultTreeSelectionModel).setSelectionPaths(TreePath[])
      line: 287
      JXTreeTable$ListToTreeSelectionModelWrapper(DefaultTreeSelectionModel).setSelectionPath(TreePath)
      line: 170
      JXTreeTable$TreeTableCellRenderer(JTree).setSelectionPath(TreePath) line: 1174
      WindowsTreeUI(BasicTreeUI).selectPathForEvent(TreePath, MouseEvent) line: 2296
      BasicTreeUI$Handler.handleSelectionImpl(MouseEvent, TreePath) line: 3505
      BasicTreeUI$Handler.handleSelection(MouseEvent) line: 3480
      BasicTreeUI$Handler.mousePressed(MouseEvent) line: 3461
      AWTEventMulticaster.mousePressed(MouseEvent) line: 222
      JXTreeTable$TreeTableCellRenderer(Component).processMouseEvent(MouseEvent)
      line: 5485
      JXTreeTable$TreeTableCellRenderer(JComponent).processMouseEvent(MouseEvent)
      line: 3126
      JXTreeTable$TreeTableCellRenderer(Component).processEvent(AWTEvent) line: 5253
      JXTreeTable$TreeTableCellRenderer(Container).processEvent(AWTEvent) line: 1966
      JXTreeTable$TreeTableCellRenderer(Component).dispatchEventImpl(AWTEvent)
      line: 3955
      JXTreeTable$TreeTableCellRenderer(Container).dispatchEventImpl(AWTEvent)
      line: 2024
      JXTreeTable$TreeTableCellRenderer(Component).dispatchEvent(AWTEvent) line: 3803
      JXTreeTable$TreeTableHackerExt(JXTreeTable$TreeTableHacker).expandOrCollapseNode(int,
      EventObject) line: 474
      JXTreeTable$TreeTableHackerExt(JXTreeTable$TreeTableHacker).hitHandleDetectionFromProcessMouse(MouseEvent)
      line: 394
      EstimateFrontendApplet$13(JXTreeTable).processMouseEvent(MouseEvent) line: 313
      EstimateFrontendApplet$13(Component).processEvent(AWTEvent) line: 5253
      EstimateFrontendApplet$13(Container).processEvent(AWTEvent) line: 1966
      EstimateFrontendApplet$13(Component).dispatchEventImpl(AWTEvent) line: 3955
      EstimateFrontendApplet$13(Container).dispatchEventImpl(AWTEvent) line: 2024
      EstimateFrontendApplet$13(Component).dispatchEvent(AWTEvent) line: 3803
      LightweightDispatcher.retargetMouseEvent(Component, int, MouseEvent) line: 4212
      LightweightDispatcher.processMouseEvent(MouseEvent) line: 3889
      LightweightDispatcher.dispatchEvent(AWTEvent) line: 3822
      EstimateFrontendApplet(Container).dispatchEventImpl(AWTEvent) line: 2010
      EstimateFrontendApplet(Component).dispatchEvent(AWTEvent) line: 3803
      EventQueue.dispatchEvent(AWTEvent) line: 463
      EventDispatchThread.pumpOneEventForHierarchy(int, Component) line: 242
      EventDispatchThread.pumpEventsForHierarchy(int, Conditional, Component) line: 163
      EventDispatchThread.pumpEvents(int, Conditional) line: 157
      EventDispatchThread.pumpEvents(Conditional) line: 149
      EventDispatchThread.run() line: 110

      1. JXTreeTable.diff
        2 kB
        eladinformationservices

        Issue Links

          Activity

          Hide
          kleopatra added a comment -

          postponed all selection/renderer related problems - they are all related and
          probably solved once we solve the core issue

          Show
          kleopatra added a comment - postponed all selection/renderer related problems - they are all related and probably solved once we solve the core issue
          Hide
          eladinformationservices added a comment -

          Created an attachment (id=258)
          A workaround for this issue. Only sets the expansionChangedFlag when the expansion actually changes. Also tracks when the expansion is a mouse event, and only sets the expansionChangedFlag when it is a mouse event. Diff file attached.

          Show
          eladinformationservices added a comment - Created an attachment (id=258) A workaround for this issue. Only sets the expansionChangedFlag when the expansion actually changes. Also tracks when the expansion is a mouse event, and only sets the expansionChangedFlag when it is a mouse event. Diff file attached.
          Hide
          kleopatra added a comment -

          looks promising. Would it be possible to provide the patch in unified format so
          itthat can be applied as-is (f.i. in Eclipse)?

          Thanks
          Jeanette

          Show
          kleopatra added a comment - looks promising. Would it be possible to provide the patch in unified format so itthat can be applied as-is (f.i. in Eclipse)? Thanks Jeanette
          Hide
          Karl Schaefer added a comment -
              • Issue 1073 has been marked as a duplicate of this issue. ***
          Show
          Karl Schaefer added a comment - Issue 1073 has been marked as a duplicate of this issue. ***
          Hide
          kleopatra added a comment -

          seems to be gone with fixing Issue 1168 (basically by making the patch provided
          by tibi in Issue 417 bidi-compliant and cleanup the renderer's sizing)

          so closing, being optimistic as always <g> But please let me know how it behaves
          in your context.

          Thanks
          Jeanette

          Show
          kleopatra added a comment - seems to be gone with fixing Issue 1168 (basically by making the patch provided by tibi in Issue 417 bidi-compliant and cleanup the renderer's sizing) so closing, being optimistic as always <g> But please let me know how it behaves in your context. Thanks Jeanette
          Hide
          kleopatra added a comment -


          changed target of fixed for release 1.6

          Show
          kleopatra added a comment - changed target of fixed for release 1.6

            People

            • Assignee:
              kleopatra
              Reporter:
              cranphin
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: