com.jstatcom.model.control
Class SymbolTableTreeNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by com.jstatcom.model.control.SymbolTableTreeNode
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode

public final class SymbolTableTreeNode
extends javax.swing.tree.DefaultMutableTreeNode

Treenode to be used with SymbolTree for displaying SymbolTable objects a JTree.

Author:
Markus Kraetzig
See Also:
Serialized Form

Field Summary
 SymbolTable symbolTable
          SymbolTable represented by this tree node.
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
EMPTY_ENUMERATION
 
Constructor Summary
SymbolTableTreeNode(SymbolTable symbolTable, javax.swing.tree.DefaultTreeModel symbolTreeModel)
          Creates a tree node for a symbol.
 
Method Summary
 void addSymbol(Symbol symbol)
          Adds a symbol to this node.
 void clear()
          Removes all children that are SymbolTreeNode instances from this node.
 void removeSymbol(java.lang.String name)
          Removes a symbol node with name from this table 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, 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, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

symbolTable

public final SymbolTable symbolTable
SymbolTable represented by this tree node.

Constructor Detail

SymbolTableTreeNode

public SymbolTableTreeNode(SymbolTable symbolTable,
                           javax.swing.tree.DefaultTreeModel symbolTreeModel)
Creates a tree node for a symbol.

Parameters:
symbolTable - the respective table
symbolTreeModel - the used tree model
Throws:
java.lang.IllegalArgumentException - if (symbolTable == null)
Method Detail

addSymbol

public void addSymbol(Symbol symbol)
Adds a symbol to this node. It keeps the alphabetic order of the nodes. Symbols are always added after symbol tables.

Parameters:
symbol - to be put in tree

removeSymbol

public void removeSymbol(java.lang.String name)
Removes a symbol node with name from this table node.

Parameters:
name - the identifier of the symbol to remove

clear

public void clear()
Removes all children that are SymbolTreeNode instances from this node. It removes itself from the parent node if (getChildCount() == 0) afterwards. It might still be that SymbolTableTreeNode instances are contained in this node.