|
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jidesoft.pivot.PivotDataModel
com.jidesoft.pivot.CalculatedPivotDataModel
public class CalculatedPivotDataModel
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.jidesoft.pivot.PivotDataModel |
|---|
PivotDataModel.RowMerger |
| Field Summary |
|---|
| Fields inherited from class com.jidesoft.pivot.PivotDataModel |
|---|
_dataSource, listenerList, PROPERTY_HIDE_REDUNDANT_SUBTOTAL, PROPERTY_HIDE_SINGLE_DATA_FIELD, PROPERTY_SHOW_GRAND_TOTAL_FOR_COLUMN, PROPERTY_SHOW_GRAND_TOTAL_FOR_ROW, PROPERTY_SHOW_SUBTOTAL_AS_CHILD |
| Constructor Summary | |
|---|---|
CalculatedPivotDataModel(IPivotDataModel pivotDataModel)
|
|
CalculatedPivotDataModel(PivotDataSource dataSource)
|
|
CalculatedPivotDataModel(PivotValueProvider pivotValueProvider,
TableModel tableModel)
|
|
CalculatedPivotDataModel(TableModel tableModel)
|
|
| Method Summary | |
|---|---|
void |
calculate()
Calculates the pivot data. |
protected Object |
calculateStatistics(RunningSummary runningSummary,
Object[] objects)
|
protected Values[] |
collectChildrenValues(Values parentValues,
boolean isRowValues,
int summaryType)
Deprecated. |
protected Values[] |
collectChildrenValues(Values parentValues,
boolean isRowValues,
int summaryType,
int statisticsType)
Collects the children value for calculation. |
protected Object[] |
collectValuesForCell(PivotField field,
Values rowKeys,
Values columnKeys,
int summaryType)
|
protected HeaderTableModel |
createColumnHeaderTableModel(CompoundKey[] keys)
Creates the column header table model. |
protected IPivotDataModel |
createPivotDataModel(PivotDataSource dataSource)
|
protected IPivotDataModel |
createPivotDataModel(TableModel tableModel)
|
protected PivotField |
createPivotField(TableModel tableModel,
int columnIndex)
|
protected HeaderTableModel |
createRowHeaderTableModel(CompoundKey[] keys)
Creates the row header table model. |
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. |
CompoundKey[] |
getColumnKeys()
Get column key array. |
List<Integer> |
getDataAt(CompoundKey rowKey,
CompoundKey columnKey)
Gets the row index list that matches with the rowKey and columnKey. |
int[] |
getDataFieldIndices()
Gets the model indices for the data fields. |
PivotField[] |
getDataFields()
Gets the data fields. |
PivotDataSource |
getDataSource()
Gets the data source. |
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 |
getPivotDataModel()
|
PivotValueProvider |
getPivotValueProvider()
|
Object[] |
getPossibleValues(PivotField field)
Retrieve the possible values for the designated field. |
int[] |
getRowFieldIndices()
Gets the model indices for the row fields. |
PivotField[] |
getRowFields()
Gets the row fields. |
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. |
CompoundKey[] |
getRowKeys()
Get row key array. |
PivotDataModel.RowMerger |
getRowMerger()
Gets the row merger. |
int |
getStatisticsType(Values rowValues,
Values columnValues,
PivotField dataField)
Get the statistics layer. |
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. |
TableModel |
getTableModel()
Gets the table 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. |
protected void |
handleFieldPropertyEvent(PropertyChangeEvent evt)
|
void |
initialize()
Initializes the PivotDataModel. |
boolean |
isAdjusting()
Checks if the PivotDataModel is adjusting. |
boolean |
isAggregateMode()
Checks if the pivot data model works in aggregate mode. |
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 |
isCacheEnabled()
|
boolean |
isCalculating()
Returns if PivotValueProvider is calculating. |
boolean |
isColumnDataFields()
Checks if the data field displayed on the column header area. |
boolean |
isRowDataFields()
Is the data field displayed on the row header area. |
boolean |
isRunningCalculateSummary()
Gets the flag indicating if the CalculatedPivotDataModel should calculate the summary values as running summary. |
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. |
void |
pivotValueProviderEventHandler(PivotValueProviderEvent event)
|
void |
resetDataFields()
Reset data fields based on the values in every PivotField. |
void |
setAdjusting(boolean adjusting)
Sets the PivotDataModel to adjusting mode. |
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 |
setCacheEnabled(boolean cacheEnabled)
|
void |
setComputeAffectedCellOnUpdate(boolean computeAffectedCellOnUpdate)
Set the flag indicating that if the PivotValueProviderEvent will contain the affected cells information on original data model change scenario. |
void |
setDataSource(PivotDataSource dataSource)
Sets the data source. |
void |
setHideSingleDataField(boolean hideSingleDataField)
|
void |
setOriginalTableModel(TableModel tableModel)
Sets the original table model. |
void |
setPivotDataModel(IPivotDataModel pivotDataModel)
|
void |
setPivotValueProvider(PivotValueProvider pivotValueProvider)
|
void |
setRowMerger(PivotDataModel.RowMerger rowMerger)
Sets the row merger. |
void |
setRunningCalculateSummary(boolean runningCalculateSummary)
Sets the flag indicating if the CalculatedPivotDataModel should calculate the summary values as running summary. |
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 |
tableChanged(TableModelEvent e)
Handle the table model change event of the original table model. |
void |
updateFields()
|
boolean |
verify()
This method is for debugging purpose, not a public API. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CalculatedPivotDataModel(TableModel tableModel)
public CalculatedPivotDataModel(PivotDataSource dataSource)
public CalculatedPivotDataModel(IPivotDataModel pivotDataModel)
public CalculatedPivotDataModel(PivotValueProvider pivotValueProvider,
TableModel tableModel)
| Method Detail |
|---|
public void setPivotValueProvider(PivotValueProvider pivotValueProvider)
public PivotValueProvider getPivotValueProvider()
protected IPivotDataModel createPivotDataModel(TableModel tableModel)
protected IPivotDataModel createPivotDataModel(PivotDataSource dataSource)
public Object getPivotDataModel()
public void setPivotDataModel(IPivotDataModel pivotDataModel)
public void setOriginalTableModel(TableModel tableModel)
PivotDataModel
setOriginalTableModel in class PivotDataModeltableModel - the new original table model.public void initialize()
PivotDataModelPivotDataModel.calculate(). If only the data is changed, just PivotDataModel.calculate() is enough.
initialize in interface IPivotDataModelinitialize in class PivotDataModel
protected PivotField createPivotField(TableModel tableModel,
int columnIndex)
public void tableChanged(TableModelEvent e)
tableChanged in interface TableModelListenere - the table model eventprotected void handleFieldPropertyEvent(PropertyChangeEvent evt)
handleFieldPropertyEvent in class PivotDataModelpublic TableModel getTableModel()
PivotDataModelPivotDataSource concept in 2.2.2 release. With the help of
PivotDataSource, PivotDataModel doesn't have to use TableModel as the data source.
Although this method will still return the table model in the default case when the data source is the default
TableModelPivotDataSource, it is not guaranteed. If you set your own PivotDataSource
which doesn't depend on any table model, this getTableModel will return null.
getTableModel in class PivotDataModelpublic void setDataSource(PivotDataSource dataSource)
PivotDataModel
setDataSource in interface IPivotDataModelsetDataSource in class PivotDataModeldataSource - the new data source.public PivotDataSource getDataSource()
PivotDataModel
getDataSource in interface IPivotDataModelgetDataSource in class PivotDataModel
public int getStatisticsType(Values rowValues,
Values columnValues,
PivotField dataField)
PivotValueProviderPivotConstants.STATISTICS_CALCULATION_DEFAULT.
So that the PivotValueProvider itself will conduct the statistics. However, for running percentage or daily average,
you probably need return other values so that CalculatedPivotDataModel would calculate
the summary itself.
getStatisticsType in interface PivotValueProvidergetStatisticsType in class PivotDataModelrowValues - the row valuescolumnValues - the column valuesdataField - the data field
public PivotField getField(String name)
PivotDataModel
getField in interface IPivotDataModelgetField in class PivotDataModelname - the field name
public PivotField getField(int index)
PivotDataModel
getField in interface IPivotDataModelgetField in class PivotDataModelindex - the field index
public PivotField[] getFields()
PivotDataModel
getFields in interface IPivotDataModelgetFields in class PivotDataModelpublic void updateFields()
updateFields in interface IPivotDataModelupdateFields in class PivotDataModelpublic boolean isCalculating()
PivotValueProvider
isCalculating in interface PivotValueProviderisCalculating in class PivotDataModelpublic Object[] getPossibleValues(PivotField field)
PivotValueProvider
getPossibleValues in interface IPivotDataModelgetPossibleValues in interface PivotValueProvidergetPossibleValues in class PivotDataModelfield - the pivot field
public PivotField[] getRowFields()
PivotDataModelPivotDataModel.calculate() is called. Otherwise, it will return null.
getRowFields in interface IPivotDataModelgetRowFields in class PivotDataModelpublic int[] getRowFieldIndices()
PivotDataModelPivotDataModel.calculate() is called. Otherwise, it
will return null.
getRowFieldIndices in interface IPivotDataModelgetRowFieldIndices in class PivotDataModelpublic PivotField[] getColumnFields()
PivotDataModelPivotDataModel.calculate() is called. Otherwise, it will return null.
getColumnFields in interface IPivotDataModelgetColumnFields in class PivotDataModelpublic int[] getColumnFieldIndices()
PivotDataModelPivotDataModel.calculate() is called. Otherwise,
it will return null.
getColumnFieldIndices in interface IPivotDataModelgetColumnFieldIndices in class PivotDataModelpublic PivotField[] getDataFields()
PivotDataModelPivotDataModel.calculate() is called. Otherwise, it will return null.
getDataFields in interface IPivotDataModelgetDataFields in class PivotDataModelpublic void resetDataFields()
IPivotDataModel
resetDataFields in interface IPivotDataModelresetDataFields in class PivotDataModelpublic int[] getDataFieldIndices()
PivotDataModelPivotDataModel.calculate() is called. Otherwise, it
will return null.
getDataFieldIndices in interface IPivotDataModelgetDataFieldIndices in class PivotDataModelpublic PivotField[] getFilterFields()
PivotDataModelPivotDataModel.calculate() is called. Otherwise, it will return null.
getFilterFields in interface IPivotDataModelgetFilterFields in class PivotDataModelpublic int[] getFilterFieldIndices()
PivotDataModelPivotDataModel.calculate() is called. Otherwise,
it will return null.
getFilterFieldIndices in interface IPivotDataModelgetFilterFieldIndices in class PivotDataModelpublic PivotField[] getUnassignedFields()
PivotDataModelPivotDataModel.calculate() is called. Otherwise, it will return
null.
getUnassignedFields in interface IPivotDataModelgetUnassignedFields in class PivotDataModelpublic int[] getUnassignedFieldIndices()
PivotDataModelPivotDataModel.calculate() is called.
Otherwise, it will return null.
getUnassignedFieldIndices in interface IPivotDataModelgetUnassignedFieldIndices in class PivotDataModelpublic boolean isAggregateMode()
PivotDataModelAggregateTableModel to show the actual cell values for the matched keys. By default, the
actual values will not be displayed. Typically you should setSummaryMode(false).
Default is false.
isAggregateMode in interface IPivotDataModelisAggregateMode in class PivotDataModelprotected HeaderTableModel createRowHeaderTableModel(CompoundKey[] keys)
PivotDataModel
createRowHeaderTableModel in class PivotDataModelkeys - the row keys.
protected HeaderTableModel createColumnHeaderTableModel(CompoundKey[] keys)
PivotDataModel
createColumnHeaderTableModel in class PivotDataModelkeys - the column keys.
public CompoundKey[] getRowKeys()
PivotValueProvider
getRowKeys in interface PivotValueProvidergetRowKeys in class PivotDataModelpublic CompoundKey[] getColumnKeys()
PivotValueProvider
getColumnKeys in interface PivotValueProvidergetColumnKeys in class PivotDataModelpublic void setRowMerger(PivotDataModel.RowMerger rowMerger)
PivotDataModel
setRowMerger in class PivotDataModelrowMerger - a new RowMergerPivotDataModel.RowMergerpublic PivotDataModel.RowMerger getRowMerger()
PivotDataModel
getRowMerger in class PivotDataModelPivotDataModel.RowMergerpublic void setHideSingleDataField(boolean hideSingleDataField)
setHideSingleDataField in interface IPivotDataModelsetHideSingleDataField in class PivotDataModelpublic void setAlwaysRowDataFields(boolean alwaysRowDataFields)
PivotDataModel
setAlwaysRowDataFields in interface IPivotDataModelsetAlwaysRowDataFields in class PivotDataModelalwaysRowDataFields - true or false.public boolean isAlwaysRowDataFields()
PivotDataModel
isAlwaysRowDataFields in interface IPivotDataModelisAlwaysRowDataFields in class PivotDataModelpublic void setAlwaysColumnDataFields(boolean alwaysColumnDataFields)
PivotDataModel
setAlwaysColumnDataFields in interface IPivotDataModelsetAlwaysColumnDataFields in class PivotDataModelalwaysColumnDataFields - true or false.public boolean isAlwaysColumnDataFields()
PivotDataModel
isAlwaysColumnDataFields in interface IPivotDataModelisAlwaysColumnDataFields in class PivotDataModelpublic void setSummaryCalculator(SummaryCalculator summaryCalculator)
PivotDataModel
setSummaryCalculator in interface IPivotDataModelsetSummaryCalculator in class PivotDataModelsummaryCalculator - the summary calculator.public SummaryCalculator getSummaryCalculator()
PivotDataModel
getSummaryCalculator in interface IPivotDataModelgetSummaryCalculator in class PivotDataModelpublic void setSummaryCalculatorFactory(SummaryCalculatorFactory summaryCalculatorFactory)
PivotDataModelPivotDataModel.getSummaryCalculator() method to get
the SummaryCalculator.
setSummaryCalculatorFactory in interface IPivotDataModelsetSummaryCalculatorFactory in class PivotDataModelsummaryCalculatorFactory - the summary calculator factory.public SummaryCalculatorFactory getSummaryCalculatorFactory()
PivotDataModelPivotDataModel.calculateStatistics(PivotField, int, int, int, Object[]) method is called from a non-EDT. On EDT, we will use
PivotDataModel.getSummaryCalculator() method to get the SummaryCalculator.
getSummaryCalculatorFactory in interface IPivotDataModelgetSummaryCalculatorFactory in class PivotDataModelpublic void setSummaryLayer(boolean summaryLayer)
IPivotDataModel
setSummaryLayer in interface IPivotDataModelsetSummaryLayer in class PivotDataModelsummaryLayer - the flagpublic boolean isSummaryLayer()
IPivotDataModel
isSummaryLayer in interface IPivotDataModelisSummaryLayer in class PivotDataModelpublic void calculate()
PivotDataModelPivotTablePane.fieldsUpdated() method in order for the change to take effect.
calculate in interface IPivotDataModelcalculate in class PivotDataModelpublic boolean isAutoUpdate()
PivotDataModel
isAutoUpdate in interface IPivotDataModelisAutoUpdate in class PivotDataModelpublic void setAutoUpdate(boolean autoUpdate)
PivotDataModelPivotDataModel.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
PivotDataModel.calculate() just like before.
setAutoUpdate in interface IPivotDataModelsetAutoUpdate in class PivotDataModelautoUpdate - true or false.public boolean isRowDataFields()
PivotDataModel
isRowDataFields in interface IPivotDataModelisRowDataFields in class PivotDataModelpublic boolean isColumnDataFields()
PivotDataModel
isColumnDataFields in interface IPivotDataModelisColumnDataFields in class PivotDataModelpublic boolean isSingleValueMode()
PivotDataModel
isSingleValueMode in interface IPivotDataModelisSingleValueMode in interface PivotValueProviderisSingleValueMode in class PivotDataModelpublic void setSingleValueMode(boolean singleValueMode)
PivotDataModel
setSingleValueMode in interface IPivotDataModelsetSingleValueMode in interface PivotValueProvidersetSingleValueMode in class PivotDataModelsingleValueMode - true or false.public boolean verify()
PivotDataModel
verify in interface IPivotDataModelverify in class PivotDataModelpublic boolean isCacheEnabled()
public void setCacheEnabled(boolean cacheEnabled)
public void pivotValueProviderEventHandler(PivotValueProviderEvent event)
pivotValueProviderEventHandler in interface PivotValueProviderListener
public List<Integer> getDataAt(CompoundKey rowKey,
CompoundKey columnKey)
PivotDataModel
getDataAt in interface IPivotDataModelgetDataAt in class PivotDataModelrowKey - the row compound keycolumnKey - the column compound key
PivotDataModel.getDataSource().public boolean isAdjusting()
PivotDataModelPivotField.setSelectedPossibleValues(Object[]).
By default, isAdjusting is false, so setSelectedPossibleValues will call calculate() and bothHeaderUpdated(). If
isAdjusting is true, they will be not be called.
isAdjusting in interface IPivotDataModelisAdjusting in class PivotDataModelpublic void setAdjusting(boolean adjusting)
PivotDataModel
setAdjusting in interface IPivotDataModelsetAdjusting in class PivotDataModeladjusting - true or false.public boolean isSummaryMode()
PivotDataModel
isSummaryMode in interface IPivotDataModelisSummaryMode in interface PivotValueProviderisSummaryMode in class PivotDataModelpublic void setSummaryMode(boolean summaryMode)
PivotDataModel
setSummaryMode in interface IPivotDataModelsetSummaryMode in interface PivotValueProvidersetSummaryMode in class PivotDataModelsummaryMode - true to set to summary mode. Otherwise false.PivotDataModel.isSummaryMode()public int getRowHeaderRowIndexAt(int rowIndex)
PivotDataModel
getRowHeaderRowIndexAt in interface IPivotDataModelgetRowHeaderRowIndexAt in class PivotDataModelrowIndex - the row at the original table model.
public int getColumnHeaderColumnIndexAt(int rowIndex)
PivotDataModel
getColumnHeaderColumnIndexAt in interface IPivotDataModelgetColumnHeaderColumnIndexAt in class PivotDataModelrowIndex - the row at the original table model.
@Deprecated
protected Values[] collectChildrenValues(Values parentValues,
boolean isRowValues,
int summaryType)
protected Values[] collectChildrenValues(Values parentValues,
boolean isRowValues,
int summaryType,
int statisticsType)
parentValues - the parent Values instanceisRowValues - if this is a row Values or column ValuessummaryType - the summary typestatisticsType - the statistics type
protected Object[] collectValuesForCell(PivotField field,
Values rowKeys,
Values columnKeys,
int summaryType)
collectValuesForCell in class PivotDataModel
public Object getValueAt(PivotField field,
Values rowKeys,
Values columnKeys)
IPivotDataModel
getValueAt in interface IPivotDataModelgetValueAt in interface PivotValueProvidergetValueAt in class PivotDataModelfield - the data fieldrowKeys - row value keys in the corresponding row header tablecolumnKeys - column value keys in the corresponding column header table
protected Object calculateStatistics(RunningSummary runningSummary,
Object[] objects)
public void setComputeAffectedCellOnUpdate(boolean computeAffectedCellOnUpdate)
setComputeAffectedCellOnUpdate in class PivotDataModelcomputeAffectedCellOnUpdate - the flagpublic boolean isRunningCalculateSummary()
setRunningCalculateSummary(boolean)public void setRunningCalculateSummary(boolean runningCalculateSummary)
runningCalculateSummary - the flag
|
JIDE 3.5.15 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||