JIDE 3.5.15

com.jidesoft.pivot
Interface IPivotDataModel

All Superinterfaces:
PivotConstants
All Known Implementing Classes:
AggregateTableModel.AggregateTablePivotDataModel, CalculatedPivotDataModel, PivotDataModel

public interface IPivotDataModel
extends PivotConstants

This is an interface for PivotDataModel. We have a default implementation, which is PivotDataModel. However, with this interface, you can create your own PivotDataModel if you want.


Field Summary
 
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
 
Method Summary
 void addHiddenColumn(Values values, PivotField field)
          Adds the designated column defined by values and PivotField to the hidden values.
 void addHiddenColumn(Values values, PivotField field, String width)
          Adds the designated column defined by values and PivotField to the hidden values.
 void addHiddenValues(Values values)
          Adds the values to the hidden values.
 void calculate()
          Calculates the pivot data.
 void clearHiddenColumns()
          Clears the hidden columns.
 void clearHiddenValues()
          Clears the hidden values.
 PivotCellStyleProvider getCellStyleProvider()
          Gets the PivotCellStyleProvider.
 int[] getColumnFieldIndices()
          Gets the model indices for the column fields.
 PivotField[] getColumnFields()
          Gets the column fields.
 int getColumnHeaderColumnIndexAt(int rowIndex)
          Gets the column index in the column header table which has the data from the original table model at the specified rowIndex.
 PivotDataEditingProvider getColumnHeaderEditingProvider()
          Gets the PivotDataEditingProvider for the column header table.
 HeaderTableModel getColumnHeaderTableModel()
          Gets the column header table model.
 TableModel getCornerTableModel()
          Gets the corner table model.
 List<Integer> getDataAt(CompoundKey rowKey, CompoundKey columnKey)
          Gets the row index list that matches with the rowKey and columnKey.
 List<Integer> getDataAt(int rowIndex, int columnIndex)
          Gets the row index list at the specified row index and column index.
 PivotDataEditingProvider getDataEditingProvider()
          Gets the PivotDataEditingProvider for the data table.
 int[] getDataFieldIndices()
          Gets the model indices for the data fields.
 PivotField[] getDataFields()
          Gets the data fields.
 PivotDataSource getDataSource()
          Gets the data source.
 TableModel getDataTableModel()
          Gets the data table model.
 PivotField getField(int index)
          Gets the PivotField by the index.
 PivotField getField(String name)
          Gets the PivotField by the name.
 PivotField[] getFields()
          Gets all the PivotFields.
 int[] getFilterFieldIndices()
          Gets the model indices for the filter fields.
 PivotField[] getFilterFields()
          Gets the filter fields.
 Object[][] getHiddenColumns()
          Get the hidden columns array.
 Values[] getHiddenValues()
          Gets all the hidden values.
 Object[] getPossibleValues(int columnIndex)
          Deprecated. the order of the possible values returned from this method is not clear. Please use getPossibleValues(int, java.util.Comparator) instead. We didn't use this method anymore in our code.
 Object[] getPossibleValues(int columnIndex, Comparator comparator)
          Gets the possible values of the specified columnIndex.
 Object[] getPossibleValues(PivotField field)
           
 int[] getRowFieldIndices()
          Gets the model indices for the row fields.
 PivotField[] getRowFields()
          Gets the row fields.
 PivotDataEditingProvider getRowHeaderEditingProvider()
          Gets the PivotDataEditingProvider for the row header table.
 int getRowHeaderRowIndexAt(int rowIndex)
          Gets the row index in the row header table which has the data from the original table model at the specified rowIndex.
 HeaderTableModel getRowHeaderTableModel()
          Gets the row header table model.
 SummaryCalculator getSummaryCalculator()
          Gets the statistics calculator used to calculate all the statistics for the pivot data model.
 SummaryCalculatorFactory getSummaryCalculatorFactory()
          Gets the summary calculator factory which will create summary calculator to calculate all the statistics for the pivot data model.
 int[] getUnassignedFieldIndices()
          Gets the model indices for the unassigned fields.
 PivotField[] getUnassignedFields()
          Gets the unassigned fields.
 Object getValueAt(PivotField field, Values rowKeys, Values columnKeys)
          Get the value to be compared.
 boolean hasHiddenColumns()
          Checks if there are hidden columns.
 boolean hasHiddenValues()
          Checks if there are hidden values.
 void initialize()
          Initializes the PivotDataModel.
 void invalidateColumnHeaderTableModel()
          Invalidate column header table model before calculate.
 void invalidateCornerTableModel()
          Invalidate corner table model before calculate.
 void invalidateDataTableModel()
          Invalidate data table model before calculate.
 void invalidateRowHeaderTableModel()
          Invalidate row header table model before calculate.
 boolean isAdjusting()
          Checks if the PivotDataModel is adjusting.
 boolean isAggregateMode()
          Gets the flag indicating if it's used by AggregateTable.
 boolean isAllowEmptyColumnHeader()
          Gets the flag if empty headers are allowed.
 boolean isAllowEmptyRowHeader()
          Gets the flag if empty headers are allowed.
 boolean isAlwaysColumnDataFields()
          Checks if the data fields will always displayed on the column header area.
 boolean isAlwaysRowDataFields()
          Is the data field always displayed on the row header area.
 boolean isAutoUpdate()
          Checks if the pivot data will be automatically updated when the underlying table model data changes.
 boolean isCalculated()
          Checks if calculate() is called on this pivot data model.
 boolean isColumnDataFields()
          Checks if the data field displayed on the column header area.
 boolean isColumnVisible(Values values, PivotField field)
          Checks if the Values is visible.
 boolean isDisplayGrandTotalFirst()
          Deprecated. replaced by isDisplayGrandTotalFirstForRow() and isDisplayGrandTotalFirstForColumn()
 boolean isDisplayGrandTotalFirstForColumn()
          Checks if the grand total is displayed as the first column.
 boolean isDisplayGrandTotalFirstForRow()
          Checks if the grand total is displayed as the first row.
 boolean isExpandByDefault()
          Checks the flag whether the pivot table expands to show all the values.
 boolean isHideRedundantSubtotal()
          When the subtotal is configured as automatically and there is only one item, the subtotal is redundant.
 boolean isHideSingleDataField()
           
 boolean isHideSummaryValues()
          Get the flag that indicating if summary values should be hidden if all its children values are hidden.
 boolean isHighPerformanceMode()
          Gets the flag indicating if the IPivotDataModel should work on high performance mode.
 boolean isKeepRowChildrenOnSummaryFilter()
          Get the flag indicating that if all its row children in row header table should be kept if the summary row is kept on data field filter.
 boolean isLayoutDataFieldsFirst()
          Gets the flag indicating if the data field should be laid out in the first level or not.
 boolean isRowDataFields()
          Is the data field displayed on the row header area.
 boolean isShowGrandTotalForColumn()
          Checks if grand total column is visible.
 boolean isShowGrandTotalForRow()
          Checks if grand total row is visible.
 boolean isShowSubtotalAsChild()
          Get the flag.
 boolean isSingleValueMode()
          The cells in the data table are actually summary of multiple rows in the original table model.
 boolean isSummaryLayer()
          Gets the flag indicating if it's a summary layer.
 boolean isSummaryMode()
          Checks if the pivot data model works in summary mode.
 boolean isValuesVisible(Values values)
          Checks if the Values is visible.
 String removeHiddenColumn(Values values, PivotField field)
          Removes the column from the hidden columns.
 void removeHiddenValues(Values values)
          Removes the values from the hidden values.
 void resetDataFields()
          Reset data fields based on the values in every PivotField.
 void setAdjusting(boolean adjusting)
          Sets the PivotDataModel to adjusting mode.
 void setAllowEmptyColumnHeader(boolean allowEmptyColumnHeader)
          Sets the flag if empty column header is allowed.
 void setAllowEmptyRowHeader(boolean allowEmptyRowHeader)
          Sets the flag if empty row header is allowed.
 void setAlwaysColumnDataFields(boolean alwaysColumnDataFields)
          Sets the flag whether the data fields will always be displayed on the column header area.
 void setAlwaysRowDataFields(boolean alwaysRowDataFields)
          Sets the flag whether the data fields will always be displayed on the row header area.
 void setAutoUpdate(boolean autoUpdate)
          Sets the flag if the pivot data will be automatically updated when the underlying table model data changes.
 void setCellStyleProvider(PivotCellStyleProvider cellStyleProvider)
          Sets the PivotCellStyleProvider.
 void setColumnHeaderEditingProvider(PivotDataEditingProvider columnHeaderEditingProvider)
          Sets the PivotDataEditingProvider that is used for the column header table.
 void setDataEditingProvider(PivotDataEditingProvider dataEditingProvider)
          Sets the PivotDataEditingProvider for the data table.
 void setDataSource(PivotDataSource dataSource)
          Sets the data source.
 void setDisplayGrandTotalFirst(boolean displayGrandTotalFirst)
          Deprecated. replaced by setDisplayGrandTotalFirstForRow(boolean) and setDisplayGrandTotalFirstForColumn(boolean)
 void setDisplayGrandTotalFirstForColumn(boolean displayGrandTotalFirstForColumn)
          By default, grand total is displayed at the last column in the pivot table.
 void setDisplayGrandTotalFirstForRow(boolean displayGrandTotalFirstForRow)
          By default, grand total is displayed at the last row in the pivot table.
 void setExpandByDefault(boolean expandByDefault)
          Sets the flag whether the pivot table should expand to show all the values.
 void setHideRedundantSubtotal(boolean hideRedundantSubtotal)
          Sets the hideRedundantSubtotal flag.
 void setHideSingleDataField(boolean hideSingleDataField)
           
 void setHideSummaryValues(boolean hideSummaryValues)
          Set the flag that indicating if summary values should be hidden if all its children values are hidden.
 void setHighPerformanceMode(boolean highPerformanceMode)
          Sets the flag indicating if the IPivotDataModel should work on high performance mode.
 void setKeepRowChildrenOnSummaryFilter(boolean filterRowSummaryValues)
          Set the flag indicating that if all its row children in row header table should be kept if the summary row is kept on data field filter.
 void setLayoutDataFieldsFirst(boolean layoutDataFieldsFirst)
          Sets the flag indicating if the data field should be laid out in the first level or not.
 void setRowHeaderEditingProvider(PivotDataEditingProvider rowHeaderEditingProvider)
          Sets the PivotDataEditingProvider that is used for the row header table.
 void setShowGrandTotalForColumn(boolean showGrandTotalForColumn)
          Shows grand total column.
 void setShowGrandTotalForRow(boolean showGrandTotalForRow)
          Shows grand total row.
 void setShowSubtotalAsChild(boolean showSubtotalAsChild)
          By default, the subtotal rows/columns are at the same level as the values.
 void setSingleValueMode(boolean singleValueMode)
          Sets the single value mode.
 void setSummaryCalculator(SummaryCalculator summaryCalculator)
          Sets the statistics calculator.
 void setSummaryCalculatorFactory(SummaryCalculatorFactory summaryCalculatorFactory)
          Sets the statistics calculator factory.
 void setSummaryLayer(boolean summaryLayer)
          Sets the flag indicating if it's a summary layer.
 void setSummaryMode(boolean summaryMode)
          Sets the flag for the summary mode.
 void updateFields()
           
 boolean verify()
          This method is for debugging purpose, not a public API.
 

Method Detail

setDataSource

void setDataSource(PivotDataSource dataSource)
Sets the data source.

Parameters:
dataSource - the new data source.

getDataSource

PivotDataSource getDataSource()
Gets the data source.

Returns:
the data source.

getField

PivotField getField(String name)
Gets the PivotField by the name.

Parameters:
name - the field name
Returns:
the PivotField by the name.

getField

PivotField getField(int index)
Gets the PivotField by the index.

Parameters:
index - the field index
Returns:
the PivotField by the index.

getFields

PivotField[] getFields()
Gets all the PivotFields.

Returns:
all the PivotFields.

initialize

void initialize()
Initializes the PivotDataModel. Whenever your original table model structured changed (column added, removed or changed), you need to call this method then calculate(). If only the data is changed, just calculate() is enough.


updateFields

void updateFields()

calculate

void calculate()
Calculates the pivot data. Whenever you are done updating PivotField settings or the data in the original table model is changed, you should call this method to use the new settings or new data. If you call this method after the PivotDataModel has been set on PivotTablePane, you also need to call PivotTablePane.fieldsUpdated() method in order for the change to take effect.


isCalculated

boolean isCalculated()
Checks if calculate() is called on this pivot data model. There is no setter for this flag. Only calculate() will set it to true.

Returns:
true if calculate() is already called.

getPossibleValues

@Deprecated
Object[] getPossibleValues(int columnIndex)
Deprecated. the order of the possible values returned from this method is not clear. Please use getPossibleValues(int, java.util.Comparator) instead. We didn't use this method anymore in our code.

Gets the possible values of the specified columnIndex. The values are sorted.

Parameters:
columnIndex - the column index.
Returns:
the possible values of in the column.

getPossibleValues

Object[] getPossibleValues(int columnIndex,
                           Comparator comparator)
Gets the possible values of the specified columnIndex. The values are sorted using the comparator passed in as parameter.

Parameters:
columnIndex - the column index
comparator - the comparator
Returns:
the possible values of in the column.

getPossibleValues

Object[] getPossibleValues(PivotField field)

getRowHeaderTableModel

HeaderTableModel getRowHeaderTableModel()
Gets the row header table model. It can be used by HeaderTable.

Returns:
the row header table model.

getCornerTableModel

TableModel getCornerTableModel()
Gets the corner table model. It is the table model for the top left corner but in regular PivotTablePane, this model is not used. You need to enable it by overriding the following method in PivotTablePane and override setupLayout to add _dataFieldsArea and _rowFieldsArea to somewhere else in order to set the _cornerTable to UPPER_LEFT_CORNER of the JScrollPane.
 protected void initComponents() {
     super.initComponents();
    _cornerTable = new HeaderTable(this);
    _cornerTable.setRowHeight(getRowHeight());
    setCornerTableModel(_cornerTable, getPivotDataModel().getCornerTableModel());
    _cornerTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
     _cornerTable.setCellSelectionEnabled(true);
     ((JideTable) _cornerTable).setColumnResizable(true);
     ((JideTable) _cornerTable).setNonContiguousCellSelection(true);
 }
 

Returns:
the corner table model.

getColumnHeaderTableModel

HeaderTableModel getColumnHeaderTableModel()
Gets the column header table model. It can be used by HeaderTable.

Returns:
the column header table model.

getDataTableModel

TableModel getDataTableModel()
Gets the data table model.

Returns:
the data table model.

getValueAt

Object getValueAt(PivotField field,
                  Values rowKeys,
                  Values columnKeys)
Get the value to be compared.

Parameters:
field - the data field
rowKeys - row value keys in the corresponding row header table
columnKeys - column value keys in the corresponding column header table
Returns:
the value from the cell.

getRowFields

PivotField[] getRowFields()
Gets the row fields. It must be called after calculate() is called. Otherwise, it will return null.

Returns:
the row fields.

getRowFieldIndices

int[] getRowFieldIndices()
Gets the model indices for the row fields. It must be called after calculate() is called. Otherwise, it will return null.

Returns:
the row fields.

getColumnFields

PivotField[] getColumnFields()
Gets the column fields. It must be called after calculate() is called. Otherwise, it will return null.

Returns:
the column fields.

getColumnFieldIndices

int[] getColumnFieldIndices()
Gets the model indices for the column fields. It must be called after calculate() is called. Otherwise, it will return null.

Returns:
the column fields.

getDataFields

PivotField[] getDataFields()
Gets the data fields. it must be called after calculate() or resetDataFields() is called. Otherwise, it will return null.

Returns:
the data fields.

resetDataFields

void resetDataFields()
Reset data fields based on the values in every PivotField. This method should only be invoked for protection purpose.


getDataFieldIndices

int[] getDataFieldIndices()
Gets the model indices for the data fields. It must be called after calculate() is called. Otherwise, it will return null.

Returns:
the data fields.

getFilterFields

PivotField[] getFilterFields()
Gets the filter fields. it must be called after calculate() is called. Otherwise, it will return null.

Returns:
the filter fields.

getFilterFieldIndices

int[] getFilterFieldIndices()
Gets the model indices for the filter fields. It must be called after calculate() is called. Otherwise, it will return null.

Returns:
the filter fields.

getUnassignedFields

PivotField[] getUnassignedFields()
Gets the unassigned fields. it must be called after calculate() is called. Otherwise, it will return null.

Returns:
the unassigned fields.

getUnassignedFieldIndices

int[] getUnassignedFieldIndices()
Gets the model indices for the unassigned fields. It must be called after calculate() is called. Otherwise, it will return null.

Returns:
the unassigned fields.

getDataAt

List<Integer> getDataAt(int rowIndex,
                        int columnIndex)
Gets the row index list at the specified row index and column index. If both indices are greater than or equal 0, it will get the row index list as in the data table model. If the row index is less than 0 but the column index is greater than or equal 0, it will get the row index list as in the column header table model. The negative row index is converted to the row index relative to row header table model using - rowIndex - 1. If the column index is less than 0 but the row index is greater than or equal 0, it will get the row index list as in the row header table model. The negative column index is converted to the column index relative to column header table model using - columnIndex - 1.

Please note, the list returned from this method is used internally. If you iterate through the list and modify the table model at the same time, the list could be changed as well. So to be safe, you should replicate the list if you plan to modify the table model.

Parameters:
rowIndex - the row index relative to DataTableModel.
columnIndex - the column index relative to DataTableModel.
Returns:
a list of integer which are row indexes to the data source that you can get using getDataSource().

getDataAt

List<Integer> getDataAt(CompoundKey rowKey,
                        CompoundKey columnKey)
Gets the row index list that matches with the rowKey and columnKey.

Parameters:
rowKey - the row compound key
columnKey - the column compound key
Returns:
a list of integer which are row indexes to the data source that you can get using getDataSource().

isRowDataFields

boolean isRowDataFields()
Is the data field displayed on the row header area. It possibly returns true only if isColumnDataFields return false. Otherwise data fields will display on the column header area.

Returns:
true or false.

isColumnDataFields

boolean isColumnDataFields()
Checks if the data field displayed on the column header area.

Returns:
true or false.

isAlwaysColumnDataFields

boolean isAlwaysColumnDataFields()
Checks if the data fields will always displayed on the column header area. If this method returns true, isColumnDataFields will always return true.

Returns:
true or false.

setAlwaysColumnDataFields

void setAlwaysColumnDataFields(boolean alwaysColumnDataFields)
Sets the flag whether the data fields will always be displayed on the column header area. By default, we might use row header area to display the data fields if there is no field in the row area.

Parameters:
alwaysColumnDataFields - true or false.

isAlwaysRowDataFields

boolean isAlwaysRowDataFields()
Is the data field always displayed on the row header area. If this method returns true, isRowDataFields will always return true as long as isColumnDataFields returns false.

Returns:
true or false.

setAlwaysRowDataFields

void setAlwaysRowDataFields(boolean alwaysRowDataFields)
Sets the flag whether the data fields will always be displayed on the row header area. By default, we might use row header area to display the data fields if there is no field in the row area.

Parameters:
alwaysRowDataFields - true or false.

isHideSingleDataField

boolean isHideSingleDataField()

setHideSingleDataField

void setHideSingleDataField(boolean hideSingleDataField)

isAllowEmptyColumnHeader

boolean isAllowEmptyColumnHeader()
Gets the flag if empty headers are allowed.

Returns:
true or false.

setAllowEmptyColumnHeader

void setAllowEmptyColumnHeader(boolean allowEmptyColumnHeader)
Sets the flag if empty column header is allowed. This is used when there are no column fields but there are data fields. If this flag is set to false, we will display summary information on the data fields in the data table. If set to true, the data table will be empty.

Parameters:
allowEmptyColumnHeader - true or false.

isAllowEmptyRowHeader

boolean isAllowEmptyRowHeader()
Gets the flag if empty headers are allowed.

Returns:
true or false.

setAllowEmptyRowHeader

void setAllowEmptyRowHeader(boolean allowEmptyRowHeader)
Sets the flag if empty row header is allowed. This is used when there are no row fields but there are data fields. If this flag is set to false, we will display summary information on the data fields in the data table. If set to true, the data table will be empty.

Parameters:
allowEmptyRowHeader - true or false.

isShowGrandTotalForRow

boolean isShowGrandTotalForRow()
Checks if grand total row is visible.

Returns:
true if grand total row is visible. Otherwise is false.

setShowGrandTotalForRow

void setShowGrandTotalForRow(boolean showGrandTotalForRow)
Shows grand total row. If you changed this value, you need to call PivotTablePane.rowHeaderUpdated() or PivotTablePane.bothHeadersUpdated() if you also changed grandTotalForColumn.

Parameters:
showGrandTotalForRow - whether show grand total for row.

isShowGrandTotalForColumn

boolean isShowGrandTotalForColumn()
Checks if grand total column is visible.

Returns:
true if grand total column is visible. Otherwise is false.

setShowGrandTotalForColumn

void setShowGrandTotalForColumn(boolean showGrandTotalForColumn)
Shows grand total column. If you changed this value, you need to call PivotTablePane.columnHeaderUpdated() or PivotTablePane.bothHeadersUpdated() if you also changed grandTotalForRow.

Parameters:
showGrandTotalForColumn - whether show grand total for column.

getCellStyleProvider

PivotCellStyleProvider getCellStyleProvider()
Gets the PivotCellStyleProvider.

Returns:
the PivotCellStyleProvider.

setCellStyleProvider

void setCellStyleProvider(PivotCellStyleProvider cellStyleProvider)
Sets the PivotCellStyleProvider. You can use this provider to provide CellStyle for column header table, row header table and data table.

Parameters:
cellStyleProvider - the cell style provider.

setRowHeaderEditingProvider

void setRowHeaderEditingProvider(PivotDataEditingProvider rowHeaderEditingProvider)
Sets the PivotDataEditingProvider that is used for the row header table. You can use this provider to provide a way to edit cell directly in pivot table. The provide will interpret the user change and modify the actual data source.

Parameters:
rowHeaderEditingProvider - the date editing provider.

getRowHeaderEditingProvider

PivotDataEditingProvider getRowHeaderEditingProvider()
Gets the PivotDataEditingProvider for the row header table.

Returns:
the PivotDataEditingProvider.

setColumnHeaderEditingProvider

void setColumnHeaderEditingProvider(PivotDataEditingProvider columnHeaderEditingProvider)
Sets the PivotDataEditingProvider that is used for the column header table. You can use this provider to provide a way to edit cell directly in pivot table. The provide will interpret the user change and modify the actual data source.

Parameters:
columnHeaderEditingProvider - the date editing provider.

getColumnHeaderEditingProvider

PivotDataEditingProvider getColumnHeaderEditingProvider()
Gets the PivotDataEditingProvider for the column header table.

Returns:
the PivotDataEditingProvider.

getDataEditingProvider

PivotDataEditingProvider getDataEditingProvider()
Gets the PivotDataEditingProvider for the data table.

Returns:
the PivotDataEditingProvider.

setDataEditingProvider

void setDataEditingProvider(PivotDataEditingProvider dataEditingProvider)
Sets the PivotDataEditingProvider for the data table. You can use this provider to provide a way to edit cell directly in pivot table. The provide will interpret the user change and modify the actual data source.

Parameters:
dataEditingProvider - the date editing provider.

getSummaryCalculator

SummaryCalculator getSummaryCalculator()
Gets the statistics calculator used to calculate all the statistics for the pivot data model.

Returns:
the statistics calculator.

setSummaryCalculator

void setSummaryCalculator(SummaryCalculator summaryCalculator)
Sets the statistics calculator.

Parameters:
summaryCalculator - the summary calculator.

getSummaryCalculatorFactory

SummaryCalculatorFactory getSummaryCalculatorFactory()
Gets the summary calculator factory which will create summary calculator to calculate all the statistics for the pivot data model.

Returns:
the summary calculator factory.

setSummaryCalculatorFactory

void setSummaryCalculatorFactory(SummaryCalculatorFactory summaryCalculatorFactory)
Sets the statistics calculator factory. We will use this factory to create SummaryCalculator when needed.

Parameters:
summaryCalculatorFactory - the summary calculator factory.

isDisplayGrandTotalFirstForRow

boolean isDisplayGrandTotalFirstForRow()
Checks if the grand total is displayed as the first row.

Returns:
true or false.

setDisplayGrandTotalFirstForRow

void setDisplayGrandTotalFirstForRow(boolean displayGrandTotalFirstForRow)
By default, grand total is displayed at the last row in the pivot table. If you set this flag to true, it will be displayed as the first row.

Parameters:
displayGrandTotalFirstForRow - true or false.

isDisplayGrandTotalFirstForColumn

boolean isDisplayGrandTotalFirstForColumn()
Checks if the grand total is displayed as the first column.

Returns:
true or false.

setDisplayGrandTotalFirstForColumn

void setDisplayGrandTotalFirstForColumn(boolean displayGrandTotalFirstForColumn)
By default, grand total is displayed at the last column in the pivot table. If you set this flag to true, it will be displayed as the first column.

Parameters:
displayGrandTotalFirstForColumn - true or false.

isDisplayGrandTotalFirst

@Deprecated
boolean isDisplayGrandTotalFirst()
Deprecated. replaced by isDisplayGrandTotalFirstForRow() and isDisplayGrandTotalFirstForColumn()

Checks if the grand total is displayed as the first column (row).

Returns:
true or false.

setDisplayGrandTotalFirst

@Deprecated
void setDisplayGrandTotalFirst(boolean displayGrandTotalFirst)
Deprecated. replaced by setDisplayGrandTotalFirstForRow(boolean) and setDisplayGrandTotalFirstForColumn(boolean)

By default, grand total is displayed at the last column (row) in the pivot table. If you set this flag to true, it will be displayed as the first column (row).

Parameters:
displayGrandTotalFirst - true or false.

isAutoUpdate

boolean isAutoUpdate()
Checks if the pivot data will be automatically updated when the underlying table model data changes.

Returns:
true or false.

setAutoUpdate

void setAutoUpdate(boolean autoUpdate)
Sets the flag if the pivot data will be automatically updated when the underlying table model data changes. By default, it is false because in most cases people use pivot data to analyze static data. If the data changes, you have to call calculate() method when the underlying table model data changes. However because the data inside pivot table is very complex, right now autoUpdate will only update correctly if the table model data change is cellUpdated event and rowUpdated event. If you add/remove rows or columns, you still have to call calculate() just like before.

Parameters:
autoUpdate - true or false.

isAdjusting

boolean isAdjusting()
Checks if the PivotDataModel is adjusting. If it is adjusting, other code should not call calculate() or update UI automatically when a property is changed. Right now, we used in PivotField.setSelectedPossibleValues(Object[]). By default, isAdjusting is false, so setSelectedPossibleValues will call calculate() and bothHeaderUpdated(). If isAdjusting is true, they will be not be called.

Returns:
true if adjusting. Otherwise false.

setAdjusting

void setAdjusting(boolean adjusting)
Sets the PivotDataModel to adjusting mode. If it is adjusting, PivotDataModel will not call calculate() and update the UI when something is changed. After you set adjusting to false, PivotDataModel will then calculate(). But you will be still be responsible to call the XxxUpdated() method on PivotTablePane to update the UI.

Parameters:
adjusting - true or false.

isSummaryMode

boolean isSummaryMode()
Checks if the pivot data model works in summary mode. Summary mode means instead of display the summary (such as sum, max, min, stddev etc statistics) of the values in the data table, it displays the first value that matches the key.

Default is true.

Returns:
true or false.

setSummaryMode

void setSummaryMode(boolean summaryMode)
Sets the flag for the summary mode. Summary mode means instead of display the summary (such as sum, max, min, stddev etc statistics) of the values in the data table, it displays the first value that matches the key.

Parameters:
summaryMode - true to set to summary mode. Otherwise false.
See Also:
isSummaryMode()

isSingleValueMode

boolean isSingleValueMode()
The cells in the data table are actually summary of multiple rows in the original table model. For example, if the summary is SUM, we will display the sum of all the values of all the rows and display it in the cell of the data table. However In the single value mode, whenever there are two rows that maps to the same cell, we will delete the second row.

Returns:
true or false.

setSingleValueMode

void setSingleValueMode(boolean singleValueMode)
Sets the single value mode.

Parameters:
singleValueMode - true or false.

getRowHeaderRowIndexAt

int getRowHeaderRowIndexAt(int rowIndex)
Gets the row index in the row header table which has the data from the original table model at the specified rowIndex.

Parameters:
rowIndex - the row at the original table model.
Returns:
the row index as in the row header table.

getColumnHeaderColumnIndexAt

int getColumnHeaderColumnIndexAt(int rowIndex)
Gets the column index in the column header table which has the data from the original table model at the specified rowIndex.

Parameters:
rowIndex - the row at the original table model.
Returns:
the column index as in the column header table.

isHideSummaryValues

boolean isHideSummaryValues()
Get the flag that indicating if summary values should be hidden if all its children values are hidden.

The default value of this flag is true, which could cause incompatible behavior with release earlier than 2.8.3.

Returns:
true if summary values need be hidden. otherwise false.

setHideSummaryValues

void setHideSummaryValues(boolean hideSummaryValues)
Set the flag that indicating if summary values should be hidden if all its children values are hidden.

Parameters:
hideSummaryValues - the flag
See Also:
isHideSummaryValues()

isValuesVisible

boolean isValuesVisible(Values values)
Checks if the Values is visible.

Parameters:
values - the Values.
Returns:
true or false True means the Values is visible.

addHiddenValues

void addHiddenValues(Values values)
Adds the values to the hidden values. For example, if you want to hide the column or row, as in PivotTableDemo, that year is 1994, quarter is 2 and month is 6, you can call the code below to do it.

 addHiddenValues(new DefaultValues(new Object[]{1994, 2, 6});
 

Parameters:
values - the Values.

removeHiddenValues

void removeHiddenValues(Values values)
Removes the values from the hidden values.

Parameters:
values - the Values.

clearHiddenValues

void clearHiddenValues()
Clears the hidden values. In the other word, all Values will be shown on the header tables.


hasHiddenValues

boolean hasHiddenValues()
Checks if there are hidden values.

Returns:
True if there are hidden values. Otherwise false.

getHiddenValues

Values[] getHiddenValues()
Gets all the hidden values.

Returns:
the hidden values in an array.

isColumnVisible

boolean isColumnVisible(Values values,
                        PivotField field)
Checks if the Values is visible.

Parameters:
values - the Values
field - the data field
Returns:
true or false True means the Values is visible.

addHiddenColumn

void addHiddenColumn(Values values,
                     PivotField field)
Adds the designated column defined by values and PivotField to the hidden values. If all data fields in one values are hidden, addHiddenValues() will be invoked to hide the entire values.

This method should invoke addHiddenColumn(Values, PivotField, String) with the string as "15\t75\t75"

Parameters:
values - the Values
field - the data field

addHiddenColumn

void addHiddenColumn(Values values,
                     PivotField field,
                     String width)
Adds the designated column defined by values and PivotField to the hidden values. If all data fields in one values are hidden, addHiddenValues() will be invoked to hide the entire values.

Parameters:
values - the Values
field - the data field
width - the width information before the column is hidden

removeHiddenColumn

String removeHiddenColumn(Values values,
                          PivotField field)
Removes the column from the hidden columns.

Parameters:
values - the Values
field - the data field
Returns:
the saved column width while hiding the column. -1 if the column width is not available.

clearHiddenColumns

void clearHiddenColumns()
Clears the hidden columns. In the other word, all columns will be shown on the header tables.


hasHiddenColumns

boolean hasHiddenColumns()
Checks if there are hidden columns.

Returns:
True if there are hidden columns. Otherwise false.

getHiddenColumns

Object[][] getHiddenColumns()
Get the hidden columns array.

It will return a two-dimension array. Each row means a hidden column and has three elements. In each row, the first element is Values and the second element is DataField while the last one is the width information before hidden. There are three elements in the width information, which in order are minWdith, preferredWidth then width.

Returns:
the hidden column array.

invalidateCornerTableModel

void invalidateCornerTableModel()
Invalidate corner table model before calculate. After calculating, you should always set model for corner table explicitly.


invalidateDataTableModel

void invalidateDataTableModel()
Invalidate data table model before calculate. After calculating, you should always set model for corner table explicitly.


invalidateRowHeaderTableModel

void invalidateRowHeaderTableModel()
Invalidate row header table model before calculate. After calculating, you should always set model for corner table explicitly.


invalidateColumnHeaderTableModel

void invalidateColumnHeaderTableModel()
Invalidate column header table model before calculate. After calculating, you should always set model for corner table explicitly.


isExpandByDefault

boolean isExpandByDefault()
Checks the flag whether the pivot table expands to show all the values.

Returns:
true or false.

setExpandByDefault

void setExpandByDefault(boolean expandByDefault)
Sets the flag whether the pivot table should expand to show all the values. By default, when calcualte() method is called on PivotDataModel, all values are expanded so that user will see a fully expanded pivot table. You can change it to false so that it will show only the top level summary.

Parameters:
expandByDefault - true or false.

isShowSubtotalAsChild

boolean isShowSubtotalAsChild()
Get the flag.

Returns:
true if show subtotal as child. Otherwise false.
See Also:
setShowSubtotalAsChild(boolean)

setShowSubtotalAsChild

void setShowSubtotalAsChild(boolean showSubtotalAsChild)
By default, the subtotal rows/columns are at the same level as the values. For example, if there is a year value is 1994, 1994 total is at the same level as sibling. If this flag is set to true, the subtotal will become a child of the value.

Parameters:
showSubtotalAsChild - true or false.

isHideRedundantSubtotal

boolean isHideRedundantSubtotal()
When the subtotal is configured as automatically and there is only one item, the subtotal is redundant. By setting this flag to false, we will hide the subtotal if there is only one item.

Returns:
true or false.
Since:
3.3.3

setHideRedundantSubtotal

void setHideRedundantSubtotal(boolean hideRedundantSubtotal)
Sets the hideRedundantSubtotal flag.

Parameters:
hideRedundantSubtotal - the flag
Since:
3.3.3
See Also:
isHideRedundantSubtotal()

verify

boolean verify()
This method is for debugging purpose, not a public API. It will print out if there is any cell span errors in the row header and the column header table.


isKeepRowChildrenOnSummaryFilter

boolean isKeepRowChildrenOnSummaryFilter()
Get the flag indicating that if all its row children in row header table should be kept if the summary row is kept on data field filter.

The default value is true which means all its row children would be kept. You could change it to false if you want to keep all its column children of summary values in column header table.

This flag only takes effects when at least one data field filters on summary values.

#see PivotField.isDataFieldFilterOnSummary()

Returns:
true if row children of summary values are to be kept. Otherwise false.

setKeepRowChildrenOnSummaryFilter

void setKeepRowChildrenOnSummaryFilter(boolean filterRowSummaryValues)
Set the flag indicating that if all its row children in row header table should be kept if the summary row is kept on data field filter.

#see #isKeepRowChildrenOnSummaryFilter

Parameters:
filterRowSummaryValues - the flag

isAggregateMode

boolean isAggregateMode()
Gets the flag indicating if it's used by AggregateTable.

Returns:
true if it's used by AggregateTable. Otherwise false.

isSummaryLayer

boolean isSummaryLayer()
Gets the flag indicating if it's a summary layer.

Returns:
true if it's a summary layer. Otherwise false.

setSummaryLayer

void setSummaryLayer(boolean summaryLayer)
Sets the flag indicating if it's a summary layer.

Parameters:
summaryLayer - the flag

isLayoutDataFieldsFirst

boolean isLayoutDataFieldsFirst()
Gets the flag indicating if the data field should be laid out in the first level or not.

Returns:
true if the data field should be laid out first. Otherwise false.
Since:
3.4.0
See Also:
setLayoutDataFieldsFirst(boolean)

setLayoutDataFieldsFirst

void setLayoutDataFieldsFirst(boolean layoutDataFieldsFirst)
Sets the flag indicating if the data field should be laid out in the first level or not.

By default the flag is false to keep the default behavior backward compatible.

Parameters:
layoutDataFieldsFirst - the flag
Since:
3.4.0

isHighPerformanceMode

boolean isHighPerformanceMode()
Gets the flag indicating if the IPivotDataModel should work on high performance mode.

Returns:
true if the IPivotDataModel should work on high performance mode. Otherwise false.
Since:
3.4.0
See Also:
setHighPerformanceMode(boolean)

setHighPerformanceMode

void setHighPerformanceMode(boolean highPerformanceMode)
Sets the flag indicating if the IPivotDataModel should work on high performance mode.

By default the flag is false to keep the default behavior backward compatible.

Setting this flag to true will improve the calculating performance. However, some features, like the expansion state persistence, selection persistence, column width persistence, hidden value persistence, will be lost.

Parameters:
highPerformanceMode - the flag
Since:
3.4.0

JIDE 3.5.15