proper.database
Class TableTreeNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by proper.database.TableTreeNode
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode

public class TableTreeNode
extends javax.swing.tree.DefaultMutableTreeNode

A specialized TreeNode class that handles Table-Objects and provides some methods for conveniencs.

Version:
$Revision: 1.2 $
Author:
FracPete
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
EMPTY_ENUMERATION
 
Constructor Summary
TableTreeNode()
          initializes the node with no table
TableTreeNode(java.lang.Object o)
          initializes the node with the given table name (= String) or table (= Table)
 
Method Summary
 java.util.Vector getAllNodes()
          returns all the nodes in the subtree including this node (depth-first)
 java.util.Vector getAllTables()
          returns a vector with all the tables in the subtree, including this node (depth-first)
 Table getChildTableAt(int index)
          returns the table of the specified child
 Table getTable()
          returns the Table object of this node
 java.util.Vector getTablesAlongPath()
          returns all the tables that are along the path to the root
 boolean isInPath(Table t)
          checks whether the given table is somewhere on the path to the root
static TableTreeNode parseTreeString(java.lang.String tree)
          parses the given tree in string representation and returns it in a TreeNode Structure, e.g.:
 void setTable(java.lang.Object o)
          sets the Table, either a name (= String) or an object (= Table)
 java.lang.String toString()
          returns the name of the table
 java.lang.String toString(boolean all)
          returns either the whole subtree (including itself) as a string representation (= TRUE) or only the table (= FALSE)
 java.lang.String toTreeString()
          returns itself and the subtree underneath in a string representation that can be parsed with the parseTree(String) method
 java.lang.String toTreeString(boolean includeSizes)
          returns itself and the subtree underneath in a string representation that can be parsed with the parseTree(String) method
static java.lang.String toTreeString(TableTreeNode node)
          returns the node and the subtree underneath in a string representation that can be parsed with the parseTree(String) method
static java.lang.String toTreeString(TableTreeNode node, boolean includeSizes)
          returns the node and the subtree underneath in a string representation that can be parsed with the parseTree(String) method
 
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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TableTreeNode

public TableTreeNode()
initializes the node with no table


TableTreeNode

public TableTreeNode(java.lang.Object o)
initializes the node with the given table name (= String) or table (= Table)

Method Detail

setTable

public void setTable(java.lang.Object o)
sets the Table, either a name (= String) or an object (= Table)


getTable

public Table getTable()
returns the Table object of this node


getChildTableAt

public Table getChildTableAt(int index)
returns the table of the specified child


isInPath

public boolean isInPath(Table t)
checks whether the given table is somewhere on the path to the root


getTablesAlongPath

public java.util.Vector getTablesAlongPath()
returns all the tables that are along the path to the root


getAllNodes

public java.util.Vector getAllNodes()
returns all the nodes in the subtree including this node (depth-first)


getAllTables

public java.util.Vector getAllTables()
returns a vector with all the tables in the subtree, including this node (depth-first)


parseTreeString

public static TableTreeNode parseTreeString(java.lang.String tree)
parses the given tree in string representation and returns it in a TreeNode Structure, e.g.:
   a[b,c[d,e]]
 
represents the following tree:
   a
   |-b
   |-c
   | |-d
   | |-e
 
It is also possible to include the sizes in the string (if a specific) ordering is desired, e.g. a(10)[b(2),c(12)[d(3),e(1)]]

See Also:
toTreeString(), toTreeString(boolean)

toTreeString

public java.lang.String toTreeString()
returns itself and the subtree underneath in a string representation that can be parsed with the parseTree(String) method

See Also:
parseTreeString(String)

toTreeString

public java.lang.String toTreeString(boolean includeSizes)
returns itself and the subtree underneath in a string representation that can be parsed with the parseTree(String) method

Parameters:
includeSizes - whether to include the sizes, too (in parentheses)
See Also:
parseTreeString(String)

toTreeString

public static java.lang.String toTreeString(TableTreeNode node)
returns the node and the subtree underneath in a string representation that can be parsed with the parseTree(String) method

Parameters:
node - the node to represent in String notation
See Also:
parseTreeString(String)

toTreeString

public static java.lang.String toTreeString(TableTreeNode node,
                                            boolean includeSizes)
returns the node and the subtree underneath in a string representation that can be parsed with the parseTree(String) method

Parameters:
node - the node to get the string notation from
includeSizes - whether to include the sizes, too (in parentheses)
See Also:
parseTreeString(String)

toString

public java.lang.String toString()
returns the name of the table

Overrides:
toString in class javax.swing.tree.DefaultMutableTreeNode

toString

public java.lang.String toString(boolean all)
returns either the whole subtree (including itself) as a string representation (= TRUE) or only the table (= FALSE)