prefuse.visual
Class AggregateTable<T extends AggregateItem<T,V>,V extends VisualItem<?>>

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

public abstract class AggregateTable<T extends AggregateItem<T,V>,V extends VisualItem<?>>
extends VisualTable<T,T>

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.AggregatedIterable
          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<? extends Tuple<?>> 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.lang.Iterable<V> 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.
static
<V extends VisualItem<?>>
AggregateTable<TableAggregateItem<V>,V>
createAggregateTable(Visualization vis, java.lang.String group)
           
static
<V extends VisualItem<?>>
AggregateTable<TableAggregateItem<V>,V>
createAggregateTable(Visualization vis, java.lang.String group, Schema schema)
           
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.Set<Tuple<?>> getAggregates(Tuple<?> t)
          Get a Set of all AggregateItems which contain the input 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, createVisualTable, createVisualTable, createVisualTable, createVisualTable, createVisualTable, getBounds, getDOI, getEndFillColor, getEndFont, getEndSize, getEndStrokeColor, getEndTextColor, getEndX, getEndY, getFillColor, getFont, getGroup, getItem, getShapeBuilder, 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, setShapeBuilder, 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, createCascadedTable, createCascadedTable, createCascadedTable, createCascadedTable, 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, createEmptyCopyWithSchema, createTable, createTable, createTable, createTupleInstance, 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, 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<? extends Tuple<?>> 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

createAggregateTable

public static <V extends VisualItem<?>> AggregateTable<TableAggregateItem<V>,V> createAggregateTable(Visualization vis,
                                                                                                     java.lang.String group)

createAggregateTable

public static <V extends VisualItem<?>> AggregateTable<TableAggregateItem<V>,V> createAggregateTable(Visualization vis,
                                                                                                     java.lang.String group,
                                                                                                     Schema schema)

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.lang.Iterable<V> 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.Set<Tuple<?>> getAggregates(Tuple<?> t)
Get a Set of all AggregateItems which contain the input Tuple.

Parameters:
t - the input tuple
Returns:
a Set of all AggregateItems which 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<T extends AggregateItem<T,V>,T extends AggregateItem<T,V>>
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 © 2008 Regents of the University of California