|
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
public abstract class MutableTreeTableModel
MutableTreeTableModel provides for a TreeTableModel whose nodes can be added or removed
dynamically. You can use insertNodeInto to add a node and
removeNodeFromParent to remove a node.
| Field Summary | |
|---|---|
protected Class[] |
classes
the column classes |
protected String[] |
columns
the column names |
| Fields inherited from class com.sciapp.treetable.AbstractTreeTableModel |
|---|
listenerList, root |
| Fields inherited from interface com.sciapp.treetable.TreeTableModel |
|---|
CHANGE_COLUMN_SOURCE |
| Constructor Summary | |
|---|---|
MutableTreeTableModel(String[] columns,
Class[] classes,
TreeNode root)
Constructs a MutableTreeTableModel. |
|
MutableTreeTableModel(String[] columns,
TreeNode root)
Constructs a MutableTreeTableModel. |
|
MutableTreeTableModel(TreeNode root)
Constructs a MutableTreeTableModel. |
|
| Method Summary | |
|---|---|
void |
addColumn(String columnName)
Adds a column to the model. |
void |
addColumn(String columnName,
Class columnClass)
Adds a column to the model. |
void |
addReorderListener(ReorderListener l)
Adds a ReorderListener that is notified each time a change to the data model occurs so that the table updates the selected rows accordingly. |
void |
clear()
Clears the model of any data. |
void |
fireRowsMapped(int[] changedIndices)
Notifies listeners that the rows of the table have been reordered according to the changedIndices map. |
void |
fireRowsReordered(ReorderEvent event)
Notifies listeners that the rows of the table have been reordered in some way. |
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. |
Class |
getColumnClass(int column)
Returns the class of all the cells in the column. |
int |
getColumnCount()
Returns the number of columns. |
String |
getColumnName(int column)
Returns the name of the column at columnIndex as it will be displayed by the table |
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. |
void |
insertNodeInto(MutableTreeNode newChild,
MutableTreeNode parent,
int index)
Inserts a node at a specific location index in its parents children. |
boolean |
isCellEditable(Object node,
int column)
Returns true if node at columnIndex is editable. |
boolean |
isLeaf(Object node)
Returns true if node is a leaf. |
void |
moveNode(MutableTreeNode fromNode,
int startIndex,
int endIndex,
int toIndex)
Moves one or more children nodes of fromNode starting at startIndex to endIndex to the toIndex. |
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)
Invoke this method after you've inserted some TreeNodes into node. |
void |
nodesWereRemoved(TreeNode node,
int[] childIndices,
Object[] removedChildren)
Invoke this method after you've removed some TreeNodes from node. |
void |
removeNodeFromParent(MutableTreeNode node)
Removes a node from its parent. |
void |
removeReorderListener(ReorderListener l)
Removes a listener from the list that is notified each time a reorder event is generated. |
void |
setColumnClasses(Class[] newColumnClasses)
Assigns the column classes. |
void |
setColumnNames(String[] newNames)
Assigns the column names. |
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. |
| 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 |
|---|
getValueAt |
| Field Detail |
|---|
protected String[] columns
protected Class[] classes
| Constructor Detail |
|---|
public MutableTreeTableModel(String[] columns,
Class[] classes,
TreeNode root)
public MutableTreeTableModel(String[] columns,
TreeNode root)
public MutableTreeTableModel(TreeNode root)
| Method Detail |
|---|
public void addColumn(String columnName)
columnName - the name of the column to add.
public void addColumn(String columnName,
Class columnClass)
columnName - the name of the column to add.columnClass - the class of the column to add.public void addReorderListener(ReorderListener l)
addReorderListener in interface ReorderModell - the ReorderListenerpublic void clear()
public void fireRowsMapped(int[] changedIndices)
fireRowsMapped in interface ReorderModelchangedIndices - int array indicating how the rows have been reordered.ReorderEventpublic void fireRowsReordered(ReorderEvent event)
fireRowsReordered in interface ReorderModelevent - the reorder event.ReorderEvent
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 TreeModelparent - a node in the tree, obtained from this data source
parent at index indexpublic 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 TreeModelparent - a node in the tree, obtained from this data source
parentpublic Class getColumnClass(int column)
getColumnClass in interface TreeTableModelcolumn - the index of the column
public int getColumnCount()
getColumnCount in interface TreeTableModelpublic String getColumnName(int column)
getColumnName in interface TreeTableModelcolumn - the index of the column
public int getIndexOfChild(Object parent,
Object child)
parent
is null or child is null,
returns -1.
getIndexOfChild in interface TreeModelparent - a note in the tree, obtained from this data sourcechild - the node we are interested in
child or parent are nullpublic TreeNode[] getPathToRoot(TreeNode aNode)
protected TreeNode[] getPathToRoot(TreeNode aNode,
int depth)
public void insertNodeInto(MutableTreeNode newChild,
MutableTreeNode parent,
int index)
newChild - the node to insertparent - the parent node to remove node fromindex - the location in the parent node's childrens
public boolean isCellEditable(Object node,
int column)
node at columnIndex is editable.
isCellEditable in interface TreeTableModelnode - the node to considercolumn - the column index
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 TreeModelnode - a node in the tree, obtained from this data source
node is a leaf
public void moveNode(MutableTreeNode fromNode,
int startIndex,
int endIndex,
int toIndex)
fromNode - the node whose children are to be movedstartIndex - the starting child index to be movedendIndex - the ending child index to be movedtoIndex - the destination of the children nodes to be moved
ArrayIndexOutOfBoundsException - if any of the indices are out of range. Or if endIndex is less than startIndex.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)
public void nodesWereRemoved(TreeNode node,
int[] childIndices,
Object[] removedChildren)
public void removeNodeFromParent(MutableTreeNode node)
node - the node to removepublic void removeReorderListener(ReorderListener l)
removeReorderListener in interface ReorderModell - the RearrangeListenerpublic void setColumnClasses(Class[] newColumnClasses)
newColumnClasses - the column classes to assign as an array.public void setColumnNames(String[] newNames)
newNames - the column names to assign as an array.
public void setValueAt(Object aValue,
Object node,
int column)
node at columnIndex to aValue.
setValueAt in interface TreeTableModelaValue - the new valuenode - the node whose value is to be changedcolumn - the column whose value is to be changed
public 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 TreeModelpath - path to the node that the user has alterednewValue - the new value from the TreeCellEditor
|
Copyright © 2005 Scientific Applications. All Rights Reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||