|
Copyright © 2005 Scientific Applications. All Rights Reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sciapp.treetable.AbstractTreeTableModel
com.sciapp.treetable.db.AbstractDatabaseTreeTableModel
public abstract class AbstractDatabaseTreeTableModel
AbstractDatabaseTreeTableModel represents a sortable and filterable database treetable model that is also cached. Sorting is provided via an internal SortTableModel instance, whereas filtering through an internal FilterTableModel instance. Finally, caching is handled by a TreeTableCache object.
Nested Class Summary | |
---|---|
class |
AbstractDatabaseTreeTableModel.DefaultTreeTableAggregateRowCache
This class represents a cache object for aggregate rows. |
Field Summary | |
---|---|
protected TreeTableCache |
aggregateRowCache
the cache for aggregate rows |
protected DatabaseAggregator |
aggregator
the default database aggregator |
protected TreeTableCache |
cache
the cache for NON-aggregate rows |
protected FilterTableModel |
dbFilter
the internal filter tablemodel instance |
protected SortTableModel |
dbSorter
the internal sort tablemodel instance |
Fields inherited from class com.sciapp.treetable.AbstractTreeTableModel |
---|
listenerList, root |
Fields inherited from interface com.sciapp.treetable.TreeTableModel |
---|
CHANGE_COLUMN_SOURCE |
Fields inherited from interface com.sciapp.treetable.TreeTableModel |
---|
CHANGE_COLUMN_SOURCE |
Constructor Summary | |
---|---|
AbstractDatabaseTreeTableModel(Object root,
TreeTableCache cache)
Constructs an AbstractDatabaseTableModel. |
Method Summary | |
---|---|
protected abstract DatabaseAggregator |
createDefaultAggregator()
Creates and returns the default aggregator. |
protected abstract TreeTableRow |
createTableRow(TreeTableRow parent,
int index)
Creates and returns a TreeTableRow for the node parent at its
child index identified by index . |
DatabaseAggregator |
getAggregator()
Returns the default database aggregator. |
Object |
getChild(Object parent,
int index)
Returns the child of parent at index index
in the parent's
child array. |
int |
getChildCount(Object parent)
Returns the number of children of parent . |
FilterTableModel |
getFilterTableModel()
Returns the internal filter tablemodel instance. |
int |
getIndexOfChild(Object parent,
Object child)
Returns the index of child in parent. |
TreeNode[] |
getPathToRoot(TreeNode aNode)
Builds the parents of node up to and including the root node, where the original node is the last element in the returned array. |
protected TreeNode[] |
getPathToRoot(TreeNode aNode,
int depth)
Builds the parents of node up to and including the root node, where the original node is the last element in the returned array. |
SortTableModel |
getSortTableModel()
Returns the internal sort tablemodel instance. |
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 node,
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 |
isCellEditable(Object node,
int column)
Returns true if node at columnIndex is editable. |
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. |
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. |
void |
nodeChanged(TreeNode node)
This method should be invoked when the representation of node in the tree
has changed. |
void |
nodesChanged(TreeNode node,
int[] childIndices)
This method should be invoked when the representation of the children identified by childIndices in the tree has changed. |
void |
nodeStructureChanged(TreeNode node)
This method should be invoked when the children of node and its children children have
completely changed. |
void |
nodesWereInserted(TreeNode node,
int[] childIndices)
This method should be invoked when some TreeNodes were inserted into node . |
void |
nodesWereRemoved(TreeNode node,
int[] childIndices,
Object[] removedChildren)
This method should be invoked when some TreeNodes were removed from node . |
abstract void |
orderByClause()
This method is called whenever sorting is requested. |
protected Object |
retrieveFromDB(ResultSet rs,
int column)
Performs the binding from a database value to a java value using the supplied resultset and the column's index, and returns the result. |
protected Object |
retrieveFromDB(ResultSet rs,
int column,
Class c)
Performs the binding from a database value to a java value using the supplied resultset and the column's class, and returns the result. |
void |
setAggregator(DatabaseAggregator aggregator)
Sets the default database aggregator. |
void |
setCache(TreeTableCache newCache)
Assigns a new cache for the NON-aggregate nodes. |
void |
setValueAt(Object aValue,
Object node,
int column)
Sets the value for node at columnIndex to aValue . |
void |
valueForPathChanged(TreePath path,
Object newValue)
Messaged when the user has altered the value for the item identified by path to newValue . |
abstract void |
whereClause()
This method is called whenever filtering is requested. |
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.db.DatabaseTreeTableModel |
---|
fetchChildren, fetchGroupCount, fetchGroups |
Methods inherited from interface com.sciapp.treetable.TreeTableModel |
---|
getColumnClass, getColumnCount, getColumnName, isAggregate, isFooter, isHeader |
Methods inherited from interface javax.swing.tree.TreeModel |
---|
addTreeModelListener, getRoot, removeTreeModelListener |
Methods inherited from interface com.sciapp.treetable.TreeTableModel |
---|
getColumnClass, getColumnCount, getColumnName, isAggregate, isFooter, isHeader |
Methods inherited from interface javax.swing.tree.TreeModel |
---|
addTreeModelListener, getRoot, removeTreeModelListener |
Field Detail |
---|
protected SortTableModel dbSorter
protected FilterTableModel dbFilter
protected TreeTableCache cache
protected TreeTableCache aggregateRowCache
protected DatabaseAggregator aggregator
Constructor Detail |
---|
public AbstractDatabaseTreeTableModel(Object root, TreeTableCache cache)
Method Detail |
---|
protected abstract DatabaseAggregator createDefaultAggregator()
protected abstract TreeTableRow createTableRow(TreeTableRow parent, int index)
parent
at its
child index identified by index
.
parent
- the parent nodeindex
- the child index of parent
that we want returned
parent
at index
public DatabaseAggregator getAggregator()
public Object getChild(Object parent, int index)
parent
at index index
in the parent's
child array. parent
must be a node previously obtained
from this data source. This should not return null
if index
is a valid index for parent
(that is index >= 0 &&
index < getChildCount(parent
)).
getChild
in interface TreeModel
parent
- a node in the tree, obtained from this data source
parent
at index index
public int getChildCount(Object parent)
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.
getChildCount
in interface TreeModel
parent
- a node in the tree, obtained from this data source
parent
public FilterTableModel getFilterTableModel()
public int getIndexOfChild(Object parent, Object child)
parent
is null
or child
is null
,
returns -1.
getIndexOfChild
in interface TreeModel
parent
- a note in the tree, obtained from this data sourcechild
- the node we are interested in
child
or parent
are null
public TreeNode[] getPathToRoot(TreeNode aNode)
protected TreeNode[] getPathToRoot(TreeNode aNode, int depth)
public SortTableModel getSortTableModel()
public List getUncachedChildren(Object parent, int from, int to)
getUncachedChildren
in interface CacheableTreeTableModel
parent
- the parent nodefrom
- the starting rowto
- the ending row
public int getUncachedGroupCount(Object node)
getUncachedGroupCount
in interface CacheableTreeTableModel
node
- the node for which the children count we want to retrieve.
public List getUncachedGroups(Object node, int from, int to)
getUncachedGroups
in interface CacheableTreeTableModel
node
- the parent nodefrom
- the starting rowto
- the ending row
public Object getValueAt(Object node, int column)
node
,
at column index column
.
getValueAt
in interface TreeTableModel
node
- the node to querycolumn
- the column index
public boolean isCellEditable(Object node, int column)
node
at columnIndex is editable.
isCellEditable
in interface TreeTableModel
node
- the node to considercolumn
- the column index
public boolean isCountCached(Object node)
isCountCached
in interface CacheableTreeTableModel
public boolean isLeaf(Object node)
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.
isLeaf
in interface TreeModel
node
- a node in the tree, obtained from this data source
node
is a leafpublic boolean isRangedModel()
isRangedModel
in interface CacheableTreeTableModel
public boolean isValueCached(Object node, int column)
isValueCached
in interface CacheableTreeTableModel
node
- the node to considercolumn
- the cell's column index
public void nodeChanged(TreeNode node)
node
in the tree
has changed.
public void nodesChanged(TreeNode node, int[] childIndices)
childIndices
in the tree has changed.
public void nodeStructureChanged(TreeNode node)
node
and its children children have
completely changed. This will post a treeStructureChanged event.
public void nodesWereInserted(TreeNode node, int[] childIndices)
node
.
public void nodesWereRemoved(TreeNode node, int[] childIndices, Object[] removedChildren)
node
.
public abstract void orderByClause()
protected Object retrieveFromDB(ResultSet rs, int column) throws SQLException
rs
- the current result setcolumn
- the column being fetched
column
SQLException
protected Object retrieveFromDB(ResultSet rs, int column, Class c) throws SQLException
rs
- the current result setcolumn
- the column being fetchedc
- the column's class
column
SQLException
public void setAggregator(DatabaseAggregator aggregator)
aggregator
- the default database aggregator to assign.public void setCache(TreeTableCache newCache)
newCache
- the new cache to assign.public void setValueAt(Object aValue, Object node, int column)
node
at columnIndex
to aValue
.
setValueAt
in interface TreeTableModel
aValue
- the new valuenode
- the node whose value is to be changedcolumn
- the column whose value is to be changedpublic void valueForPathChanged(TreePath path, Object newValue)
path
to newValue
.
If newValue
signifies a truly new value
the model should post a treeNodesChanged
event.
valueForPathChanged
in interface TreeModel
path
- path to the node that the user has alterednewValue
- the new value from the TreeCellEditorpublic abstract void whereClause()
|
Copyright © 2005 Scientific Applications. All Rights Reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |