csli.util.swing.jtree
Class HidableTreeNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by csli.util.swing.jtree.HidableTreeNode
All Implemented Interfaces:
Serializable, Cloneable, MutableTreeNode, TreeNode

public class HidableTreeNode
extends DefaultMutableTreeNode

An extension to the DefaultMutableTreeNode that allows us to control whether or not a node is hidden or not. This does not make nodes complete disapear, but makes them disapear when the tree is being traversed if they are indeed hidden.

Author:
Karl Schultz
See Also:
Serialized Form

Field Summary
protected  boolean m_bIsHidden
          The main extension of DefaultMutableTreeNode is this bIsHidden property, defaults to false (not-hidden).
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
HidableTreeNode()
           
 
Method Summary
 TreeNode getChildAt(int index)
          Overriding this function so we can control whether nodes are hidden or not.
 int getChildCount()
          This allows us to hide children that have m_bIsHidden = true.
 boolean isHidden()
           
 void setHidden(boolean hidden)
           
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildBefore, 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

m_bIsHidden

protected boolean m_bIsHidden
The main extension of DefaultMutableTreeNode is this bIsHidden property, defaults to false (not-hidden).

Constructor Detail

HidableTreeNode

public HidableTreeNode()
Method Detail

isHidden

public boolean isHidden()
Returns:
Returns true if this node is hidden, false if not.

setHidden

public void setHidden(boolean hidden)
Parameters:
hidden - The new value for whether this node is hidden or not.

getChildAt

public TreeNode getChildAt(int index)
Overriding this function so we can control whether nodes are hidden or not.

Specified by:
getChildAt in interface TreeNode
Overrides:
getChildAt in class DefaultMutableTreeNode

getChildCount

public int getChildCount()
This allows us to hide children that have m_bIsHidden = true.

Specified by:
getChildCount in interface TreeNode
Overrides:
getChildCount in class DefaultMutableTreeNode