Class JXTreeTable.TreeTableHacker

  • Direct Known Subclasses:
    JXTreeTable.TreeTableHackerExt
    Enclosing class:
    JXTreeTable

    public class JXTreeTable.TreeTableHacker
    extends java.lang.Object
    Temporary class to have all the hacking at one place. Naturally, it will change a lot. The base class has the "stable" behaviour as of around jun2006 (before starting the fix for 332-swingx).

    specifically:

    1. hitHandleDetection triggeredn in editCellAt
    • Constructor Summary

      Constructors 
      Constructor Description
      TreeTableHacker()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void completeEditing()
      complete editing if collapsed/expanded.
      protected boolean expandOrCollapseNode​(int column, java.util.EventObject e)
      Tricksery to make the tree expand/collapse.
      protected void expansionChanged()
      called from the renderer's setExpandedPath after all expansion-related updates happend.
      void hitHandleDetectionFromEditCell​(int column, java.util.EventObject e)
      Entry point for hit handle detection called from editCellAt, does nothing if isHitDetectionFromProcessMouse is true;
      boolean hitHandleDetectionFromProcessMouse​(java.awt.event.MouseEvent e)
      Entry point for hit handle detection called from processMouse.
      protected boolean isHitDetectionFromProcessMouse()
      Decision whether the handle hit detection should be done in processMouseEvent or editCellAt.
      protected boolean mightBeExpansionTrigger​(java.util.EventObject e)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • expansionChangedFlag

        protected boolean expansionChangedFlag
    • Constructor Detail

      • TreeTableHacker

        public TreeTableHacker()
    • Method Detail

      • isHitDetectionFromProcessMouse

        protected boolean isHitDetectionFromProcessMouse()
        Decision whether the handle hit detection should be done in processMouseEvent or editCellAt. Here: returns false.
        Returns:
        true for handle hit detection in processMouse, false for editCellAt.
      • hitHandleDetectionFromEditCell

        public void hitHandleDetectionFromEditCell​(int column,
                                                   java.util.EventObject e)
        Entry point for hit handle detection called from editCellAt, does nothing if isHitDetectionFromProcessMouse is true;
        See Also:
        isHitDetectionFromProcessMouse()
      • hitHandleDetectionFromProcessMouse

        public boolean hitHandleDetectionFromProcessMouse​(java.awt.event.MouseEvent e)
        Entry point for hit handle detection called from processMouse. Does nothing if isHitDetectionFromProcessMouse is false.
        Returns:
        true if the mouseEvent triggered an expand/collapse in the renderer, false otherwise.
        See Also:
        isHitDetectionFromProcessMouse()
      • completeEditing

        protected void completeEditing()
        complete editing if collapsed/expanded. Here: any editing is always cancelled. This is a rude fix to #120-jdnc: data corruption on collapse/expand if editing. This is called from the renderer after expansion related state has changed. PENDING JW: should it take the old editing path as parameter? Might be possible to be a bit more polite, and internally reset the editing coordinates? On the other hand: the rudeness is the table's usual behaviour - which is often removing the editor as first reaction to incoming events.
      • expandOrCollapseNode

        protected boolean expandOrCollapseNode​(int column,
                                               java.util.EventObject e)
        Tricksery to make the tree expand/collapse.

        This might be - indirectly - called from one of two places:

        1. editCellAt: original, stable but buggy (#332, #222) the table's own selection had been changed due to the click before even entering into editCellAt so all tree selection state is lost.
        2. processMouseEvent: the idea is to catch the mouseEvent, check if it triggered an expanded/collapsed, consume and return if so or pass to super if not.

        widened access for testing ...

        Parameters:
        column - the column index under the event, if any.
        e - the event which might trigger a expand/collapse.
        Returns:
        this methods evaluation as to whether the event triggered a expand/collaps
      • mightBeExpansionTrigger

        protected boolean mightBeExpansionTrigger​(java.util.EventObject e)
      • expansionChanged

        protected void expansionChanged()
        called from the renderer's setExpandedPath after all expansion-related updates happend.