|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.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 PivotDataModel
tableModel
- the new original table model.public void initialize()
PivotDataModel
PivotDataModel.calculate()
. If only the data is changed, just PivotDataModel.calculate()
is enough.
initialize
in interface IPivotDataModel
initialize
in class PivotDataModel
protected PivotField createPivotField(TableModel tableModel, int columnIndex)
public void tableChanged(TableModelEvent e)
tableChanged
in interface TableModelListener
e
- the table model eventprotected void handleFieldPropertyEvent(PropertyChangeEvent evt)
handleFieldPropertyEvent
in class PivotDataModel
public TableModel getTableModel()
PivotDataModel
PivotDataSource
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 PivotDataModel
public void setDataSource(PivotDataSource dataSource)
PivotDataModel
setDataSource
in interface IPivotDataModel
setDataSource
in class PivotDataModel
dataSource
- the new data source.public PivotDataSource getDataSource()
PivotDataModel
getDataSource
in interface IPivotDataModel
getDataSource
in class PivotDataModel
public int getStatisticsType(Values rowValues, Values columnValues, PivotField dataField)
PivotValueProvider
PivotConstants.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 PivotValueProvider
getStatisticsType
in class PivotDataModel
rowValues
- the row valuescolumnValues
- the column valuesdataField
- the data field
public PivotField getField(String name)
PivotDataModel
getField
in interface IPivotDataModel
getField
in class PivotDataModel
name
- the field name
public PivotField getField(int index)
PivotDataModel
getField
in interface IPivotDataModel
getField
in class PivotDataModel
index
- the field index
public PivotField[] getFields()
PivotDataModel
getFields
in interface IPivotDataModel
getFields
in class PivotDataModel
public void updateFields()
updateFields
in interface IPivotDataModel
updateFields
in class PivotDataModel
public boolean isCalculating()
PivotValueProvider
isCalculating
in interface PivotValueProvider
isCalculating
in class PivotDataModel
public Object[] getPossibleValues(PivotField field)
PivotValueProvider
getPossibleValues
in interface IPivotDataModel
getPossibleValues
in interface PivotValueProvider
getPossibleValues
in class PivotDataModel
field
- the pivot field
public PivotField[] getRowFields()
PivotDataModel
PivotDataModel.calculate()
is called. Otherwise, it will return null.
getRowFields
in interface IPivotDataModel
getRowFields
in class PivotDataModel
public int[] getRowFieldIndices()
PivotDataModel
PivotDataModel.calculate()
is called. Otherwise, it
will return null.
getRowFieldIndices
in interface IPivotDataModel
getRowFieldIndices
in class PivotDataModel
public PivotField[] getColumnFields()
PivotDataModel
PivotDataModel.calculate()
is called. Otherwise, it will return null.
getColumnFields
in interface IPivotDataModel
getColumnFields
in class PivotDataModel
public int[] getColumnFieldIndices()
PivotDataModel
PivotDataModel.calculate()
is called. Otherwise,
it will return null.
getColumnFieldIndices
in interface IPivotDataModel
getColumnFieldIndices
in class PivotDataModel
public PivotField[] getDataFields()
PivotDataModel
PivotDataModel.calculate()
is called. Otherwise, it will return null.
getDataFields
in interface IPivotDataModel
getDataFields
in class PivotDataModel
public void resetDataFields()
IPivotDataModel
resetDataFields
in interface IPivotDataModel
resetDataFields
in class PivotDataModel
public int[] getDataFieldIndices()
PivotDataModel
PivotDataModel.calculate()
is called. Otherwise, it
will return null.
getDataFieldIndices
in interface IPivotDataModel
getDataFieldIndices
in class PivotDataModel
public PivotField[] getFilterFields()
PivotDataModel
PivotDataModel.calculate()
is called. Otherwise, it will return null.
getFilterFields
in interface IPivotDataModel
getFilterFields
in class PivotDataModel
public int[] getFilterFieldIndices()
PivotDataModel
PivotDataModel.calculate()
is called. Otherwise,
it will return null.
getFilterFieldIndices
in interface IPivotDataModel
getFilterFieldIndices
in class PivotDataModel
public PivotField[] getUnassignedFields()
PivotDataModel
PivotDataModel.calculate()
is called. Otherwise, it will return
null.
getUnassignedFields
in interface IPivotDataModel
getUnassignedFields
in class PivotDataModel
public int[] getUnassignedFieldIndices()
PivotDataModel
PivotDataModel.calculate()
is called.
Otherwise, it will return null.
getUnassignedFieldIndices
in interface IPivotDataModel
getUnassignedFieldIndices
in class PivotDataModel
public boolean isAggregateMode()
PivotDataModel
AggregateTableModel
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 IPivotDataModel
isAggregateMode
in class PivotDataModel
protected HeaderTableModel createRowHeaderTableModel(CompoundKey[] keys)
PivotDataModel
createRowHeaderTableModel
in class PivotDataModel
keys
- the row keys.
protected HeaderTableModel createColumnHeaderTableModel(CompoundKey[] keys)
PivotDataModel
createColumnHeaderTableModel
in class PivotDataModel
keys
- the column keys.
public CompoundKey[] getRowKeys()
PivotValueProvider
getRowKeys
in interface PivotValueProvider
getRowKeys
in class PivotDataModel
public CompoundKey[] getColumnKeys()
PivotValueProvider
getColumnKeys
in interface PivotValueProvider
getColumnKeys
in class PivotDataModel
public void setRowMerger(PivotDataModel.RowMerger rowMerger)
PivotDataModel
setRowMerger
in class PivotDataModel
rowMerger
- a new RowMergerPivotDataModel.RowMerger
public PivotDataModel.RowMerger getRowMerger()
PivotDataModel
getRowMerger
in class PivotDataModel
PivotDataModel.RowMerger
public void setHideSingleDataField(boolean hideSingleDataField)
setHideSingleDataField
in interface IPivotDataModel
setHideSingleDataField
in class PivotDataModel
public void setAlwaysRowDataFields(boolean alwaysRowDataFields)
PivotDataModel
setAlwaysRowDataFields
in interface IPivotDataModel
setAlwaysRowDataFields
in class PivotDataModel
alwaysRowDataFields
- true or false.public boolean isAlwaysRowDataFields()
PivotDataModel
isAlwaysRowDataFields
in interface IPivotDataModel
isAlwaysRowDataFields
in class PivotDataModel
public void setAlwaysColumnDataFields(boolean alwaysColumnDataFields)
PivotDataModel
setAlwaysColumnDataFields
in interface IPivotDataModel
setAlwaysColumnDataFields
in class PivotDataModel
alwaysColumnDataFields
- true or false.public boolean isAlwaysColumnDataFields()
PivotDataModel
isAlwaysColumnDataFields
in interface IPivotDataModel
isAlwaysColumnDataFields
in class PivotDataModel
public void setSummaryCalculator(SummaryCalculator summaryCalculator)
PivotDataModel
setSummaryCalculator
in interface IPivotDataModel
setSummaryCalculator
in class PivotDataModel
summaryCalculator
- the summary calculator.public SummaryCalculator getSummaryCalculator()
PivotDataModel
getSummaryCalculator
in interface IPivotDataModel
getSummaryCalculator
in class PivotDataModel
public void setSummaryCalculatorFactory(SummaryCalculatorFactory summaryCalculatorFactory)
PivotDataModel
PivotDataModel.getSummaryCalculator()
method to get
the SummaryCalculator.
setSummaryCalculatorFactory
in interface IPivotDataModel
setSummaryCalculatorFactory
in class PivotDataModel
summaryCalculatorFactory
- the summary calculator factory.public SummaryCalculatorFactory getSummaryCalculatorFactory()
PivotDataModel
PivotDataModel.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 IPivotDataModel
getSummaryCalculatorFactory
in class PivotDataModel
public void setSummaryLayer(boolean summaryLayer)
IPivotDataModel
setSummaryLayer
in interface IPivotDataModel
setSummaryLayer
in class PivotDataModel
summaryLayer
- the flagpublic boolean isSummaryLayer()
IPivotDataModel
isSummaryLayer
in interface IPivotDataModel
isSummaryLayer
in class PivotDataModel
public void calculate()
PivotDataModel
PivotTablePane.fieldsUpdated()
method in order for the change to take effect.
calculate
in interface IPivotDataModel
calculate
in class PivotDataModel
public boolean isAutoUpdate()
PivotDataModel
isAutoUpdate
in interface IPivotDataModel
isAutoUpdate
in class PivotDataModel
public void setAutoUpdate(boolean autoUpdate)
PivotDataModel
PivotDataModel.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 IPivotDataModel
setAutoUpdate
in class PivotDataModel
autoUpdate
- true or false.public boolean isRowDataFields()
PivotDataModel
isRowDataFields
in interface IPivotDataModel
isRowDataFields
in class PivotDataModel
public boolean isColumnDataFields()
PivotDataModel
isColumnDataFields
in interface IPivotDataModel
isColumnDataFields
in class PivotDataModel
public boolean isSingleValueMode()
PivotDataModel
isSingleValueMode
in interface IPivotDataModel
isSingleValueMode
in interface PivotValueProvider
isSingleValueMode
in class PivotDataModel
public void setSingleValueMode(boolean singleValueMode)
PivotDataModel
setSingleValueMode
in interface IPivotDataModel
setSingleValueMode
in interface PivotValueProvider
setSingleValueMode
in class PivotDataModel
singleValueMode
- true or false.public boolean verify()
PivotDataModel
verify
in interface IPivotDataModel
verify
in class PivotDataModel
public 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 IPivotDataModel
getDataAt
in class PivotDataModel
rowKey
- the row compound keycolumnKey
- the column compound key
PivotDataModel.getDataSource()
.public boolean isAdjusting()
PivotDataModel
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.
isAdjusting
in interface IPivotDataModel
isAdjusting
in class PivotDataModel
public void setAdjusting(boolean adjusting)
PivotDataModel
setAdjusting
in interface IPivotDataModel
setAdjusting
in class PivotDataModel
adjusting
- true or false.public boolean isSummaryMode()
PivotDataModel
isSummaryMode
in interface IPivotDataModel
isSummaryMode
in interface PivotValueProvider
isSummaryMode
in class PivotDataModel
public void setSummaryMode(boolean summaryMode)
PivotDataModel
setSummaryMode
in interface IPivotDataModel
setSummaryMode
in interface PivotValueProvider
setSummaryMode
in class PivotDataModel
summaryMode
- true to set to summary mode. Otherwise false.PivotDataModel.isSummaryMode()
public int getRowHeaderRowIndexAt(int rowIndex)
PivotDataModel
getRowHeaderRowIndexAt
in interface IPivotDataModel
getRowHeaderRowIndexAt
in class PivotDataModel
rowIndex
- the row at the original table model.
public int getColumnHeaderColumnIndexAt(int rowIndex)
PivotDataModel
getColumnHeaderColumnIndexAt
in interface IPivotDataModel
getColumnHeaderColumnIndexAt
in class PivotDataModel
rowIndex
- 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 IPivotDataModel
getValueAt
in interface PivotValueProvider
getValueAt
in class PivotDataModel
field
- 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 PivotDataModel
computeAffectedCellOnUpdate
- 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 |