com.eliad.model
Interface GridModel

All Known Implementing Classes:
AbstractGridModel

public interface GridModel

In terms of the javax.swing.table.TableModel, this is the description of a data model suitable for a symmetrical grid. This describes a rectangular array of cells, without per-column or per-row hypothesis. This is a source of GridModelEvents.

Version:
1.0 04/08/00
Author:
Patrick Mérissert-Coffinières
See Also:
GridModelEvent, GridModelListener

Method Summary
 void addGridModelListener(GridModelListener l)
          Adds a listener to the list that's notified each time a change to the data model occurs.
 int getColumnCount()
          Returns the number of columns in the model.
 int getRowCount()
          Returns the number of rows in the model.
 java.lang.Object getValueAt(int row, int column)
          Returns the value for the cell at column and row.
 boolean isCellEditable(int row, int column)
          Returns whether the cell at row and column is editable.
 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.
 

Method Detail

getRowCount

public int getRowCount()
Returns the number of rows in the model. A Grid uses this method to determine how many rows it should create and display. This method should be quick, as it is called frequently during rendering.
Returns:
the number of rows in the model
See Also:
getColumnCount()

getColumnCount

public int getColumnCount()
Returns the number of columns in the model. A Grid uses this method to determine how many columns it should create and display. This method should be quick, as it is called frequently during rendering.
Returns:
the number of columns in the model
See Also:
getRowCount()

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Returns whether the cell at row and column is editable. Otherwise, setValueAt on the cell will not change the value of that cell.
Parameters:
row - the row whose value is to be queried
column - the column whose value is to be queried
Returns:
true if the cell is editable
Preconditions:
row >= 0 && row < getRowCount() && column >= 0 && column < getColumnCount()
See Also:
setValueAt(java.lang.Object, int, int)

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
Returns the value for the cell at column and row.
Parameters:
row - the row whose value is to be queried
column - the column whose value is to be queried
Returns:
the value Object at the specified cell
Preconditions:
row >= 0 && row < getRowCount() && column >= 0 && column < getColumnCount()

setValueAt

public void setValueAt(java.lang.Object aValue,
                       int row,
                       int column)
Sets the value in the cell at column and row to aValue.
Parameters:
aValue - the new value
row - the row whose value is to be changed
column - the column whose value is to be changed
Preconditions:
row >= 0 && row < getRowCount() && column >= 0 && column < getColumnCount() && isCellEditable(row, column)
See Also:
getValueAt(int, int), isCellEditable(int, int)

addGridModelListener

public void addGridModelListener(GridModelListener l)
Adds a listener to the list that's notified each time a change to the data model occurs. This is part of the GridModelEventSource contract, and should respect an obvious relation with the removeXXX function. An implementation class is of course responsible for the firing of events, but the fireGridModelEvent methods may be private.
Parameters:
l - the GridModelListener
See Also:
GridModelEvent, 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. This is part of the GridModelEventSource contract, and should respect an obvious relation with the addXXX function. An implementation class is of course responsible for the firing of events, but the fireGridModelEvent methods may be private.
Parameters:
l - the GridModelListener
See Also:
GridModelEvent, GridModelListener