SalesPoint Framework v3.0

data.swing
Class StoringStockTableModel

java.lang.Object
  |
  +--javax.swing.table.AbstractTableModel
        |
        +--util.swing.AbstractTableModel
              |
              +--data.swing.StoringStockTableModel

public class StoringStockTableModel
extends AbstractTableModel
implements HelpableListener, StockChangeListener, Serializable

A TableModel that models the contents of a Stock, representing each StockItem as an individual record.

Since:
v2.0
Version:
2.0 23/08/1999
Author:
Steffen Zschaler
See Also:
Serialized Form

Field Summary
protected  Comparator m_cmpComparator
          The Comparator that defines the sorting order of records in the model.
protected  DataBasket m_dbBasket
          The DataBasket used to determine visibility.
protected  List m_lItems
          The internal model.
protected  Stock m_stModel
          The Stock that is being modelled.
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
StoringStockTableModel(Stock st, DataBasket db, Comparator cmp, TableEntryDescriptor ted)
          Create a new StoringStockTableModel.
 
Method Summary
 void addedStockItems(StockChangeEvent e)
          Update the internal model and inform any listeners according to the received event.
 void canEditStockItems(StockChangeEvent e)
          Update the internal model and inform any listeners according to the received event.
 void canRemoveStockItems(StockChangeEvent e)
          Update the internal model and inform any listeners according to the received event.
protected  void checkAdd(StockChangeEvent e)
          Internal helper method.
protected  void checkRemove(StockChangeEvent e)
          Internal helper method.
protected  void checkUpdate(StockChangeEvent e)
          Internal helper method.
 void commitAddStockItems(StockChangeEvent e)
          Update the internal model and inform any listeners according to the received event.
 void commitEditStockItems(StockChangeEvent e)
          Update the internal model and inform any listeners according to the received event.
 void commitRemoveStockItems(StockChangeEvent e)
          Update the internal model and inform any listeners according to the received event.
 void editingStockItems(StockChangeEvent e)
          Update the internal model and inform any listeners according to the received event.
 Object getRecord(int row)
          Get the record at the given index.
 int getRowCount()
          Get the number of records in this model.
 void noEditStockItems(StockChangeEvent e)
          Update the internal model and inform any listeners according to the received event.
 void noRemoveStockItems(StockChangeEvent e)
          Update the internal model and inform any listeners according to the received event.
 void removedStockItems(StockChangeEvent e)
          Update the internal model and inform any listeners according to the received event.
 void rollbackAddStockItems(StockChangeEvent e)
          Update the internal model and inform any listeners according to the received event.
 void rollbackEditStockItems(StockChangeEvent e)
          Update the internal model and inform any listeners according to the received event.
 void rollbackRemoveStockItems(StockChangeEvent e)
          Update the internal model and inform any listeners according to the received event.
 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 Stock.
 
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, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_stModel

protected Stock m_stModel
The Stock that is being modelled.

m_dbBasket

protected DataBasket m_dbBasket
The DataBasket used to determine visibility.

m_cmpComparator

protected Comparator m_cmpComparator
The Comparator that defines the sorting order of records in the model. It compares StockItems.

m_lItems

protected List m_lItems
The internal model. A list of StockItems.
Constructor Detail

StoringStockTableModel

public StoringStockTableModel(Stock st,
                              DataBasket db,
                              Comparator cmp,
                              TableEntryDescriptor ted)
Create a new StoringStockTableModel.
Parameters:
st - the Stock to be modelled.
db - the DataBasket to be used to determine visibility.
cmp - a Comparator defining the sort order of the records. If null, records are ordered according to the natural ordering of the StockItems.
ted - a TableEntryDescriptor that can split individual StockItems into a table's cells.
Method Detail

getRecord

public Object getRecord(int row)
Get the record at the given index.
Override:
Never.
Parameters:
row - the index for which to retrieve the record. Element of [0, getRowCount()).
Returns:
the StockItem to be displayed at the given index. May return null if there is no record at the indicated position.
Overrides:
getRecord in class AbstractTableModel

getRowCount

public int getRowCount()
Get the number of records in this model.
Override:
Never.
Overrides:
getRowCount in class AbstractTableModel

subscribe

public void subscribe()
Subscribe as a listener to the model. If the modelled Stock is a ListenableStock, subscribe as a listener.
Override:
Never.
Specified by:
subscribe in interface HelpableListener

unsubscribe

public void unsubscribe()
Un-Subscribe as a listener from the model. If the modelled Stock is a ListenableStock, un-subscribe as a listener.
Override:
Never.
Specified by:
unsubscribe in interface HelpableListener

updateModel

public void updateModel()
Update the internal model based on the modelled Stock.
Override:
Never.
Specified by:
updateModel in interface HelpableListener

addedStockItems

public void addedStockItems(StockChangeEvent e)
Update the internal model and inform any listeners according to the received event.

This method is public as an implementation detail and must not be called directly.

Override:
Never.
Specified by:
addedStockItems in interface StockChangeListener

commitAddStockItems

public void commitAddStockItems(StockChangeEvent e)
Update the internal model and inform any listeners according to the received event.

This method is public as an implementation detail and must not be called directly.

Override:
Never.
Specified by:
commitAddStockItems in interface StockChangeListener

rollbackAddStockItems

public void rollbackAddStockItems(StockChangeEvent e)
Update the internal model and inform any listeners according to the received event.

This method is public as an implementation detail and must not be called directly.

Override:
Never.
Specified by:
rollbackAddStockItems in interface StockChangeListener

canRemoveStockItems

public void canRemoveStockItems(StockChangeEvent e)
                         throws VetoException
Update the internal model and inform any listeners according to the received event.

This method is public as an implementation detail and must not be called directly.

Override:
Never.
Specified by:
canRemoveStockItems in interface StockChangeListener

noRemoveStockItems

public void noRemoveStockItems(StockChangeEvent e)
Update the internal model and inform any listeners according to the received event.

This method is public as an implementation detail and must not be called directly.

Override:
Never.
Specified by:
noRemoveStockItems in interface StockChangeListener

removedStockItems

public void removedStockItems(StockChangeEvent e)
Update the internal model and inform any listeners according to the received event.

This method is public as an implementation detail and must not be called directly.

Override:
Never.
Specified by:
removedStockItems in interface StockChangeListener

commitRemoveStockItems

public void commitRemoveStockItems(StockChangeEvent e)
Update the internal model and inform any listeners according to the received event.

This method is public as an implementation detail and must not be called directly.

Override:
Never.
Specified by:
commitRemoveStockItems in interface StockChangeListener

rollbackRemoveStockItems

public void rollbackRemoveStockItems(StockChangeEvent e)
Update the internal model and inform any listeners according to the received event.

This method is public as an implementation detail and must not be called directly.

Override:
Never.
Specified by:
rollbackRemoveStockItems in interface StockChangeListener

canEditStockItems

public void canEditStockItems(StockChangeEvent e)
                       throws VetoException
Update the internal model and inform any listeners according to the received event.

This method is public as an implementation detail and must not be called directly.

Override:
Never.
Specified by:
canEditStockItems in interface StockChangeListener

noEditStockItems

public void noEditStockItems(StockChangeEvent e)
Update the internal model and inform any listeners according to the received event.

This method is public as an implementation detail and must not be called directly.

Override:
Never.
Specified by:
noEditStockItems in interface StockChangeListener

editingStockItems

public void editingStockItems(StockChangeEvent e)
Update the internal model and inform any listeners according to the received event.

This method is public as an implementation detail and must not be called directly.

Override:
Never.
Specified by:
editingStockItems in interface StockChangeListener

commitEditStockItems

public void commitEditStockItems(StockChangeEvent e)
Update the internal model and inform any listeners according to the received event.

This method is public as an implementation detail and must not be called directly.

Override:
Never.
Specified by:
commitEditStockItems in interface StockChangeListener

rollbackEditStockItems

public void rollbackEditStockItems(StockChangeEvent e)
Update the internal model and inform any listeners according to the received event.

This method is public as an implementation detail and must not be called directly.

Override:
Never.
Specified by:
rollbackEditStockItems in interface StockChangeListener

checkAdd

protected void checkAdd(StockChangeEvent e)
Internal helper method. Check where, if at all, the indicated StockItems have been added with respect to the internal model.
Override:
Never.

checkRemove

protected void checkRemove(StockChangeEvent e)
Internal helper method. Check from where, if at all, the indicated StockItems have been removed with respect to the internal model.
Override:
Never.

checkUpdate

protected void checkUpdate(StockChangeEvent e)
Internal helper method. Check for an update in the indicated StockItems.
Override:
Never.

SalesPoint Framework v3.0