net.sf.jeppers.grid
Class AbstractGridModel

java.lang.Object
  |
  +--net.sf.jeppers.grid.AbstractGridModel
All Implemented Interfaces:
GridModel
Direct Known Subclasses:
DefaultGridModel

public abstract class AbstractGridModel
extends Object
implements GridModel

This abstract class provides default implementations for most of the methods in the GridModel interface. It takes care of the management of listeners and provides some conveniences for generating GridModelEvents and dispatching them to the listeners. To create a concrete GridModel as a subclass of AbstractGridModel you need only provide implementations for the following three methods:

 public int getRowCount();
 public int getColumnCount();
 public Object getValueAt(int row, int column);
 

Author:
Cameron Zemek

Field Summary
protected  EventListenerList listenerList
          List of event listeners
 
Constructor Summary
AbstractGridModel()
           
 
Method Summary
 void addGridModelListener(GridModelListener listener)
          Adds a listener to the list that's notified each time a change to the data model occurs.
 void fireGridCellUpdated(int row, int column)
          Notifies all GridModelListeners that registered themselves as listeners for this GridModel that the cell at row and column has been updated
 void fireGridChanged(GridModelEvent e)
          Forwards the given notification event to all GridModelListeners that registered themselves as listeners for this GridModel.
 void fireGridColumnsDeleted(int firstColumn, int lastColumn)
          Notifies all GridModelListeners that registered themselves as listeners for this GridModel that the columns in the range [firstColumn, lastColumn], inclusive, have been deleted.
 void fireGridColumnsInserted(int firstColumn, int lastColumn)
          Notifies all GridModelListeners that registered themselves as listeners for this GridModel that the columns in the range [firstColumn, lastColumn], inclusive, have been inserted.
 void fireGridColumnsUpdated(int firstColumn, int lastColumn)
          Notifies all GridModelListeners that registered themselves as listeners for this GridModel that the columns in the range [firstColumn, lastColumn], inclusive, have been inserted.
 void fireGridModelChanged()
          Notifies all GridModelListeners that registered themselves as listeners for this GridModel that the entire model has changed
 void fireGridRowsDeleted(int firstRow, int lastRow)
          Notifies all GridModelListeners that registered themselves as listeners for this GridModel that the rows in the range [firstRow, lastRow], inclusive, have been deleted.
 void fireGridRowsInserted(int firstRow, int lastRow)
          Notifies all GridModelListeners that registered themselves as listeners for this GridModel that the rows in the range [firstRow, lastRow], inclusive, have been inserted.
 void fireGridRowsUpdated(int firstRow, int lastRow)
          Notifies all GridModelListeners that registered themselves as listeners for this GridModel that the rows in the range [firstRow, lastRow], inclusive, have been updated.
 EventListener[] getListeners(Class listenerType)
          Returns an array of all the listeners of the given type that were added to this model.
 void removeGridModelListener(GridModelListener listener)
          Removes a listener from the list that's notified each time a change to the data model occurs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.jeppers.grid.GridModel
getColumnCount, getRowCount, getValueAt, isCellEditable, setValueAt
 

Field Detail

listenerList

protected EventListenerList listenerList
List of event listeners

Constructor Detail

AbstractGridModel

public AbstractGridModel()
Method Detail

addGridModelListener

public void addGridModelListener(GridModelListener listener)
Description copied from interface: GridModel
Adds a listener to the list that's notified each time a change to the data model occurs.

Specified by:
addGridModelListener in interface GridModel
Parameters:
listener - the GridModelListener to add

removeGridModelListener

public void removeGridModelListener(GridModelListener listener)
Description copied from interface: GridModel
Removes a listener from the list that's notified each time a change to the data model occurs.

Specified by:
removeGridModelListener in interface GridModel
Parameters:
listener - the GridModelListener to remove

getListeners

public EventListener[] getListeners(Class listenerType)
Returns an array of all the listeners of the given type that were added to this model.

Returns:
all of the objects receiving listenerType notifications from this model

fireGridChanged

public void fireGridChanged(GridModelEvent e)
Forwards the given notification event to all GridModelListeners that registered themselves as listeners for this GridModel.

Parameters:
e - the event to be forwarded
See Also:
addGridModelListener(net.sf.jeppers.grid.GridModelListener), GridModelEvent, EventListenerList

fireGridCellUpdated

public void fireGridCellUpdated(int row,
                                int column)
Notifies all GridModelListeners that registered themselves as listeners for this GridModel that the cell at row and column has been updated


fireGridRowsInserted

public void fireGridRowsInserted(int firstRow,
                                 int lastRow)
Notifies all GridModelListeners that registered themselves as listeners for this GridModel that the rows in the range [firstRow, lastRow], inclusive, have been inserted.


fireGridRowsUpdated

public void fireGridRowsUpdated(int firstRow,
                                int lastRow)
Notifies all GridModelListeners that registered themselves as listeners for this GridModel that the rows in the range [firstRow, lastRow], inclusive, have been updated.


fireGridRowsDeleted

public void fireGridRowsDeleted(int firstRow,
                                int lastRow)
Notifies all GridModelListeners that registered themselves as listeners for this GridModel that the rows in the range [firstRow, lastRow], inclusive, have been deleted.


fireGridColumnsInserted

public void fireGridColumnsInserted(int firstColumn,
                                    int lastColumn)
Notifies all GridModelListeners that registered themselves as listeners for this GridModel that the columns in the range [firstColumn, lastColumn], inclusive, have been inserted.


fireGridColumnsUpdated

public void fireGridColumnsUpdated(int firstColumn,
                                   int lastColumn)
Notifies all GridModelListeners that registered themselves as listeners for this GridModel that the columns in the range [firstColumn, lastColumn], inclusive, have been inserted.


fireGridColumnsDeleted

public void fireGridColumnsDeleted(int firstColumn,
                                   int lastColumn)
Notifies all GridModelListeners that registered themselves as listeners for this GridModel that the columns in the range [firstColumn, lastColumn], inclusive, have been deleted.


fireGridModelChanged

public void fireGridModelChanged()
Notifies all GridModelListeners that registered themselves as listeners for this GridModel that the entire model has changed