net.sf.jeppers.grid
Class DefaultSpanModel

java.lang.Object
  |
  +--net.sf.jeppers.grid.AbstractSpanModel
        |
        +--net.sf.jeppers.grid.DefaultSpanModel
All Implemented Interfaces:
ResizableGrid, SpanModel

public class DefaultSpanModel
extends AbstractSpanModel
implements ResizableGrid

Default implementation of SpanModel. The implementation uses HashSet to store the cell spans. Therefore getSpanOver(int, int) has O(N) performance where N is the number of spans. isCellSpan(int, int) has O(1) performance and is used by JGrid to avoid using getSpanOver(int, int) when possible.

Author:
Cameron Zemek

Field Summary
 
Fields inherited from class net.sf.jeppers.grid.AbstractSpanModel
listenerList
 
Constructor Summary
DefaultSpanModel()
           
 
Method Summary
 void addSpan(CellSpan span)
           
 Iterator getSpanIterator()
          Return set of spans where (rowCount > 1 || columnCount > 1)
 CellSpan getSpanOver(int row, int column)
          Return the span over the cell at row, column.
 void insertColumns(int column, int columnCount)
          Insert columnCount columns at column.
 void insertRows(int row, int rowCount)
          Insert rowCount rows at row.
 boolean isCellSpan(int row, int column)
          Return true if the cell is part of a span with (rowCount > 1 || columnCount > 1)
 void removeColumns(int column, int columnCount)
          Remove columnCount columns at column.
 void removeRows(int row, int rowCount)
          Remove rowCount rows at row.
 void removeSpan(CellSpan span)
           
 
Methods inherited from class net.sf.jeppers.grid.AbstractSpanModel
addSpanModelListener, fireCellSpanAdded, fireCellSpanRemoved, fireCellSpanUpdated, fireSpanChanged, getListeners, removeSpanModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSpanModel

public DefaultSpanModel()
Method Detail

getSpanOver

public CellSpan getSpanOver(int row,
                            int column)
Description copied from interface: SpanModel
Return the span over the cell at row, column.

Specified by:
getSpanOver in interface SpanModel

isCellSpan

public boolean isCellSpan(int row,
                          int column)
Description copied from interface: SpanModel
Return true if the cell is part of a span with (rowCount > 1 || columnCount > 1)

Specified by:
isCellSpan in interface SpanModel

getSpanIterator

public Iterator getSpanIterator()
Description copied from interface: SpanModel
Return set of spans where (rowCount > 1 || columnCount > 1)

Specified by:
getSpanIterator in interface SpanModel

addSpan

public void addSpan(CellSpan span)

removeSpan

public void removeSpan(CellSpan span)

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