JIDE 3.5.15

com.jidesoft.pivot
Class CornerTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.jidesoft.pivot.CornerTableModel
All Implemented Interfaces:
SpanModel, StyleModel, Serializable, TableModel

public class CornerTableModel
extends AbstractTableModel
implements SpanModel, StyleModel

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
CornerTableModel(IPivotDataModel pivotDataModel)
           
 
Method Summary
 CellSpan getCellSpanAt(int rowIndex, int columnIndex)
          Gets the cell span at the specified row and column.
 CellStyle getCellStyleAt(int rowIndex, int columnIndex)
          Gets the cell style at the specified cell.
 int getColumnCount()
           
 PivotField getFieldAt(int rowIndex, int columnIndex)
          Gets the pivot field associated with the cell.
 IPivotDataModel getPivotDataModel()
          Gets the PivotDataModel.
 int getRowCount()
           
 Object getValueAt(int rowIndex, int columnIndex)
           
 boolean isCellSpanOn()
          Checks if the span is on.
 boolean isCellStyleOn()
          Checks if the style is on.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CornerTableModel

public CornerTableModel(IPivotDataModel pivotDataModel)
Method Detail

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface TableModel

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface TableModel

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)
Specified by:
getValueAt in interface TableModel

getCellSpanAt

public CellSpan getCellSpanAt(int rowIndex,
                              int columnIndex)
Description copied from interface: SpanModel
Gets the cell span at the specified row and column. To avoid creating many instances of CellSpan, you can return the same instance by changing its values only. For example, the code below is a good example.

 private final CellSpan span = new CellSpan(0,0,1,1);
 public CellSpan getCellSpanAt(int row, int col) {
     span.setRow(...);
     span.setColumn(...);
     span.setRowSpan(...);
     span.setColumnSpan(...);
     return span;
 }
 
For performance consideration, if the cell span has 1 row span and 1 column span, it is better to return null instead of new CellSpan(row, column, 1, 1).

Specified by:
getCellSpanAt in interface SpanModel
Parameters:
rowIndex - the row index.
columnIndex - the column index.
Returns:
CellSpan object.

isCellSpanOn

public boolean isCellSpanOn()
Description copied from interface: SpanModel
Checks if the span is on. The CellSpanTable will ignore all the CellSpans defined in this model if this method returns false.

Since 3.5.12, please fire table data changed event if the returned value of this method is changed. Otherwise the CellSpanTable might still use the cached value to improve performance.

Specified by:
isCellSpanOn in interface SpanModel
Returns:
true if span is on. Otherwise false.

getCellStyleAt

public final CellStyle getCellStyleAt(int rowIndex,
                                      int columnIndex)
Gets the cell style at the specified cell. This method is final. Please use PivotDataModel.setCellStyleProvider(PivotCellStyleProvider) to provide cell style for HeaderTable.

Specified by:
getCellStyleAt in interface StyleModel
Parameters:
rowIndex -
columnIndex -
Returns:
the cell style at the specified cell.

isCellStyleOn

public final boolean isCellStyleOn()
Description copied from interface: StyleModel
Checks if the style is on. The CellStyleTable will ignore all the CellStyles defined in this model if this method returns false.

Specified by:
isCellStyleOn in interface StyleModel
Returns:
true if style is on. Otherwise false.

getPivotDataModel

public IPivotDataModel getPivotDataModel()
Gets the PivotDataModel.

Returns:
the PivotDataModel.

getFieldAt

public PivotField getFieldAt(int rowIndex,
                             int columnIndex)
Gets the pivot field associated with the cell.

Parameters:
rowIndex - the row index
columnIndex - the column index
Returns:
the pivot field associated with the cell. It could return null for certain cells when there are more than one data fields.

JIDE 3.5.15