Copyright © 2005 Scientific Applications. All Rights Reserved.

com.sciapp.treetable.dir
Class DirectoryTreeTableModel

java.lang.Object
  extended by com.sciapp.treetable.AbstractTreeTableModel
      extended by com.sciapp.treetable.MutableTreeTableModel
          extended by com.sciapp.treetable.dir.DirectoryTreeTableModel
All Implemented Interfaces:
CacheableTreeTableModel, ReorderModel, TreeTableModel, Serializable, TreeModel

public class DirectoryTreeTableModel
extends MutableTreeTableModel
implements CacheableTreeTableModel

DirectoryTreeTableModel is the treetable model that can hold a directory structure.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.sciapp.treetable.MutableTreeTableModel
classes, columns
 
Fields inherited from class com.sciapp.treetable.AbstractTreeTableModel
listenerList, root
 
Fields inherited from interface com.sciapp.treetable.TreeTableModel
CHANGE_COLUMN_SOURCE
 
Constructor Summary
DirectoryTreeTableModel()
          Creates a DirectoryTreeTableModel.
DirectoryTreeTableModel(File initialFile)
          Creates a DirectoryTreeTableModel.
DirectoryTreeTableModel(File[] initialFiles)
          Creates a DirectoryTreeTableModel.
 
Method Summary
 int getChildCount(Object parent)
          Returns the number of children of parent. Returns 0 if the node is a leaf or if it has no children. parent must be a node previously obtained from this data source.
 List getUncachedChildren(Object parent, int from, int to)
          Retrieves the leaf rows from the treetable model by specifying a row interval.
 int getUncachedGroupCount(Object node)
          Retrieves the children count for node.
 List getUncachedGroups(Object parent, int from, int to)
          Retrieves the branch rows from the treetable model by specifying a row interval.
 Object getValueAt(Object node, int column)
          Returns the value to be displayed for node, at column index column.
 boolean isCountCached(Object node)
          Determines whether the children count for node has been evaluated.
 boolean isLeaf(Object node)
          Returns true if node is a leaf. It is possible for this method to return false even if node has no children. A directory in a filesystem, for example, may contain no files; the node representing the directory is not a leaf, but it also has no children.
 boolean isRangedModel()
          Determines whether the cache model can fetch data in ranges.
 boolean isValueCached(Object node, int column)
          Determines whether the value for node at index column has been evaluated.
 
Methods inherited from class com.sciapp.treetable.MutableTreeTableModel
addColumn, addColumn, addReorderListener, clear, fireRowsMapped, fireRowsReordered, getChild, getColumnClass, getColumnCount, getColumnName, getIndexOfChild, getPathToRoot, getPathToRoot, insertNodeInto, isCellEditable, moveNode, nodeChanged, nodesChanged, nodeStructureChanged, nodesWereInserted, nodesWereRemoved, removeNodeFromParent, removeReorderListener, setColumnClasses, setColumnNames, setValueAt, valueForPathChanged
 
Methods inherited from class com.sciapp.treetable.AbstractTreeTableModel
addTreeModelListener, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, fireTreeTableStructureChanged, fireTreeTableStructureChanged, getRoot, isAggregate, isFooter, isHeader, removeTreeModelListener, setRoot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sciapp.treetable.TreeTableModel
getColumnClass, getColumnCount, getColumnName, isAggregate, isCellEditable, isFooter, isHeader, setValueAt
 
Methods inherited from interface javax.swing.tree.TreeModel
addTreeModelListener, getChild, getIndexOfChild, getRoot, removeTreeModelListener, valueForPathChanged
 

Constructor Detail

DirectoryTreeTableModel

public DirectoryTreeTableModel()
Creates a DirectoryTreeTableModel.


DirectoryTreeTableModel

public DirectoryTreeTableModel(File[] initialFiles)
Creates a DirectoryTreeTableModel.


DirectoryTreeTableModel

public DirectoryTreeTableModel(File initialFile)
Creates a DirectoryTreeTableModel.

Method Detail

getChildCount

public int getChildCount(Object parent)
Returns the number of children of parent. Returns 0 if the node is a leaf or if it has no children. parent must be a node previously obtained from this data source.

Specified by:
getChildCount in interface TreeModel
Overrides:
getChildCount in class MutableTreeTableModel
Parameters:
parent - a node in the tree, obtained from this data source
Returns:
the number of children of the node parent

getUncachedChildren

public List getUncachedChildren(Object parent,
                                int from,
                                int to)
Retrieves the leaf rows from the treetable model by specifying a row interval. The following condition must be true: from >= to. The List returned must contain the row elements starting at from. However, the List may contain less elements than those specified in the range.

Specified by:
getUncachedChildren in interface CacheableTreeTableModel
Parameters:
parent - the parent node
from - the starting row
to - the ending row
Returns:
a list of objects, each element of which contains a row from the treetable model

getUncachedGroupCount

public int getUncachedGroupCount(Object node)
Retrieves the children count for node.

Specified by:
getUncachedGroupCount in interface CacheableTreeTableModel
Parameters:
node - the node for which the children count we want to retrieve.
Returns:
the node's children count.

getUncachedGroups

public List getUncachedGroups(Object parent,
                              int from,
                              int to)
Retrieves the branch rows from the treetable model by specifying a row interval. The following condition must be true: from >= to. The List returned must contain the row elements starting at from. However, the List may contain less elements than those specified in the range.

Specified by:
getUncachedGroups in interface CacheableTreeTableModel
Parameters:
parent - the parent node
from - the starting row
to - the ending row
Returns:
a list of objects, each element of which contains a row from the treetable model

getValueAt

public Object getValueAt(Object node,
                         int column)
Returns the value to be displayed for node, at column index column.

Specified by:
getValueAt in interface TreeTableModel
Parameters:
node - the node to query
column - the column index
Returns:
the value

isCountCached

public boolean isCountCached(Object node)
Determines whether the children count for node has been evaluated.

Specified by:
isCountCached in interface CacheableTreeTableModel
Returns:
true if the node's children count has already been evaluated.

isLeaf

public boolean isLeaf(Object node)
Returns true if node is a leaf. It is possible for this method to return false even if node has no children. A directory in a filesystem, for example, may contain no files; the node representing the directory is not a leaf, but it also has no children.

Specified by:
isLeaf in interface TreeModel
Overrides:
isLeaf in class MutableTreeTableModel
Parameters:
node - a node in the tree, obtained from this data source
Returns:
true if node is a leaf

isRangedModel

public boolean isRangedModel()
Determines whether the cache model can fetch data in ranges.

Specified by:
isRangedModel in interface CacheableTreeTableModel
Returns:
true if the cache model can fetch ranged data.

isValueCached

public boolean isValueCached(Object node,
                             int column)
Determines whether the value for node at index column has been evaluated.

Specified by:
isValueCached in interface CacheableTreeTableModel
Parameters:
node - the node to consider
column - the cell's column index
Returns:
true if the value has already been evaluated

Copyright © 2005 Scientific Applications. All Rights Reserved.