SalesPoint v3.3 API

users.swing
Class UserTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by util.swing.AbstractTableModel
          extended by users.swing.UserTableModel
All Implemented Interfaces:
Serializable, EventListener, TableModel, UserDataListener, HelpableListener

public class UserTableModel
extends AbstractTableModel
implements UserDataListener, HelpableListener, Serializable

A TableModel that models the contents of a UserManager.

Since:
v3.0
Author:
Thomas Medack
See Also:
Serialized Form

Nested Class Summary
static class UserTableModel.UserComparator
          This abstract class is a special Comparator, which compares Users.
 
Field Summary
protected  Comparator<User> m_cmpComparator
          The Comparator that defines the sorting order of records in the model.
protected  List<User> m_lKeys
          The internal model.
protected  UserManager m_umManager
          The UserManager that is being modelled.
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
UserTableModel(UserManager u, Comparator<User> cmp, TableEntryDescriptor ted)
          Create a new UserTableModel.
 
Method Summary
 Object getRecord(int row)
          Get the record at the given index.
 int getRowCount()
          Get the number of records in this model.
 void setData(Object n_umManager)
          Set the table's data.
 void subscribe()
          Subscribe as a listener to the model.
 void unsubscribe()
          Un-Subscribe as a listener from the model.
 void updateModel()
          Update the internal model based on the modelled UserManager.
 void userAdded(UserDataEvent e)
          Called whenever a user was added to the source.
 void userDeleted(UserDataEvent e)
          Called whenever a user was deleted from the source.
 
Methods inherited from class util.swing.AbstractTableModel
getColumnClass, getColumnCount, getColumnName, getEntryDescriptor, getValueAt, isCellEditable, orderByColumn, reOrderBy, 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
 

Field Detail

m_umManager

protected UserManager m_umManager
The UserManager that is being modelled.


m_cmpComparator

protected Comparator<User> m_cmpComparator
The Comparator that defines the sorting order of records in the model. It compares Users.


m_lKeys

protected List<User> m_lKeys
The internal model. A list of the Users' names.

Constructor Detail

UserTableModel

public UserTableModel(UserManager u,
                      Comparator<User> cmp,
                      TableEntryDescriptor ted)
Create a new UserTableModel.

Parameters:
u - the UserManager to be modelled.
cmp - a Comparator defining the sort order of the records. If null, records are ordered according to the natural ordering of the Users.
ted - a TableEntryDescriptor that can split individual Users into a table's cells.
Method Detail

setData

public void setData(Object n_umManager)
Set the table's data. Data is UserManager

Specified by:
setData in class AbstractTableModel
Parameters:
n_umManager - the new data

getRecord

public Object getRecord(int row)
Get the record at the given index.

Specified by:
getRecord in class AbstractTableModel
Parameters:
row - the index for which to retrieve the record. Element of [0, getRowCount()).
Returns:
the User to be displayed at the given index. May return null if either there is no record at the indicated position or an exception occurs.
Override:
Never

getRowCount

public int getRowCount()
Get the number of records in this model.

Specified by:
getRowCount in interface TableModel
Override:
Never

subscribe

public void subscribe()
Subscribe as a listener to the model.

Specified by:
subscribe in interface HelpableListener
Override:
Never

unsubscribe

public void unsubscribe()
Un-Subscribe as a listener from the model.

Specified by:
unsubscribe in interface HelpableListener
Override:
Never

updateModel

public void updateModel()
Update the internal model based on the modelled UserManager.

Specified by:
updateModel in interface HelpableListener
Override:
Never

userAdded

public void userAdded(UserDataEvent e)
Description copied from interface: UserDataListener
Called whenever a user was added to the source. The new user will be contained in the event object.

Specified by:
userAdded in interface UserDataListener
Parameters:
e - the event object describing the event.

userDeleted

public void userDeleted(UserDataEvent e)
Description copied from interface: UserDataListener
Called whenever a user was deleted from the source. The deleted user will be contained in the event object.

Specified by:
userDeleted in interface UserDataListener
Parameters:
e - the event object describing the event.

SalesPoint v3.3 API