proper.database
Class ColumnTreeNode

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

public class ColumnTreeNode
extends javax.swing.tree.DefaultMutableTreeNode

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

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

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
EMPTY_ENUMERATION
 
Constructor Summary
ColumnTreeNode()
          initializes the node with no column
ColumnTreeNode(java.lang.Object o)
          initializes the node with the given column name (= String) or column (= Column)
 
Method Summary
 java.util.Vector getAllColumns()
          returns a vector with all the columns in the subtree, including this node (depth-first)
 java.util.Vector getAllNodes()
          returns all the nodes in the subtree including this node (depth-first)
 Column getChildColumnAt(int index)
          returns the column of the specified child
 Column getColumn()
          returns the Column object of this node
 java.util.Vector getColumnsAlongPath()
          returns all the columns that are along the path to the root
 boolean isInPath(Column c)
          checks whether the given column is somewhere on the path to the root
static ColumnTreeNode parseTreeString(java.lang.String tree)
          parses the given tree in string representation and returns it in a TreeNode Structure, e.g.:
 void setColumn(java.lang.Object o)
          sets the Column, either a name (= String) or an object (= Column)
 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 include)
          returns itself and the subtree underneath in a string representation that can be parsed with the parseTree(String) method
static java.lang.String toTreeString(ColumnTreeNode 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(ColumnTreeNode node, boolean include)
          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

ColumnTreeNode

public ColumnTreeNode()
initializes the node with no column


ColumnTreeNode

public ColumnTreeNode(java.lang.Object o)
initializes the node with the given column name (= String) or column (= Column)

Method Detail

setColumn

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


getColumn

public Column getColumn()
returns the Column object of this node


getChildColumnAt

public Column getChildColumnAt(int index)
returns the column of the specified child


isInPath

public boolean isInPath(Column c)
checks whether the given column is somewhere on the path to the root


getColumnsAlongPath

public java.util.Vector getColumnsAlongPath()
returns all the columns 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)


getAllColumns

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


parseTreeString

public static ColumnTreeNode 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 type, typename (DB-specific) and size in the string (if a specific) ordering is desired, e.g. a(1;CHAR;4)[b(8;DOUBLE;4),c(5;SMALLINT;2)[d(12;VARCHAR;255),e(12;VARCHAR;20)]]

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 include)
returns itself and the subtree underneath in a string representation that can be parsed with the parseTree(String) method

Parameters:
include - whether to include the type, typename, size, too (in parentheses)
See Also:
parseTreeString(String)

toTreeString

public static java.lang.String toTreeString(ColumnTreeNode 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(ColumnTreeNode node,
                                            boolean include)
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
include - whether to include the type, typename, size, 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)