org.formaria.swing.treetable
Class TreeTableModelNode.Node

java.lang.Object
  extended by org.formaria.swing.treetable.TreeTableModelNode.Node
Enclosing class:
TreeTableModelNode

public class TreeTableModelNode.Node
extends java.lang.Object

A Node is a derivative of the File class - though we delegate to the File object rather than subclassing it. It is used to maintain a cache of a directory's children and therefore avoid repeated access to the underlying file system during rendering.


Field Summary
protected  TreeTableModelNode.Node[] children
          Children of the receiver.
protected  int level
          Path of the receiver.
protected  DataModel model
          java.io.File the receiver represents.
 
Constructor Summary
protected TreeTableModelNode.Node(DataModel file, int thisLevel)
           
protected TreeTableModelNode.Node(TreeTableModelNode.Node parent, DataModel model, int thisLevel)
           
 
Method Summary
protected  TreeTableModelNode.Node[] createChildren()
          Loads the children of of the receiver.
protected  TreeTableModelNode.Node[] getChildren()
          Loads the children, caching the results in the children instance variable.
 DataModel getModel()
          Returns the java.io.File the receiver represents.
 TreeTableModelNode.Node getParent()
          Returns the parent of the receiver.
 TreeTableModelNode.Node[] getPath()
          Gets the path from the root to the receiver.
protected  TreeTableModelNode.Node[] getPathToRoot(TreeTableModelNode.Node aNode, int depth)
           
 boolean isLeaf()
          Returns true if the receiver represents a leaf, that is it is isn't a directory.
protected  void loadChildren()
          Recursively loads all the children of the receiver.
protected  void nodeChanged()
          Can be invoked when a node has changed, will create the appropriate event.
protected  void setChildren(TreeTableModelNode.Node[] newChildren, boolean generateEvent)
          Sets the children of the receiver, updates the total size, and if generateEvent is true a tree structure changed event is created.
 java.lang.String toString()
          Returns the the string to be used to display this leaf in the JTree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

model

protected DataModel model
java.io.File the receiver represents.


children

protected TreeTableModelNode.Node[] children
Children of the receiver.


level

protected int level
Path of the receiver.

Constructor Detail

TreeTableModelNode.Node

protected TreeTableModelNode.Node(DataModel file,
                                  int thisLevel)

TreeTableModelNode.Node

protected TreeTableModelNode.Node(TreeTableModelNode.Node parent,
                                  DataModel model,
                                  int thisLevel)
Method Detail

toString

public java.lang.String toString()
Returns the the string to be used to display this leaf in the JTree.

Overrides:
toString in class java.lang.Object

getModel

public DataModel getModel()
Returns the java.io.File the receiver represents.


getParent

public TreeTableModelNode.Node getParent()
Returns the parent of the receiver.


isLeaf

public boolean isLeaf()
Returns true if the receiver represents a leaf, that is it is isn't a directory.


getChildren

protected TreeTableModelNode.Node[] getChildren()
Loads the children, caching the results in the children instance variable.


loadChildren

protected void loadChildren()
Recursively loads all the children of the receiver.


createChildren

protected TreeTableModelNode.Node[] createChildren()
Loads the children of of the receiver.


getPath

public TreeTableModelNode.Node[] getPath()
Gets the path from the root to the receiver.


getPathToRoot

protected TreeTableModelNode.Node[] getPathToRoot(TreeTableModelNode.Node aNode,
                                                  int depth)

setChildren

protected void setChildren(TreeTableModelNode.Node[] newChildren,
                           boolean generateEvent)
Sets the children of the receiver, updates the total size, and if generateEvent is true a tree structure changed event is created.


nodeChanged

protected void nodeChanged()
Can be invoked when a node has changed, will create the appropriate event.