JIDE 3.5.15

com.jidesoft.pivot
Class DataTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.jidesoft.pivot.DataTableModel
All Implemented Interfaces:
ColumnIdentifierTableModel, ContextSensitiveTableModel, StyleModel, PivotConstants, Serializable, TableModel

public class DataTableModel
extends AbstractTableModel
implements ContextSensitiveTableModel, StyleModel, PivotConstants, ColumnIdentifierTableModel

The table model for the table in the data area in pivot table.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Fields inherited from interface com.jidesoft.pivot.PivotConstants
AREA_COLUMN, AREA_DATA, AREA_FILTER, AREA_NAMES, AREA_NOT_ASSIGNED, AREA_ROW, COMPARE_TO_NEXT, COMPARE_TO_PREVIOUS, HEADER_SELECTION_DATA_TABLE_ONLY, HEADER_SELECTION_HEADER_TABLE_ONLY, RANGE_IN_TOTAL, RUNNING_SUMMARY_DIFFERENCE, RUNNING_SUMMARY_PERCENTAGE_FROM, RUNNING_SUMMARY_PERCENTAGE_OF, RUNNING_SUMMARY_PERCENTAGE_TOTAL, RUNNING_SUMMARY_TOTAL, STATISTICS_CALCULATION_DEFAULT, STATISTICS_CALCULATION_RUNNING, STATISTICS_CALCULATION_RUNNING_IN_COLUMN, STATISTICS_CALCULATION_RUNNING_LEAF, SUBTOTAL_AUTOMATIC, SUBTOTAL_CUSTOM, SUBTOTAL_NONE, SUMMARY_COUNT, SUMMARY_CUSTOM, SUMMARY_MAX, SUMMARY_MEAN, SUMMARY_MIN, SUMMARY_NAMES, SUMMARY_NONE, SUMMARY_RESERVED_MAX, SUMMARY_STDDEV, SUMMARY_SUM, SUMMARY_VAR
 
Constructor Summary
DataTableModel(PivotDataModel pivotDataModel)
           
 
Method Summary
 Class<?> getCellClassAt(int rowIndex, int columnIndex)
          Gets the cell type at the cell.
 CellStyle getCellStyleAt(int rowIndex, int columnIndex)
          Gets the cell style at the specified row and column.
 int getColumnCount()
           
 Object getColumnIdentifier(int columnIndex)
          Returns the identifier of the column in the model.
 String getColumnName(int column)
          Gets the column name.
 ConverterContext getConverterContextAt(int rowIndex, int columnIndex)
          Gets the ConverterContext of the cell.
 PivotField getDataFieldAt(int rowIndex, int columnIndex)
          Gets the field at the cell.
 EditorContext getEditorContextAt(int rowIndex, int columnIndex)
          Gets the EditorContext of the cell.
 IPivotDataModel getPivotDataModel()
           
 int getRowCount()
           
 int getRunningTypeAt(int rowIndex, int columnIndex)
          Gets the running type of the cell.
 int getSummaryTypeAt(int rowIndex, int columnIndex)
          Gets the summary type of the cell.
 Object getValueAt(int rowIndex, int columnIndex)
           
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 boolean isCellStyleOn()
          Checks if the style is on.
 void setValueAt(Object aValue, int rowIndex, int columnIndex)
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, getColumnClass, removeTableModelListener
 

Constructor Detail

DataTableModel

public DataTableModel(PivotDataModel pivotDataModel)
Method Detail

getPivotDataModel

public IPivotDataModel getPivotDataModel()

getRowCount

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

getColumnName

public String getColumnName(int column)
Gets the column name. It will be the field's title.

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel
Parameters:
column - the column index.
Returns:
the column name.

getColumnIdentifier

public Object getColumnIdentifier(int columnIndex)
Description copied from interface: ColumnIdentifierTableModel
Returns the identifier of the column in the model. A JideTable uses this method to get the unique identifier of this column.

Specified by:
getColumnIdentifier in interface ColumnIdentifierTableModel
Parameters:
columnIndex - the index of the column
Returns:
the unique identifier of the column.

getColumnCount

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

getValueAt

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

getRunningTypeAt

public int getRunningTypeAt(int rowIndex,
                            int columnIndex)
Gets the running type of the cell. If the cell displays a running summary, the returned value will be the running type. Otherwise, it will return -1.

Parameters:
rowIndex - the row index.
columnIndex - the column index.
Returns:
the running type of the cell.

getSummaryTypeAt

public int getSummaryTypeAt(int rowIndex,
                            int columnIndex)
Gets the summary type of the cell. If the cell displays a subtotal, the returned value will be the subtotal type. Otherwise, it will return the PivotField's getSummaryType() value.

Parameters:
rowIndex - the row index.
columnIndex - the column index.
Returns:
the summary type of the cell.

getConverterContextAt

public ConverterContext getConverterContextAt(int rowIndex,
                                              int columnIndex)
Gets the ConverterContext of the cell. In most cases, it will return the ConverterContext of the fields. But if the cell displays a summary information, it will use PivotField.getSummaryClass(int) to find out the actual ConverterContext. If getSummaryClass return null, it will use the same ConverterContext as the pivot field. But if getSummaryClass return another type (such as SUMMARY_COUNT will return Long.class), the ConverterContext will be null so that the default cell renderer for that particular type will be used.

Specified by:
getConverterContextAt in interface ContextSensitiveTableModel
Parameters:
rowIndex - the row index.
columnIndex - the column index.
Returns:
the ConverterContext of the cell.

getEditorContextAt

public EditorContext getEditorContextAt(int rowIndex,
                                        int columnIndex)
Gets the EditorContext of the cell. In most cases, it will return the EditorContext of the fields. But if the cell displays a summary information, it will use PivotField.getSummaryClass(int) to find out the actual EditorContext. If getSummaryClass return null, it will use the same EditorContext as the pivot field. But if getSummaryClass return another type (such as SUMMARY_COUNT will return Long.class), the EditorContext will be null so that the default cell renderer for that particular type will be used.

Specified by:
getEditorContextAt in interface ContextSensitiveTableModel
Parameters:
rowIndex - the row index.
columnIndex - the column index.
Returns:
the ConverterContext of the cell.

getCellClassAt

public Class<?> getCellClassAt(int rowIndex,
                               int columnIndex)
Gets the cell type at the cell.

Specified by:
getCellClassAt in interface ContextSensitiveTableModel
Parameters:
rowIndex - the row index.
columnIndex - the column index.
Returns:
the cell type at the cell.

getDataFieldAt

public PivotField getDataFieldAt(int rowIndex,
                                 int columnIndex)
Gets the field at the cell.

Parameters:
rowIndex - the row index.
columnIndex - the column index.
Returns:
the field at the cell.

getCellStyleAt

public final CellStyle getCellStyleAt(int rowIndex,
                                      int columnIndex)
Description copied from interface: StyleModel
Gets the cell style at the specified row and column.

Specified by:
getCellStyleAt in interface StyleModel
Parameters:
rowIndex - the row index
columnIndex - the column index
Returns:
CellStyle object.

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.

setValueAt

public void setValueAt(Object aValue,
                       int rowIndex,
                       int columnIndex)
Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel

JIDE 3.5.15