|
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.MutableTreeTableModel
com.sciapp.treetable.ComparableTreeTableModel
public abstract class ComparableTreeTableModel
ComparableTreeTableModel provides for a mutable treetable model whose tree structure is
dictated by a dynamic set of rules. These rules are specified by TreeTableComparators.
To add a new node, you can use the addNode method.
The add(Object data) method can also be used, for which a leaf node
will be created automatically with createLeafNode.
WARNING:The insertNodeInto should never be used unless you
know the correct index to place the new node.
| Field Summary | |
|---|---|
protected boolean |
addChildForGroup
boolean flag that indicates whether we want a child node added for every new group created, when adding nodes via the addNode method. |
protected ArrayList |
comparators
the list of row comparators. |
protected Hashtable |
defaultComparatorsByColumnClass
A table of objects that compare two object with each other, indexed by class |
| 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 | |
|---|---|
ComparableTreeTableModel(DefaultMutableTreeNode root)
Creates a ComparableTreeTableModel object. |
|
ComparableTreeTableModel(String[] columns,
Class[] classes,
DefaultMutableTreeNode root)
Creates a ComparableTreeTableModel object. |
|
ComparableTreeTableModel(String[] columns,
DefaultMutableTreeNode root)
Creates a ComparableTreeTableModel object. |
|
| Method Summary | |
|---|---|
void |
add(List data)
Convenience method to add a list of nodes to the model. |
void |
add(Object nodeData)
Convenience method to add a node to the model whose 'column data' is identified by nodeData. |
void |
addNode(DefaultMutableTreeNode node)
Adds a node to the model. |
void |
addRowComparator(TreeTableComparator newComparator)
Adds a new row comparator at the end of the list of comparators. |
void |
clearComparators()
Removes all row comparators and rebuilds the tree. |
protected void |
comparatorsChanged()
The comparators have changed in some way and the model re-creates the whole tree structure. |
protected void |
createDefaultComparators()
Creates default comparators for objects, strings, date and boolean values. |
protected abstract DefaultMutableTreeNode |
createLeafNode(Object data)
Creates and returns a new instance of a leaf node whose 'column data' is identified by data. |
protected abstract DefaultMutableTreeNode |
createNonLeafNode(DefaultMutableTreeNode child)
Creates and returns a new instance of a group (non-leaf) node whose child is identified by child. |
Object |
findTreeNode(Object comparison,
int level)
Returns the tree node that is found to be equal to comparison at the specified level. |
boolean |
getAddChildForGroup()
Determines whether we want a child node added for every new group created, when adding nodes via the addNode method. |
Comparator |
getDefaultComparator(Class columnClass)
Returns the comparator to use for objects of the specified columnClass. |
TreeTableComparator |
getRowComparator(int index)
Returns the row comparator that will be used to determine row similarity at index. |
TreeTableComparator[] |
getRowComparators()
Returns the list of row comparators as an array. |
int |
getRowComparatorSize()
Returns the size of the currently defined row comparators of this treetable. |
void |
insertRowComparator(TreeTableComparator newComparator,
int index)
Inserts a row comparator at index in the list of row comparators of this model. |
void |
loadComparators(ObjectInputStream in)
Restores the TreeTableComparators and assigns them on the model. |
void |
refreshComparators()
Indicates that the underlying comparators have changed and the model should re-create the whole tree structure. |
TreeTableComparator |
removeRowComparator(int index)
Removes the row comparator that is located at index. |
boolean |
removeRowComparator(TreeTableComparator comparator)
Removes a comparator from the list of comparators of this TreeTableModel. |
protected abstract DefaultMutableTreeNode |
replicateLeafNode(DefaultMutableTreeNode child)
Creates and returns a new instance of the leaf node identified by child. |
void |
saveComparators(ObjectOutputStream out)
Saves the TreeTableComparators that are currently installed on the model. |
void |
setAddChildForGroup(boolean addChildForGroup)
Determines whether we want a child node added for every new group created, when adding nodes via the addNode method. |
void |
setDefaultComparator(Class columnClass,
Comparator comparator)
Sets the default comparator for columnClass. |
TreeTableComparator |
setRowComparator(TreeTableComparator newComparator,
int index)
Sets a treetable comparator at index. |
| Methods inherited from class com.sciapp.treetable.MutableTreeTableModel |
|---|
addColumn, addColumn, addReorderListener, clear, fireRowsMapped, fireRowsReordered, getChild, getChildCount, getColumnClass, getColumnCount, getColumnName, getIndexOfChild, getPathToRoot, getPathToRoot, insertNodeInto, isCellEditable, isLeaf, 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, 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 |
|---|
getValueAt |
| Field Detail |
|---|
protected ArrayList comparators
protected transient Hashtable defaultComparatorsByColumnClass
protected boolean addChildForGroup
addNode method.
| Constructor Detail |
|---|
public ComparableTreeTableModel(String[] columns,
Class[] classes,
DefaultMutableTreeNode root)
public ComparableTreeTableModel(String[] columns,
DefaultMutableTreeNode root)
public ComparableTreeTableModel(DefaultMutableTreeNode root)
| Method Detail |
|---|
public void add(Object nodeData)
nodeData. This will effectively call createLeafNode
on nodeData.
nodeData - the 'column data' of the node to add.public void add(List data)
data, which is passed as a parameter. Each element in the list identifies a new node to add.
data - the list of 'column data' to add as nodes to the model.public void addNode(DefaultMutableTreeNode node)
node - the node to add.public void addRowComparator(TreeTableComparator newComparator)
newComparator - the new row comparator to addpublic void clearComparators()
protected void comparatorsChanged()
protected void createDefaultComparators()
protected abstract DefaultMutableTreeNode createLeafNode(Object data)
data.
data in this framework is either DefaultMutableTreeNode's user object attribute
or the aggregate values of a TreeTableRow.
data - the node's 'column data'.
protected abstract DefaultMutableTreeNode createNonLeafNode(DefaultMutableTreeNode child)
child.
child - this node's child (or one of its children)
public Object findTreeNode(Object comparison,
int level)
comparison - the node to compare to when scanning through the treelevel - the node's tree level
public boolean getAddChildForGroup()
addNode method.
public Comparator getDefaultComparator(Class columnClass)
columnClass - the class for which we want to find a comparator
public TreeTableComparator getRowComparator(int index)
public TreeTableComparator[] getRowComparators()
public int getRowComparatorSize()
public void insertRowComparator(TreeTableComparator newComparator,
int index)
newComparator - the new row comparator to insertindex - the index at which we want the comparator insertedpublic void loadComparators(ObjectInputStream in)
saveComparators method.
in - the object input stream to read from in order to construct the comparators.public void refreshComparators()
comparatorsChanged.
public TreeTableComparator removeRowComparator(int index)
index - the location of the comparator we want removed
public boolean removeRowComparator(TreeTableComparator comparator)
comparator - the comparator to remove
protected abstract DefaultMutableTreeNode replicateLeafNode(DefaultMutableTreeNode child)
child.
This method is used when the underlying comparators have changed, so that the tree can
be restructured.
child - the leaf we want to create a replica of.
public void saveComparators(ObjectOutputStream out)
loadComparators method.
out - the object output stream to write to when saving the comparators state.public void setAddChildForGroup(boolean addChildForGroup)
addNode method.
addChildForGroup - boolean flag that is true if a child will be added to the model
for every newly created group node, false otherwise.
public void setDefaultComparator(Class columnClass,
Comparator comparator)
columnClass - the Class for which a comparator we want to setcomparator - the comparator to set
public TreeTableComparator setRowComparator(TreeTableComparator newComparator,
int index)
newComparator - the new comparator to assignindex - set the new comparator at index
|
Copyright © 2005 Scientific Applications. All Rights Reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||