com.eliad.model
Class AbstractGridModel

java.lang.Object
  |
  +--com.eliad.model.AbstractGenericModel
        |
        +--com.eliad.model.AbstractGridModel
Direct Known Subclasses:
DefaultHeaderModel, GenericGridModel

public abstract class AbstractGridModel
extends com.eliad.model.AbstractGenericModel
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);
  

Version:
1.0 04/08/00
Author:
Patrick Mérissert-Coffinières
See Also:
Serialized Form

Fields inherited from class com.eliad.model.AbstractGenericModel
listeners_
 
Constructor Summary
AbstractGridModel()
           
 
Method Summary
 void addGridModelListener(GridModelListener l)
          Adds a listener to the list that's notified each time a change to the data model occurs.
 void fireGridCellsChanged(int firstRow, int firstColumn, int rowCount, int columnCount)
          Forwards a "data changed" notification event to all GridModelListeners that are registered for this grid model.
 void fireGridColumnsChanged(int firstColumn, int columnCount)
          Forwards a "data changed" notification event to all GridModelListeners that registered themselves as listeners for this grid model.
 void fireGridColumnsDeleted(int firstColumn, int columnCount)
          Forwards a columns removed notification event to all GridModelListeners that registered themselves as listeners for this grid model.
 void fireGridColumnsInserted(int firstColumn, int columnCount)
          Forwards a columns added notification event to all GridModelListeners that registered themselves as listeners for this grid model.
 void fireGridModelChanged()
          Forwards a "structure totally changed" notification event to all GridModelListeners that registered themselves as listeners for this grid model.
 void fireGridRowsChanged(int firstRow, int rowCount)
          Forwards a "data changed" notification event to all GridModelListeners that are registered for this grid model.
 void fireGridRowsDeleted(int firstRow, int rowCount)
          Forwards a rows removed notification event to all GridModelListeners that registered themselves as listeners for this grid model.
 void fireGridRowsInserted(int firstRow, int rowCount)
          Forwards a rows added notification event to all GridModelListeners that registered themselves as listeners for this grid model.
 void fireGridStructureChanged(int type, int first, int count)
          Forwards a "structure incrementally changed" notification event to all GridModelListeners that registered themselves as listeners for this grid model.
 boolean isCellEditable(int row, int column)
          Returns whether the cell at row and column is editable.
protected  void propagateDataChange(GridModelEvent e)
           
protected  void propagateModelChange(GridModelEvent e)
           
protected  void propagateStructureChange(GridModelEvent e)
           
 void removeGridModelListener(GridModelListener l)
          Removes a listener from the list that's notified each time a change to the data model occurs.
 void setValueAt(java.lang.Object aValue, int row, int column)
          Sets the value in the cell at column and row to aValue.
 
Methods inherited from class com.eliad.model.AbstractGenericModel
getListenerCount, getListeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractGridModel

public AbstractGridModel()
Method Detail

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Returns whether the cell at row and column is editable. The default implementation for all cells is false.
Specified by:
isCellEditable in interface GridModel
Parameters:
row - the row being queried
column - the column being queried
Returns:
false

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int row,
                       int column)
Sets the value in the cell at column and row to aValue. This empty implementation is provided so developpers don't have to implement this method if their data model is not editable.
Specified by:
setValueAt in interface GridModel
Parameters:
aValue - value to assign to cell
row - row of cell
column - column of cell

addGridModelListener

public void addGridModelListener(GridModelListener l)
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:
l - the GridModelListener

removeGridModelListener

public void removeGridModelListener(GridModelListener l)
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:
l - the GridModelListener

propagateDataChange

protected void propagateDataChange(GridModelEvent e)

propagateModelChange

protected void propagateModelChange(GridModelEvent e)

propagateStructureChange

protected void propagateStructureChange(GridModelEvent e)

fireGridCellsChanged

public void fireGridCellsChanged(int firstRow,
                                 int firstColumn,
                                 int rowCount,
                                 int columnCount)
Forwards a "data changed" notification event to all GridModelListeners that are registered for this grid model.
See Also:
addGridModelListener(com.eliad.model.GridModelListener), GridModelEvent, EventListenerList

fireGridRowsChanged

public void fireGridRowsChanged(int firstRow,
                                int rowCount)
Forwards a "data changed" notification event to all GridModelListeners that are registered for this grid model.
See Also:
addGridModelListener(com.eliad.model.GridModelListener), GridModelEvent, EventListenerList

fireGridColumnsChanged

public void fireGridColumnsChanged(int firstColumn,
                                   int columnCount)
Forwards a "data changed" notification event to all GridModelListeners that registered themselves as listeners for this grid model.
See Also:
addGridModelListener(com.eliad.model.GridModelListener), GridModelEvent, EventListenerList

fireGridStructureChanged

public void fireGridStructureChanged(int type,
                                     int first,
                                     int count)
Forwards a "structure incrementally changed" notification event to all GridModelListeners that registered themselves as listeners for this grid model.
See Also:
addGridModelListener(com.eliad.model.GridModelListener), GridModelEvent, EventListenerList

fireGridModelChanged

public void fireGridModelChanged()
Forwards a "structure totally changed" notification event to all GridModelListeners that registered themselves as listeners for this grid model.
See Also:
addGridModelListener(com.eliad.model.GridModelListener), GridModelEvent, EventListenerList

fireGridRowsInserted

public void fireGridRowsInserted(int firstRow,
                                 int rowCount)
Forwards a rows added notification event to all GridModelListeners that registered themselves as listeners for this grid model.
See Also:
addGridModelListener(com.eliad.model.GridModelListener), GridModelEvent, EventListenerList

fireGridRowsDeleted

public void fireGridRowsDeleted(int firstRow,
                                int rowCount)
Forwards a rows removed notification event to all GridModelListeners that registered themselves as listeners for this grid model.
See Also:
addGridModelListener(com.eliad.model.GridModelListener), GridModelEvent, EventListenerList

fireGridColumnsInserted

public void fireGridColumnsInserted(int firstColumn,
                                    int columnCount)
Forwards a columns added notification event to all GridModelListeners that registered themselves as listeners for this grid model.
See Also:
addGridModelListener(com.eliad.model.GridModelListener), GridModelEvent, EventListenerList

fireGridColumnsDeleted

public void fireGridColumnsDeleted(int firstColumn,
                                   int columnCount)
Forwards a columns removed notification event to all GridModelListeners that registered themselves as listeners for this grid model.
See Also:
addGridModelListener(com.eliad.model.GridModelListener), GridModelEvent, EventListenerList