Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.treetable
Class AggregateTreeTableModel

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.AggregateTreeTableModel
All Implemented Interfaces:
ReorderModel, TreeTableModel, Serializable, TreeModel

public abstract class AggregateTreeTableModel
extends ComparableTreeTableModel

AggregateTreeTableModel is a treetable model whose nodes' cell value depends on the aggregate values of a TreeTableRow. The value at each treetable cell is retrieved with TreeTableRow's getAggregateValue method.

See Also:
Serialized Form

Field Summary
protected  Aggregator defaultAggregator
          the default aggregator
 
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
AggregateTreeTableModel()
          Constructs an AggregateTreeTableModel.
AggregateTreeTableModel(String[] columns)
          Constructs an AggregateTreeTableModel.
AggregateTreeTableModel(String[] columns, Class[] classes, TreeTableRow root)
          Constructs an AggregateTreeTableModel.
AggregateTreeTableModel(String[] columns, TreeTableRow root)
          Constructs an AggregateTreeTableModel.
AggregateTreeTableModel(TreeTableRow root)
          Constructs an AggregateTreeTableModel.
 
Method Summary
protected  Aggregator createDefaultAggregator()
          Creates and returns the aggregator that will be used by default.
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.
 Object getAggregateValueAt(Object node, int column)
          Returns the aggregate value to be displayed for node, at column index column.
 Aggregator getAggregator(int columnIndex)
          Returns the aggregator for columnIndex.
 Aggregator getDefaultAggregator()
          Returns the default aggregator that will be used to compute values for the aggregate rows of the model.
 Object getFlatValueAt(Object node, int column)
          Returns the non-aggregate value to be displayed for node, at column index column.
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 setDefaultAggregator(Aggregator aggregator)
          Sets the default aggregator that will be used to compute values for the aggregate rows of the model.
 
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, setValueAt, 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
 

Field Detail

defaultAggregator

protected Aggregator defaultAggregator
the default aggregator

Constructor Detail

AggregateTreeTableModel

public AggregateTreeTableModel()
Constructs an AggregateTreeTableModel.


AggregateTreeTableModel

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


AggregateTreeTableModel

public AggregateTreeTableModel(String[] columns,
                               Class[] classes,
                               TreeTableRow root)
Constructs an AggregateTreeTableModel.


AggregateTreeTableModel

public AggregateTreeTableModel(String[] columns,
                               TreeTableRow root)
Constructs an AggregateTreeTableModel.


AggregateTreeTableModel

public AggregateTreeTableModel(TreeTableRow root)
Constructs an AggregateTreeTableModel.

Method Detail

createDefaultAggregator

protected Aggregator createDefaultAggregator()
Creates and returns the aggregator that will be used by default. This implementation returns a TreeNodeAggregator.

Returns:
a new instance of the default aggregator

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.

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.

getAggregateValueAt

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

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

getAggregator

public Aggregator getAggregator(int columnIndex)
Returns the aggregator for columnIndex. This method returns the default aggregator by default. You will need to override it if you desire a more complex behaviour.

Parameters:
columnIndex - the index of the column
Returns:
the aggregator at columnIndex

getDefaultAggregator

public Aggregator getDefaultAggregator()
Returns the default aggregator that will be used to compute values for the aggregate rows of the model.

Returns:
the default aggregator

getFlatValueAt

public Object getFlatValueAt(Object node,
                             int column)
Returns the non-aggregate value to be displayed for node, at column index column.

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

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

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.

setDefaultAggregator

public void setDefaultAggregator(Aggregator aggregator)
Sets the default aggregator that will be used to compute values for the aggregate rows of the model.

Parameters:
aggregator - the aggregator to assign as the default

Copyright © 2011 Citra Technologies. All Rights Reserved.