net.sf.jeppers.grid
Class DefaultGridModel

java.lang.Object
  |
  +--net.sf.jeppers.grid.AbstractGridModel
        |
        +--net.sf.jeppers.grid.DefaultGridModel
All Implemented Interfaces:
GridModel, ResizableGrid

public class DefaultGridModel
extends AbstractGridModel
implements ResizableGrid

This is an implementation of GridModel that uses a Map of cell points to the cell object values.

Author:
Cameron Zemek

Field Summary
 
Fields inherited from class net.sf.jeppers.grid.AbstractGridModel
listenerList
 
Constructor Summary
DefaultGridModel(int rows, int columns)
           
 
Method Summary
 int getColumnCount()
          Return the number of columns in the model.
 int getRowCount()
          Returns the number of rows in the model.
 Object getValueAt(int row, int column)
          Returns the value for the cell at row and column
 void insertColumns(int column, int columnCount)
          Insert columnCount columns at column.
 void insertRows(int row, int rowCount)
          Insert rowCount rows at row.
 boolean isCellEditable(int row, int column)
          Returns true if the cell at row and column is editable.
 void removeColumns(int column, int columnCount)
          Remove columnCount columns at column.
 void removeRows(int row, int rowCount)
          Remove rowCount rows at row.
 void setCellLock(boolean lock, int row, int column)
          Set whether cell at row and column can be editted.
 void setValueAt(Object value, int row, int column)
          Sets the value for the cell at row and column to value
 
Methods inherited from class net.sf.jeppers.grid.AbstractGridModel
addGridModelListener, fireGridCellUpdated, fireGridChanged, fireGridColumnsDeleted, fireGridColumnsInserted, fireGridColumnsUpdated, fireGridModelChanged, fireGridRowsDeleted, fireGridRowsInserted, fireGridRowsUpdated, getListeners, removeGridModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultGridModel

public DefaultGridModel(int rows,
                        int columns)
Method Detail

getRowCount

public int getRowCount()
Description copied from interface: GridModel
Returns the number of rows in the model.

Specified by:
getRowCount in interface GridModel
Returns:
the number of rows in the model

getColumnCount

public int getColumnCount()
Description copied from interface: GridModel
Return the number of columns in the model.

Specified by:
getColumnCount in interface GridModel
Returns:
the number of columns in the model

getValueAt

public Object getValueAt(int row,
                         int column)
Description copied from interface: GridModel
Returns the value for the cell at row and column

Specified by:
getValueAt in interface GridModel
Parameters:
row - row index of cell
column - column index of cell
Returns:
the value of the cell

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Description copied from interface: GridModel
Returns true if the cell at row and column is editable. Otherwise, setValueAt on the cell will not change the value of that cell.

Specified by:
isCellEditable in interface GridModel
Parameters:
row - row index of cell
column - column index of cell
Returns:
true if the cell is editable

setCellLock

public void setCellLock(boolean lock,
                        int row,
                        int column)
Set whether cell at row and column can be editted.

Parameters:
lock - lock flag of cell
row - row index of cell
column - column index of cell

setValueAt

public void setValueAt(Object value,
                       int row,
                       int column)
Description copied from interface: GridModel
Sets the value for the cell at row and column to value

Specified by:
setValueAt in interface GridModel
Parameters:
value - new cell value
row - row index of cell
column - column index of cell

insertRows

public void insertRows(int row,
                       int rowCount)
Description copied from interface: ResizableGrid
Insert rowCount rows at row.

Specified by:
insertRows in interface ResizableGrid
Parameters:
row - the row to insert at
rowCount - the number of rows to insert

removeRows

public void removeRows(int row,
                       int rowCount)
Description copied from interface: ResizableGrid
Remove rowCount rows at row.

Specified by:
removeRows in interface ResizableGrid
Parameters:
row - the row to remove from
rowCount - the number of rows to remove

insertColumns

public void insertColumns(int column,
                          int columnCount)
Description copied from interface: ResizableGrid
Insert columnCount columns at column.

Specified by:
insertColumns in interface ResizableGrid
Parameters:
column - the column to insert at
columnCount - the number of columns to insert

removeColumns

public void removeColumns(int column,
                          int columnCount)
Description copied from interface: ResizableGrid
Remove columnCount columns at column.

Specified by:
removeColumns in interface ResizableGrid
Parameters:
column - the column to remove from
columnCount - the number of columns to remove