Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.table.span
Class DefaultSpanModel

java.lang.Object
  extended by com.citra.table.span.AbstractSpanModel
      extended by com.citra.table.span.DefaultSpanModel
All Implemented Interfaces:
SpanModel
Direct Known Subclasses:
TreeTable.DefaultTreeSpanModel, TreeTable.DefaultTreeSpanModel

public class DefaultSpanModel
extends AbstractSpanModel

DefaultSpanModel is the default implementation of the SpanModel interface. This object can dynamically store spanned cells through the DefaultSpanModel.addCellSpan(com.citra.table.span.CellSpan) and DefaultSpanModel.removeCellSpan(int, int) methods.

If a regular cell span pattern is expected on your data table, it is better to return the cell span by overriding the DefaultSpanModel.getCellSpanAt(int, int) method.
e.g. for producing an all-column cell span every three rows:

public CellSpan getCellSpanAt(int row, int column) {
if (rowIndex % 3 == 0) {
return cs = new CellSpan(row, 0, 0, CellSpan.ALL_COLUMNS);
}
return super.getCellSpanAt(row, column);
}


Field Summary
 
Fields inherited from class com.citra.table.span.AbstractSpanModel
listenerList
 
Constructor Summary
DefaultSpanModel()
          Constructs a DefaultSpanModel.
 
Method Summary
 void addCellSpan(CellSpan cellSpan)
          Adds a cell span.
 CellSpan getCellSpanAt(int row, int column)
          Returns the cell span for the cell at row and column.
 void removeAllCellSpans()
          Removes all cell spans from the model.
 void removeCellSpan(CellSpan cellSpan)
          Removes a cell span.
 void removeCellSpan(int row, int column)
          Removes the cell span at (row, column).
 
Methods inherited from class com.citra.table.span.AbstractSpanModel
addSpanModelListener, fireSpanCellDeleted, fireSpanCellInserted, fireSpanCellsUpdated, fireSpanChanged, fireSpanDataChanged, removeSpanModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSpanModel

public DefaultSpanModel()
Constructs a DefaultSpanModel.

Method Detail

addCellSpan

public void addCellSpan(CellSpan cellSpan)
Adds a cell span. All cells under the area that this cellSpan defines are affected.

Parameters:
cellSpan - the cell span to add.

getCellSpanAt

public CellSpan getCellSpanAt(int row,
                              int column)
Returns the cell span for the cell at row and column.

Parameters:
row - the row whose value is to be looked up
column - the column whose value is to be looked up
Returns:
the cell's span

removeAllCellSpans

public void removeAllCellSpans()
Removes all cell spans from the model.


removeCellSpan

public void removeCellSpan(int row,
                           int column)
Removes the cell span at (row, column).

Parameters:
row - the index of the cell's row
column - the index of the cell's column

removeCellSpan

public void removeCellSpan(CellSpan cellSpan)
Removes a cell span. All cells under the area that this cellSpan defines are affected.

Parameters:
cellSpan - the cell span to remove.

Copyright © 2011 Citra Technologies. All Rights Reserved.