infovis.table
Class TableProxy

java.lang.Object
  extended by infovis.utils.ChangeManager
      extended by infovis.column.AbstractColumn
          extended by infovis.column.ColumnProxy
              extended by infovis.table.TableProxy
All Implemented Interfaces:
IntComparator, Column, Metadata, Constants, Table, RowComparator, Serializable, EventListener, ChangeListener, TableModelListener, TableModel
Direct Known Subclasses:
DefaultVisualization, DynamicTableProxy, FilteredTable

public class TableProxy
extends ColumnProxy
implements Table, TableModelListener

A Table Proxy implements an Table by forwarding all the methods to an internal Table.

This class is useful to implements higher level containers out of a standard DefaultTable.

Version:
$Revision: 1.23 $
Author:
Jean-Daniel Fekete
See Also:
Serialized Form

Field Summary
 
Fields inherited from class infovis.column.AbstractColumn
MODIFIED_ALL, MODIFIED_NONE
 
Fields inherited from interface infovis.Table
FILTER_COLUMN, INTERNAL_PREFIX, NIL, SELECTION_COLUMN
 
Fields inherited from interface infovis.metadata.Constants
CONTRIBUTOR, COVERAGE, CREATOR, DATE, DESCRITION, FORMAT, IDENTIFIER, LANGUAGE, PUBLISHER, RELATION, RIGHTS, SOURCE, SUBJECT, TITLE, TYPE
 
Constructor Summary
TableProxy(Table table)
          Creates a new TableProxy object.
 
Method Summary
 void addColumn(Column c)
          Adds a column.
 void addTableModelListener(TableModelListener l)
          
 void clear()
          Removes all of the elements from this column. The Column will be empty after this call returns. WARNING: if there is an associated format that maintains a status, such as a CategoricalFormat, it is not cleared so results may not be what you expected. The CategoricalFormat can be cleared explicitely if needed.
 Column getColumn(String name)
          Returns the column of a specified name.
 Column getColumnAt(int index)
          Returns the column at a specified index.
 Class getColumnClass(int columnIndex)
          
 int getColumnCount()
          Returns the number of columns of the table.
 String getColumnName(int columnIndex)
          
 int getLastRow()
          Returns the index of the last row in the table.
 int getRowCount()
          Returns the number of rows in the table.
 Table getTable()
          Returns the real table for Proxies and this for a concrete table.
 Object getValueAt(int rowIndex, int columnIndex)
          
 int indexOf(Column column)
          Returns the index of a specified column.
 int indexOf(String name)
          Returns the index of a column of a specified name.
 boolean isCellEditable(int rowIndex, int columnIndex)
          
 boolean isRowValid(int row)
          Checks whether a specified row is valid.
 boolean removeColumn(Column c)
          Removes a column from the table.
 void removeTableModelListener(TableModelListener l)
          
 RowIterator reverseIterator()
          Returns an iterator over the columns of this table in reverse order.
 void setColumnAt(int i, Column c)
          Replaces the column at a specified index.
 void setValueAt(Object aValue, int rowIndex, int columnIndex)
          
 void tableChanged(TableModelEvent e)
          
 
Methods inherited from class infovis.column.ColumnProxy
addValue, addValueOrNull, capacity, compare, dispose, ensureCapacity, getClientProperty, getFormat, getMaxIndex, getMetadata, getMinIndex, getName, getValueAt, getValueClass, hasUndefinedValue, isEmpty, isInternal, isValueUndefined, iterator, setFormat, setName, setSize, setValueAt, setValueOrNullAt, setValueUndefined, size, stateChanged
 
Methods inherited from class infovis.column.AbstractColumn
addChangeListener, compareValues, computeValueMap, computeValueMap, equalObj, equals, getLastModifiedRow, toString
 
Methods inherited from class infovis.utils.ChangeManager
disableNotify, enableNotify, getModCount, removeChangeListener
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface infovis.Column
addChangeListener, addValue, addValueOrNull, capacity, disableNotify, enableNotify, ensureCapacity, getFormat, getMaxIndex, getMinIndex, getName, getValueAt, getValueClass, hasUndefinedValue, isEmpty, isInternal, isValueUndefined, iterator, removeChangeListener, setFormat, setName, setSize, setValueAt, setValueOrNullAt, setValueUndefined, size
 
Methods inherited from interface infovis.Metadata
getClientProperty, getMetadata
 
Methods inherited from interface cern.colt.function.IntComparator
compare, equals
 

Constructor Detail

TableProxy

public TableProxy(Table table)
Creates a new TableProxy object.

Parameters:
table - The underlying table.
See Also:
Table.getTable()
Method Detail

getColumnCount

public int getColumnCount()
Returns the number of columns of the table.

Specified by:
getColumnCount in interface Table
Specified by:
getColumnCount in interface TableModel
Returns:
the number of columns of the table.

clear

public void clear()
Removes all of the elements from this column. The Column will be empty after this call returns. WARNING: if there is an associated format that maintains a status, such as a CategoricalFormat, it is not cleared so results may not be what you expected. The CategoricalFormat can be cleared explicitely if needed.

Specified by:
clear in interface Column
Specified by:
clear in interface Table
Overrides:
clear in class ColumnProxy

addColumn

public void addColumn(Column c)
Adds a column.

Specified by:
addColumn in interface Table
Parameters:
c - the column.

getColumnAt

public Column getColumnAt(int index)
Returns the column at a specified index.

Specified by:
getColumnAt in interface Table
Parameters:
index - the index.
Returns:
the column at a specified index or null if the index is out of range.

setColumnAt

public void setColumnAt(int i,
                        Column c)
Replaces the column at a specified index.

Specified by:
setColumnAt in interface Table
Parameters:
i - the index.
c - the column.

indexOf

public int indexOf(String name)
Returns the index of a column of a specified name.

Specified by:
indexOf in interface Table
Parameters:
name - the name.
Returns:
the index of a column of a specified name or -1 if no such column exist.

indexOf

public int indexOf(Column column)
Returns the index of a specified column.

Specified by:
indexOf in interface Table
Parameters:
column - the column
Returns:
the index of a specified column or -1 if the column is not in the table.

getColumn

public Column getColumn(String name)
Returns the column of a specified name.

Specified by:
getColumn in interface Table
Parameters:
name - the name.
Returns:
the column of a specified name.

removeColumn

public boolean removeColumn(Column c)
Removes a column from the table.

Specified by:
removeColumn in interface Table
Parameters:
c - the column.
Returns:
true if the column has been removed.

getTable

public Table getTable()
Returns the real table for Proxies and this for a concrete table.

Specified by:
getTable in interface Table
Returns:
the real table for Proxies and this for a concrete table.

isRowValid

public boolean isRowValid(int row)
Checks whether a specified row is valid.

Specified by:
isRowValid in interface Table
Parameters:
row - the row.
Returns:
true if it is.

getColumnName

public String getColumnName(int columnIndex)

Specified by:
getColumnName in interface TableModel

getRowCount

public int getRowCount()
Returns the number of rows in the table.

Specified by:
getRowCount in interface Table
Specified by:
getRowCount in interface TableModel
Returns:
the number of rows in the table.

getLastRow

public int getLastRow()
Returns the index of the last row in the table.

Specified by:
getLastRow in interface Table
Returns:
the index of the last row in the table

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)

Specified by:
getValueAt in interface TableModel

setValueAt

public void setValueAt(Object aValue,
                       int rowIndex,
                       int columnIndex)

Specified by:
setValueAt in interface TableModel

getColumnClass

public Class getColumnClass(int columnIndex)

Specified by:
getColumnClass in interface TableModel

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)

Specified by:
isCellEditable in interface TableModel

reverseIterator

public RowIterator reverseIterator()
Returns an iterator over the columns of this table in reverse order.

Specified by:
reverseIterator in interface Table
Returns:
an iterator over the columns of this table in reverse order.

addTableModelListener

public void addTableModelListener(TableModelListener l)

Specified by:
addTableModelListener in interface TableModel

removeTableModelListener

public void removeTableModelListener(TableModelListener l)

Specified by:
removeTableModelListener in interface TableModel

tableChanged

public void tableChanged(TableModelEvent e)

Specified by:
tableChanged in interface TableModelListener


Copyright © 2005 by Jean-Daniel Fekete and INRIA, France All rights reserved.