Copyright © 2005 Scientific Applications. All Rights Reserved.

com.sciapp.table.cache
Class CachedListTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.sciapp.table.ListTableMap
          extended by com.sciapp.table.cache.CachedListTableModel
All Implemented Interfaces:
ReorderListener, CacheableTableModel, ListTableModel, ReorderModel, Serializable, EventListener, TableModelListener, TableModel

public class CachedListTableModel
extends ListTableMap
implements CacheableTableModel

CachedListTableModel wraps around a ListTableModel in order to provide for a caching mechanism.

See Also:
Serialized Form

Field Summary
protected  DefaultTableCache cache
          the cache
 
Fields inherited from class com.sciapp.table.ListTableMap
tableModel
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
CachedListTableModel(ListTableModel model)
          Creates a CachedListTableModel.
CachedListTableModel(ListTableModel model, DefaultTableCache cache)
          Creates a CachedListTableModel.
CachedListTableModel(ListTableModel model, int chunkSize, int maximumCacheSize)
          Creates a CachedListTableModel.
 
Method Summary
 DefaultTableCache getTableCache()
          Returns the cache store that is caching the underlying list table model.
 List getUncachedRows(int from, int to)
          Retrieves the rows from the table model by specifying a row interval.
 Object getValueAt(int row, int column)
          Returns tableModel.getValueAt
 boolean isCountCached()
          Determines whether the row count has been evaluated.
 boolean isRangedModel()
          Determines whether the cache model can fetch data in ranges.
 boolean isValueCached(int row, int column)
          Determines whether the value at the specified cell has been evaluated.
 void setTableCache(DefaultTableCache cache)
          Assigns the cache store that will be used for caching the underlying list table model.
 void tableChanged(TableModelEvent e)
          This fine grain notification tells listeners the exact range of cells, rows, or columns that changed.
 
Methods inherited from class com.sciapp.table.ListTableMap
addReorderListener, addRow, addRows, clear, convertRowIndexToModel, convertRowIndexToView, fireRowsMapped, fireRowsReordered, getCellValue, getColumnClass, getColumnCount, getColumnName, getInnerModel, getModel, getRowCount, getRows, isCellEditable, removeReorderListener, removeRow, removeRows, rowsReordered, setModel, setValueAt
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, getColumnClass, getColumnCount, getColumnName, getRowCount, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from interface com.sciapp.table.ListTableModel
fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged
 

Field Detail

cache

protected DefaultTableCache cache
the cache

Constructor Detail

CachedListTableModel

public CachedListTableModel(ListTableModel model)
Creates a CachedListTableModel.


CachedListTableModel

public CachedListTableModel(ListTableModel model,
                            int chunkSize,
                            int maximumCacheSize)
Creates a CachedListTableModel.


CachedListTableModel

public CachedListTableModel(ListTableModel model,
                            DefaultTableCache cache)
Creates a CachedListTableModel.

Method Detail

getTableCache

public DefaultTableCache getTableCache()
Returns the cache store that is caching the underlying list table model.

Returns:
the assigned cache store

getUncachedRows

public List getUncachedRows(int from,
                            int to)
Retrieves the rows from the table model by specifying a row interval. The following condition must be true: from >= to. The List returned must contain the row elements starting at from. However, the List may contain less elements than those specified in the range.

Specified by:
getUncachedRows in interface CacheableTableModel
Parameters:
from - the starting row
to - the ending row
Returns:
a list of objects, each element of which contains a row from the table model

getValueAt

public Object getValueAt(int row,
                         int column)
Returns tableModel.getValueAt

Specified by:
getValueAt in interface TableModel
Overrides:
getValueAt in class ListTableMap
Parameters:
row - the row whose value is to be queried
column - the column whose value is to be queried
Returns:
the value Object at the specified cell

isCountCached

public boolean isCountCached()
Determines whether the row count has been evaluated.

Specified by:
isCountCached in interface CacheableTableModel
Returns:
true if the model's row count has already been evaluated.

isRangedModel

public boolean isRangedModel()
Determines whether the cache model can fetch data in ranges.

Specified by:
isRangedModel in interface CacheableTableModel
Returns:
true if the cache model can fetch ranged data.

isValueCached

public boolean isValueCached(int row,
                             int column)
Determines whether the value at the specified cell has been evaluated.

Specified by:
isValueCached in interface CacheableTableModel
Parameters:
row - the cell's row index
column - the cell's column index
Returns:
true if the cell value at (row, column) has already been evaluated.

setTableCache

public void setTableCache(DefaultTableCache cache)
Assigns the cache store that will be used for caching the underlying list table model.

Parameters:
cache - the cache store to assign

tableChanged

public void tableChanged(TableModelEvent e)
This fine grain notification tells listeners the exact range of cells, rows, or columns that changed.

Specified by:
tableChanged in interface TableModelListener
Overrides:
tableChanged in class ListTableMap

Copyright © 2005 Scientific Applications. All Rights Reserved.