Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.treetable
Class ObjectTreeTableModel

java.lang.Object
  extended by com.citra.treetable.AbstractTreeTableModel
      extended by com.citra.treetable.MutableTreeTableModel
          extended by com.citra.treetable.ComparableTreeTableModel
              extended by com.citra.treetable.ObjectTreeTableModel
All Implemented Interfaces:
ReorderModel, TreeTableModel, Serializable, TreeModel
Direct Known Subclasses:
DefaultOlapTableModel, DefaultTreeTableColumnModel, ListTreeTableModel, SingleTreeTableModel

public abstract class ObjectTreeTableModel
extends ComparableTreeTableModel

ObjectTreeTableModel is a treetable model whose nodes' cell value depends on an abstract Object. The object at each node is the user object of a DefaultMutableTreeNode.

The value at each treetable cell is retrieved with the getObjectAt method.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.citra.treetable.ComparableTreeTableModel
addChildForGroup, comparators, defaultComparatorsByColumnClass
 
Fields inherited from class com.citra.treetable.MutableTreeTableModel
classes, columns
 
Fields inherited from class com.citra.treetable.AbstractTreeTableModel
listenerList, root
 
Fields inherited from interface com.citra.treetable.TreeTableModel
CHANGE_COLUMN_SOURCE
 
Constructor Summary
ObjectTreeTableModel()
          Constructs an ObjectTreeTableModel.
ObjectTreeTableModel(DefaultMutableTreeNode root)
          Constructs an ObjectTreeTableModel.
ObjectTreeTableModel(String[] columns)
          Constructs an ObjectTreeTableModel.
ObjectTreeTableModel(String[] columns, Class[] classes, DefaultMutableTreeNode root)
          Constructs an ObjectTreeTableModel.
ObjectTreeTableModel(String[] columns, DefaultMutableTreeNode root)
          Constructs an ObjectTreeTableModel.
 
Method Summary
protected  DefaultMutableTreeNode createLeafNode(Object o)
          Creates and returns a new instance of a leaf node whose 'column data' is identified by data.
protected  DefaultMutableTreeNode createNonLeafNode(DefaultMutableTreeNode child)
          Creates and returns a new instance of a group (non-leaf) node whose child is identified by child.
abstract  Object getObjectAt(Object object, int column)
          Returns the value for object at column
 Object getValueAt(Object node, int column)
          Returns the value to be displayed for node, at column index column.
protected  DefaultMutableTreeNode replicateLeafNode(DefaultMutableTreeNode child)
          Creates and returns a new instance of the leaf node identified by child.
 void setObjectAt(Object aValue, Object object, int column)
          Sets the value for node at column to aValue.
 void setValueAt(Object aValue, Object node, int column)
          Sets the value for node at columnIndex to aValue.
 
Methods inherited from class com.citra.treetable.ComparableTreeTableModel
add, add, addNode, addRowComparator, clearComparators, comparatorsChanged, createDefaultComparators, findTreeNode, getAddChildForGroup, getDefaultComparator, getRowComparator, getRowComparators, getRowComparatorSize, insertRowComparator, loadComparators, refreshComparators, removeRowComparator, removeRowComparator, saveComparators, setAddChildForGroup, setDefaultComparator, setRowComparator
 
Methods inherited from class com.citra.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, valueForPathChanged
 
Methods inherited from class com.citra.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
 

Constructor Detail

ObjectTreeTableModel

public ObjectTreeTableModel()
Constructs an ObjectTreeTableModel.


ObjectTreeTableModel

public ObjectTreeTableModel(String[] columns)
Constructs an ObjectTreeTableModel.


ObjectTreeTableModel

public ObjectTreeTableModel(String[] columns,
                            Class[] classes,
                            DefaultMutableTreeNode root)
Constructs an ObjectTreeTableModel.


ObjectTreeTableModel

public ObjectTreeTableModel(String[] columns,
                            DefaultMutableTreeNode root)
Constructs an ObjectTreeTableModel.


ObjectTreeTableModel

public ObjectTreeTableModel(DefaultMutableTreeNode root)
Constructs an ObjectTreeTableModel.

Method Detail

getObjectAt

public abstract Object getObjectAt(Object object,
                                   int column)
Returns the value for object at column

Parameters:
object - the object whose value is to be queried
column - the column whose value is to be queried
Returns:
the value of the Object at the specified index

getValueAt

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

Parameters:
node - the node to query
column - the column index
Returns:
the value

createLeafNode

protected DefaultMutableTreeNode createLeafNode(Object o)
Creates and returns a new instance of a leaf node whose 'column data' is identified by data. data in this framework is either DefaultMutableTreeNode's user object attribute or the aggregate values of a TreeTableRow.

Specified by:
createLeafNode in class ComparableTreeTableModel
Parameters:
o - the node's 'column data'.
Returns:
the newly created leaf node.

replicateLeafNode

protected DefaultMutableTreeNode replicateLeafNode(DefaultMutableTreeNode child)
Creates and returns a new instance of the leaf node identified by child. This method is used when the underlying comparators have changed, so that the tree can be restructured.

Specified by:
replicateLeafNode in class ComparableTreeTableModel
Parameters:
child - the leaf we want to create a replica of.
Returns:
the newly created leaf node.

createNonLeafNode

protected DefaultMutableTreeNode createNonLeafNode(DefaultMutableTreeNode child)
Creates and returns a new instance of a group (non-leaf) node whose child is identified by child.

Specified by:
createNonLeafNode in class ComparableTreeTableModel
Parameters:
child - this node's child (or one of its children)
Returns:
the newly created group (non-leaf) node.

setObjectAt

public void setObjectAt(Object aValue,
                        Object object,
                        int column)
Sets the value for node at column to aValue.

Parameters:
aValue - the new value
object - the object whose value is to be altered
column - the column whose value is to be altered

setValueAt

public void setValueAt(Object aValue,
                       Object node,
                       int column)
Sets the value for node at columnIndex to aValue.

Specified by:
setValueAt in interface TreeTableModel
Overrides:
setValueAt in class MutableTreeTableModel
Parameters:
aValue - the new value
node - the node whose value is to be changed
column - the column whose value is to be changed

Copyright © 2011 Citra Technologies. All Rights Reserved.