Copyright © 2005 Scientific Applications. All Rights Reserved.

com.sciapp.table.remote
Class DefaultRemoteTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.sciapp.table.TableMap
          extended by com.sciapp.table.remote.DefaultRemoteTableModel
All Implemented Interfaces:
ReorderListener, RemoteTableModel, ReorderModel, Serializable, EventListener, TableModelListener, TableModel

public class DefaultRemoteTableModel
extends TableMap
implements RemoteTableModel

DefaultRemoteTableModel is the default implementation of a RemoteTableModel. This class wraps around a cacheable table model and uses an internal thread in order to asynchronously retrieve the data from the underlying model.

See Also:
Serialized Form

Field Summary
protected  CacheableTableModel cacheTableModel
          the cacheable table model to query.
protected  DefaultPendingValue pendingValue
          the default object to return when a cell value is pending.
 
Fields inherited from class com.sciapp.table.TableMap
tableModel
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
DefaultRemoteTableModel(CacheableTableModel model)
          Constructs a DefaultRemoteTableModel.
 
Method Summary
 void addRemoteTableListener(RemoteTableListener l)
          Adds a RemoteTableListener that is notified each time the RemoteTableModel will start or stop querying the underlying table model.
 void fireRemoteAction(int type)
          Notifies listeners of this RemoteTableModel's status.
 CacheableTableModel getCacheableModel()
          Returns the cacheable model.
 Object getPendingValue(int row, int column)
          Returns the object to display if a cell value is pending.
 int getRowCount()
          Returns tableModel.getRowCount
 Object getValueAt(int row, int column)
          Returns tableModel.getValueAt
 void removeRemoteTableListener(RemoteTableListener l)
          Removes a RemoteTableListener from the list that is notified each time the RemoteTableModel will start or stop querying the underlying table model.
 void setModel(TableModel model)
          Sets the underlying TableModel to newModel.
 void stop()
          Stops the thread that asynchronously queries the underlying cacheable table model.
 
Methods inherited from class com.sciapp.table.TableMap
addReorderListener, fireRowsMapped, fireRowsReordered, getColumnClass, getColumnCount, getColumnName, getModel, isCellEditable, removeReorderListener, rowsReordered, setValueAt, tableChanged
 
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, isCellEditable, removeTableModelListener, setValueAt
 

Field Detail

cacheTableModel

protected CacheableTableModel cacheTableModel
the cacheable table model to query.


pendingValue

protected DefaultPendingValue pendingValue
the default object to return when a cell value is pending.

Constructor Detail

DefaultRemoteTableModel

public DefaultRemoteTableModel(CacheableTableModel model)
Constructs a DefaultRemoteTableModel.

Method Detail

addRemoteTableListener

public void addRemoteTableListener(RemoteTableListener l)
Adds a RemoteTableListener that is notified each time the RemoteTableModel will start or stop querying the underlying table model.

Specified by:
addRemoteTableListener in interface RemoteTableModel
Parameters:
l - the RemoteTableListener to add

fireRemoteAction

public void fireRemoteAction(int type)
Notifies listeners of this RemoteTableModel's status.

Parameters:
type - the type of the event - either STARTED or STOPPED.

getCacheableModel

public CacheableTableModel getCacheableModel()
Returns the cacheable model.

Returns:
the cacheable model

getPendingValue

public Object getPendingValue(int row,
                              int column)
Returns the object to display if a cell value is pending.

Specified by:
getPendingValue in interface RemoteTableModel
Parameters:
row - the cell's row index
column - the cell's column index
Returns:
the pending value

getRowCount

public int getRowCount()
Returns tableModel.getRowCount

Specified by:
getRowCount in interface TableModel
Overrides:
getRowCount in class TableMap
Returns:
the number of rows in the model
See Also:
TableModel.getColumnCount()

getValueAt

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

Specified by:
getValueAt in interface TableModel
Overrides:
getValueAt in class TableMap
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

removeRemoteTableListener

public void removeRemoteTableListener(RemoteTableListener l)
Removes a RemoteTableListener from the list that is notified each time the RemoteTableModel will start or stop querying the underlying table model.

Specified by:
removeRemoteTableListener in interface RemoteTableModel
Parameters:
l - the RemoteTableListener to remove

setModel

public void setModel(TableModel model)
Sets the underlying TableModel to newModel.

Overrides:
setModel in class TableMap
Parameters:
model - the new TableModel to assign.

stop

public void stop()
Stops the thread that asynchronously queries the underlying cacheable table model.


Copyright © 2005 Scientific Applications. All Rights Reserved.