prefuse.visual
Class AggregateTable

java.lang.Object
  extended by prefuse.data.tuple.AbstractTupleSet
      extended by prefuse.data.Table
          extended by prefuse.data.CascadedTable
              extended by prefuse.visual.VisualTable
                  extended by prefuse.visual.AggregateTable
All Implemented Interfaces:
java.util.EventListener, ColumnListener, TupleSet, VisualTupleSet

public class AggregateTable
extends VisualTable

VisualTable instance that maintains visual items representing aggregates of items. This class maintains both a collection of AggregateItems and a mapping between AggregateItems and the VisualItems contained within those aggregates.

Author:
jeffrey heer

Nested Class Summary
protected  class AggregateTable.AggregatedIterator
          Iterator instance that iterates over the items contained in an aggregate.
 
Nested classes/interfaces inherited from class prefuse.data.Table
Table.ColumnEntry
 
Field Summary
protected static java.lang.String AGGREGATE
           
protected static Schema AGGREGATED_SCHEMA
           
protected  Table m_aggregated
          Table storing the 1->Many aggregation mappings
protected static java.lang.String MEMBER
           
protected static java.lang.String MEMBER_HASH
           
 
Fields inherited from class prefuse.data.CascadedTable
m_colFilter, m_listener, m_parent, m_pnames, m_rowFilter
 
Fields inherited from class prefuse.data.Table
m_columns, m_entries, m_lastCol, m_listeners, m_modCount, m_names, m_rows, m_schema, m_tuples
 
Fields inherited from interface prefuse.data.tuple.TupleSet
EMPTY_ARRAY
 
Constructor Summary
AggregateTable(Visualization vis, java.lang.String group)
          Create a new AggregateTable.
AggregateTable(Visualization vis, java.lang.String group, Schema schema)
          Create a new AggregateTable.
 
Method Summary
 void addToAggregate(int row, VisualItem member)
          Add an item to the aggregation at the given row.
 boolean aggregateContains(int row, VisualItem member)
          Indicates if an item is a member of the aggregate at the given row
 java.util.Iterator aggregatedTuples(int row)
          Get all VisualItems within the aggregate at the given table row.
protected  void clearAggregateMappings(int row, boolean update)
          Clears all aggregates mappings for the aggregate at the given row, optionally issuing a table update.
protected  void fireTableEvent(int row0, int row1, int col, int type)
          Clear all aggregate mappings for a row when it is deleted.
protected  int getAggregatedRow(int row, VisualItem member)
          Get the row index to the aggregate mapping table for the given aggregate and contained VisualItem.
 java.util.Iterator getAggregates(Tuple t)
          Get an iterator over all AggregateItems that contain the given Tuple.
 int getAggregateSize(int row)
          Get the size of the aggregate represented at the given table row.
protected  int getHashCode(Tuple t)
          Get a hashcode that uniquely identifies a particular tuple
 void removeAllFromAggregate(int row)
          Remove all items contained in the aggregate at the given row
 void removeFromAggregate(int row, VisualItem member)
          Remove an item from the aggregation at the given row
protected  boolean validRowCheck(int row, boolean throwException)
          Check a row for validity, optionally throwing an exception when an invalid row is found.
 
Methods inherited from class prefuse.visual.VisualTable
addItem, getBounds, getDOI, getEndFillColor, getEndFont, getEndSize, getEndStrokeColor, getEndTextColor, getEndX, getEndY, getFillColor, getFont, getGroup, getItem, getShape, getSize, getStartFillColor, getStartFont, getStartSize, getStartStrokeColor, getStartTextColor, getStartX, getStartY, getStroke, getStrokeColor, getTextColor, getVisualization, getX, getY, init, isEndVisible, isExpanded, isFixed, isHighlighted, isHover, isInteractive, isStartVisible, isValidated, isVisible, setBounds, setDOI, setEndFillColor, setEndFont, setEndSize, setEndStrokeColor, setEndTextColor, setEndVisible, setEndX, setEndY, setExpanded, setFillColor, setFixed, setFont, setGroup, setHighlighted, setHover, setInteractive, setShape, setSize, setStartFillColor, setStartFont, setStartSize, setStartStrokeColor, setStartTextColor, setStartVisible, setStartX, setStartY, setStroke, setStrokeColor, setTextColor, setValidated, setVisible, setVisualization, setX, setY
 
Methods inherited from class prefuse.data.CascadedTable
addCascadedRow, addRow, addRows, filterColumns, filterRows, getChildRow, getColumn, getColumnCount, getColumnName, getColumnNames, getColumnNumber, getColumnProjection, getLocalColumnCount, getParentRow, getParentTable, getRowFilter, hasColumn, invalidateSchema, removeCascadedRow, removeRow, setColumnProjection, setRowFilter
 
Methods inherited from class prefuse.data.Table
addColumn, addColumn, addColumn, addColumn, addColumn, addConstantColumn, addTableListener, addTuple, canGet, canGetBoolean, canGetDate, canGetDouble, canGetFloat, canGetInt, canGetLong, canGetString, canSet, canSetBoolean, canSetDate, canSetDouble, canSetFloat, canSetInt, canSetLong, canSetString, clear, columnChanged, columnChanged, columnChanged, columnChanged, columnChanged, columnChanged, columnChanged, containsTuple, get, get, getBoolean, getBoolean, getColumn, getColumnNumber, getColumnRow, getColumns, getColumnType, getColumnType, getDate, getDate, getDefault, getDouble, getDouble, getFloat, getFloat, getIndex, getIndex, getInt, getInt, getLong, getLong, getMaximumRow, getMetadata, getMinimumRow, getModificationCount, getRowCount, getSchema, getString, getString, getTableRow, getTuple, getTupleCount, handleColumnChanged, index, isAddColumnSupported, isCellEditable, isValidRow, iterator, iterator, rangeSortedBy, rangeSortedBy, rangeSortedBy, rangeSortedBy, rangeSortedBy, remove, removeAllTableListeners, removeColumn, removeColumn, removeColumn, removeIndex, removeTableListener, removeTuple, renumberColumns, revertToDefault, rows, rows, rows, rowsSortedBy, select, set, set, setBoolean, setBoolean, setDate, setDate, setDouble, setDouble, setFloat, setFloat, setInt, setInt, setLong, setLong, setString, setString, setTuple, setTupleManager, toString, tuples, tuples, tuplesReversed, updateRowCount
 
Methods inherited from class prefuse.data.tuple.AbstractTupleSet
addColumns, addPropertyChangeListener, addPropertyChangeListener, addTupleSetListener, fireTupleEvent, fireTupleEvent, fireTupleEvent, getClientProperty, putClientProperty, removePropertyChangeListener, removePropertyChangeListener, removeTupleSetListener, tuples, tuples
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface prefuse.data.tuple.TupleSet
addColumn, addColumn, addColumn, addColumn, addColumns, addPropertyChangeListener, addPropertyChangeListener, addTuple, addTupleSetListener, clear, containsTuple, getClientProperty, getTupleCount, isAddColumnSupported, putClientProperty, removePropertyChangeListener, removePropertyChangeListener, removeTuple, removeTupleSetListener, setTuple, tuples, tuples, tuples
 

Field Detail

m_aggregated

protected Table m_aggregated
Table storing the 1->Many aggregation mappings


AGGREGATE

protected static final java.lang.String AGGREGATE
See Also:
Constant Field Values

MEMBER_HASH

protected static final java.lang.String MEMBER_HASH
See Also:
Constant Field Values

MEMBER

protected static final java.lang.String MEMBER
See Also:
Constant Field Values

AGGREGATED_SCHEMA

protected static final Schema AGGREGATED_SCHEMA
Constructor Detail

AggregateTable

public AggregateTable(Visualization vis,
                      java.lang.String group)
Create a new AggregateTable.

Parameters:
vis - the Visualization associated with the table
group - the data group the table contents belongs to

AggregateTable

public AggregateTable(Visualization vis,
                      java.lang.String group,
                      Schema schema)
Create a new AggregateTable.

Parameters:
vis - the Visualization associated with the table
group - the data group the table contents belongs to
schema - the Schema to use for this table
Method Detail

getAggregateSize

public int getAggregateSize(int row)
Get the size of the aggregate represented at the given table row. Returns the number of visual items contained in the aggregation.

Returns:
the aggregate size for the given row

addToAggregate

public void addToAggregate(int row,
                           VisualItem member)
Add an item to the aggregation at the given row.

Parameters:
row - the row index of the aggregate
member - the item to add to the aggregation

removeFromAggregate

public void removeFromAggregate(int row,
                                VisualItem member)
Remove an item from the aggregation at the given row

Parameters:
row - the row index of the aggregate
member - the item to remove from the aggregation

removeAllFromAggregate

public void removeAllFromAggregate(int row)
Remove all items contained in the aggregate at the given row

Parameters:
row - the row index of the aggregate

clearAggregateMappings

protected void clearAggregateMappings(int row,
                                      boolean update)
Clears all aggregates mappings for the aggregate at the given row, optionally issuing a table update.

Parameters:
row - the table row of the aggregate
update - indicates whether or not to fire a table update

aggregateContains

public boolean aggregateContains(int row,
                                 VisualItem member)
Indicates if an item is a member of the aggregate at the given row

Parameters:
row - the table row of the aggregate
member - the item to check from containment
Returns:
true if the item is in the aggregate, false otherwise

getAggregatedRow

protected int getAggregatedRow(int row,
                               VisualItem member)
Get the row index to the aggregate mapping table for the given aggregate and contained VisualItem.

Parameters:
row - the table row of the aggregate
member - the VisualItem to look up
Returns:
the row index into the internal aggregate mapping table for the mapping between the given aggregate row and given VisualItem

aggregatedTuples

public java.util.Iterator aggregatedTuples(int row)
Get all VisualItems within the aggregate at the given table row.

Parameters:
row - the table row of the aggregate
Returns:
an iterator over the items in the aggregate

getAggregates

public java.util.Iterator getAggregates(Tuple t)
Get an iterator over all AggregateItems that contain the given Tuple.

Parameters:
t - the input tuple
Returns:
an iterator over all AggregateItems that contain the input Tuple

getHashCode

protected int getHashCode(Tuple t)
Get a hashcode that uniquely identifies a particular tuple

Parameters:
t - the tuple to compute the hash for
Returns:
a unique identifier for the tuple

validRowCheck

protected boolean validRowCheck(int row,
                                boolean throwException)
Check a row for validity, optionally throwing an exception when an invalid row is found.

Parameters:
row - the row to check
throwException - indicates if an exception should be thrown when an invalid row is encountered
Returns:
true if the row was valid, false otherwise

fireTableEvent

protected void fireTableEvent(int row0,
                              int row1,
                              int col,
                              int type)
Clear all aggregate mappings for a row when it is deleted.

Overrides:
fireTableEvent in class VisualTable
Parameters:
row0 - the starting row of the modified range
row1 - the ending row (inclusive) of the modified range
col - the number of the column modified, or EventConstants.ALL_COLUMNS for operations effecting all columns.
type - the table modification type, one of EventConstants.INSERT, EventConstants.DELETE, or EventConstants.UPDATE.


Copyright © 2007 Regents of the University of California