de.kosi.util
Class AbstractDistributedListTableModel

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--de.kosi.util.AbstractDistributedListTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel
Direct Known Subclasses:
TableDistributedTableModel, TournamentDistributedTableModel

public abstract class AbstractDistributedListTableModel
extends javax.swing.table.AbstractTableModel

This class implements a TableModel on top of a DistributedList. The rows are the items in the list. The columns are in most cases fields of the items, but can be dtermined by the concrete implementations of the AbstractDistributedListTableModel.
The AbstractDistributedListTableModel caches values from the items in the list, so using it should save some bandwidth. The data of items is only loaded in the list, when it is requested. This way only data is loaded, that is really needed. Upon the first call INVALID_OBJECT is returned. After the requested Object is cached, an update event is fired, so the new values can be displayed.
The TableModel may be disconnected from the distributed list, when there is no need to update it. After reconnecting the new entries are fetched.

ChangeLog:

 $Log: AbstractDistributedListTableModel.java,v $
 Revision 1.6  2001/08/02 11:58:40  jiriki
 Worked on tournament

 Revision 1.5  2001/07/31 13:00:27  jiriki
 Worked on Tournament

 Revision 1.4  2001/07/26 09:06:20  tanni
 protokolle
 view user angefangen

 Revision 1.3  2001/07/20 13:01:41  jiriki
 Start of BugFixing

 Revision 1.2  2001/06/04 14:21:10  jiriki
 Made source more comliant to coding guidelines.

 Revision 1.1.1.1  2001/04/29 18:05:19  jiriki
 Imported sources from zola.

 Revision 1.10  2001/04/11 17:40:49  wombat
 Updated Documentation.

 Revision 1.9  2001/04/11 16:54:04  wombat
 Removed some bugs when joining table and immidiatly leaving again.

 Revision 1.8  2001/04/11 12:34:32  wombat
 jar files restructured.

 Revision 1.7  2001/03/01 21:28:14  wombat
 Updated TestClient
 Resolved some bugs

 Revision 1.6  2001/02/25 23:16:05  wombat
 - deadlock vermeidung umgestellt.
 - ListenerList erstellt

 Revision 1.5  2001/02/19 23:21:16  wombat
 Added SSL Support, Implement DistributedListFilter

 Revision 1.4  2001/02/02 10:59:15  wombat
 Updated Documentationm

 

Version:
$Revision: 1.6 $ ($Date: 2001/08/02 11:58:40 $)
Author:
Jan-Ole Janssen, Niklas Mehner, Tante Sticher
See Also:
Serialized Form

Inner Class Summary
protected static interface AbstractDistributedListTableModel.ListEntry
          Interface for an entry in the list.
 
Field Summary
static java.lang.Object INVALID_OBJECT
          Value that is returned, when there are no cached values.
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
AbstractDistributedListTableModel(DistributedList list, DistributedListFilter filter)
          Creates a new TableModel.
 
Method Summary
 void connect()
          Connects to the list.
protected abstract  AbstractDistributedListTableModel.ListEntry createListEntry(java.lang.Object obj)
          Creates a new entry for the list.
 void disconnect()
          Disconnects from the list.
protected  void dispatchEvent(DistributedListEvent event)
          Dispatches an event received from the Distributed List
abstract  int getColumnCount()
          Returns the number of columns of this model.
 java.lang.String getColumnName(int column)
           
protected  java.util.List getEntries()
          Returns the entries of this list.
 int getRowCount()
          Returns the number of rows.
 java.lang.Object getValueAt(int row, int column)
          Returns a value in the model.
 boolean isConnected()
          Returns the connection status.
protected  void setColumnName(int column, java.lang.String name)
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INVALID_OBJECT

public static final java.lang.Object INVALID_OBJECT
Value that is returned, when there are no cached values.
Constructor Detail

AbstractDistributedListTableModel

public AbstractDistributedListTableModel(DistributedList list,
                                         DistributedListFilter filter)
                                  throws java.rmi.RemoteException,
                                         InvalidSessionException
Creates a new TableModel.
Parameters:
list - list this TableModel is based on.
filter - filter for this tablemodel.
Throws:
java.rmi.RemoteException - if the remote call fails.
InvalidSessionException - when not called from within a valid session context.
Method Detail

connect

public void connect()
             throws java.rmi.RemoteException,
                    InvalidSessionException
Connects to the list.
Throws:
java.rmi.RemoteException - if the remote call fails.
InvalidSessionException - when not called from within a valid session context.

getColumnName

public java.lang.String getColumnName(int column)
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel

setColumnName

protected void setColumnName(int column,
                             java.lang.String name)

disconnect

public void disconnect()
                throws java.rmi.RemoteException
Disconnects from the list.
Throws:
java.rmi.RemoteException - if the remote call fails.

isConnected

public boolean isConnected()
Returns the connection status.
Returns:
wether currently connected to the DistributedList.

getEntries

protected java.util.List getEntries()
Returns the entries of this list.
Returns:
entries of this list.

createListEntry

protected abstract AbstractDistributedListTableModel.ListEntry createListEntry(java.lang.Object obj)
Creates a new entry for the list. This method has to be overriden by all implementations.
Parameters:
obj - object a entry is created for.
Returns:
ListEntry that wqas created.

getColumnCount

public abstract int getColumnCount()
Returns the number of columns of this model. This method has to be overriden by all implementations.
Overrides:
getColumnCount in class javax.swing.table.AbstractTableModel
Returns:
number of columns.

getRowCount

public int getRowCount()
Returns the number of rows.
Overrides:
getRowCount in class javax.swing.table.AbstractTableModel
Returns:
rowcount.

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
Returns a value in the model.
Overrides:
getValueAt in class javax.swing.table.AbstractTableModel
Parameters:
row - Row a value is returned for.
column - Column a value is returned for.
Returns:
value at that row, column.

dispatchEvent

protected void dispatchEvent(DistributedListEvent event)
Dispatches an event received from the Distributed List
Parameters:
event - event to dispatch.