Class CheckBoxTree.Handler

  • All Implemented Interfaces:
    java.awt.event.KeyListener, java.awt.event.MouseListener, java.util.EventListener, javax.swing.event.TreeSelectionListener
    Enclosing class:
    CheckBoxTree

    protected static class CheckBoxTree.Handler
    extends java.lang.Object
    implements java.awt.event.MouseListener, java.awt.event.KeyListener, javax.swing.event.TreeSelectionListener
    CheckBoxTree's mouse event handler, key event handler and tree selection event handler.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected CheckBoxTree _tree  
    • Constructor Summary

      Constructors 
      Constructor Description
      Handler​(CheckBoxTree tree)
      The constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean clicksInCheckBox​(java.awt.event.MouseEvent e, javax.swing.tree.TreePath path)
      Checks if the mouse event happens for the tree path.
      protected javax.swing.tree.TreePath getTreePathForMouseEvent​(java.awt.event.MouseEvent e)
      Gets the tree path according to the mouse event.
      void keyPressed​(java.awt.event.KeyEvent e)  
      void keyReleased​(java.awt.event.KeyEvent e)  
      void keyTyped​(java.awt.event.KeyEvent e)  
      void mouseClicked​(java.awt.event.MouseEvent e)  
      void mouseEntered​(java.awt.event.MouseEvent e)  
      void mouseExited​(java.awt.event.MouseEvent e)  
      void mousePressed​(java.awt.event.MouseEvent e)  
      void mouseReleased​(java.awt.event.MouseEvent e)  
      protected void toggleSelections()
      Toggles the selected paths' selection state.
      void valueChanged​(javax.swing.event.TreeSelectionEvent e)  
      • Methods inherited from class java.lang.Object

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

      • Handler

        public Handler​(CheckBoxTree tree)
        The constructor.
        Parameters:
        tree - the CheckBoxTree
    • Method Detail

      • getTreePathForMouseEvent

        protected javax.swing.tree.TreePath getTreePathForMouseEvent​(java.awt.event.MouseEvent e)
        Gets the tree path according to the mouse event.
        Parameters:
        e - the mouse event
        Returns:
        the tree path the mouse is over. null if no tree node is under the mouse position.
      • clicksInCheckBox

        protected boolean clicksInCheckBox​(java.awt.event.MouseEvent e,
                                           javax.swing.tree.TreePath path)
        Checks if the mouse event happens for the tree path.
        Parameters:
        e - the mouse event
        path - the tree path
        Returns:
        true if the mouse event need change the state of the tree node. Otherwise false.
      • mouseClicked

        public void mouseClicked​(java.awt.event.MouseEvent e)
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent e)
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
      • mouseReleased

        public void mouseReleased​(java.awt.event.MouseEvent e)
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
      • mouseEntered

        public void mouseEntered​(java.awt.event.MouseEvent e)
        Specified by:
        mouseEntered in interface java.awt.event.MouseListener
      • mouseExited

        public void mouseExited​(java.awt.event.MouseEvent e)
        Specified by:
        mouseExited in interface java.awt.event.MouseListener
      • keyPressed

        public void keyPressed​(java.awt.event.KeyEvent e)
        Specified by:
        keyPressed in interface java.awt.event.KeyListener
      • keyTyped

        public void keyTyped​(java.awt.event.KeyEvent e)
        Specified by:
        keyTyped in interface java.awt.event.KeyListener
      • keyReleased

        public void keyReleased​(java.awt.event.KeyEvent e)
        Specified by:
        keyReleased in interface java.awt.event.KeyListener
      • valueChanged

        public void valueChanged​(javax.swing.event.TreeSelectionEvent e)
        Specified by:
        valueChanged in interface javax.swing.event.TreeSelectionListener
      • toggleSelections

        protected void toggleSelections()
        Toggles the selected paths' selection state.