Package docking.dnd

Class DragDropNode

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode

    public abstract class DragDropNode
    extends javax.swing.tree.DefaultMutableTreeNode
    Defines a node that is in the DragDropTree.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String name  
      protected javax.swing.tree.TreePath treePath  
      • Fields inherited from class javax.swing.tree.DefaultMutableTreeNode

        allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
    • Constructor Summary

      Constructors 
      Constructor Description
      DragDropNode​(java.lang.String name)
      Constructs a new DragDropNode with the given name.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract javax.swing.Icon getIcon​(boolean expanded, boolean leaf)
      Get the appropriate icon for this node's state; called by the tree cell renderer.
      java.lang.String getName()
      Get the name of this node.
      java.lang.String getToolTipText()
      Get the tool tip for this node.
      javax.swing.tree.TreePath getTreePath()
      Get the tree path for this node.
      abstract boolean isDropAllowed​(DragDropNode dropNode, int dropAction)
      Return true if this node can be a drop target.
      void setName​(java.lang.String name)
      Set the name for this node.
      • Methods inherited from class javax.swing.tree.DefaultMutableTreeNode

        add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
      • Methods inherited from class java.lang.Object

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

      • treePath

        protected javax.swing.tree.TreePath treePath
      • name

        protected java.lang.String name
    • Constructor Detail

      • DragDropNode

        public DragDropNode​(java.lang.String name)
        Constructs a new DragDropNode with the given name.
        Parameters:
        name - the name to associate with this node.
    • Method Detail

      • getIcon

        public abstract javax.swing.Icon getIcon​(boolean expanded,
                                                 boolean leaf)
        Get the appropriate icon for this node's state; called by the tree cell renderer.
        Parameters:
        expanded - true if the node is expanded
        leaf - true if the node is a leaf node
      • isDropAllowed

        public abstract boolean isDropAllowed​(DragDropNode dropNode,
                                              int dropAction)
        Return true if this node can be a drop target.
        Parameters:
        dropNode - node being dragged and dropped; could be null if the drag was initiated outside of the tree
        dropAction - DnDConstants value for copy or move
      • getToolTipText

        public java.lang.String getToolTipText()
        Get the tool tip for this node.
      • getTreePath

        public javax.swing.tree.TreePath getTreePath()
        Get the tree path for this node.
        Returns:
        TreePath
      • setName

        public void setName​(java.lang.String name)
        Set the name for this node.
        Parameters:
        name - the name to set on this node.
      • getName

        public java.lang.String getName()
        Get the name of this node.