JIDE 3.5.15

com.jidesoft.pivot
Interface PivotValueProvider

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

public interface PivotValueProvider


Method Summary
 void addPivotValueProviderListener(PivotValueProviderListener l)
          Add PivotValueProviderListener so that the listener could know when calculation starts or ends.
 void forceCalculate()
          Ask PivotValueProvider to start calculate.
 CompoundKey[] getColumnKeys()
          Get column key array.
 Object[] getPossibleValues(PivotField field)
          Retrieve the possible values for the designated field.
 CompoundKey[] getRowKeys()
          Get row key array.
 int getStatisticsType(Values rowValues, Values columnValues, PivotField dataField)
          Get the statistics layer.
 Object getValueAt(PivotField dataField, Values rowValues, Values columnValues)
          Retrieve the value for the data field with the designated row values and column values.
 boolean isCalculating()
          Returns if PivotValueProvider is calculating.
 boolean isSingleValueMode()
          The cells in the data table are actually summary of multiple rows in the original table model.
 boolean isSummaryMode()
          Checks if the pivot data model works in summary mode.
 void removePivotValueProviderListener(PivotValueProviderListener l)
          Remove registered PivotValueProviderListener.
 void setPivotFields(PivotField[] rowFields, PivotField[] columnFields, PivotField[] dataFields, PivotField[] filterFields)
          Pass fields information to PivotValueProvider for calculation.
 void setSingleValueMode(boolean singleValueMode)
          Sets the single value mode.
 void setSummaryMode(boolean summaryMode)
          Sets the flag for the summary mode.
 

Method Detail

getValueAt

Object getValueAt(PivotField dataField,
                  Values rowValues,
                  Values columnValues)
Retrieve the value for the data field with the designated row values and column values.

Parameters:
dataField - the data field
rowValues - row values in the corresponding row header table
columnValues - column values in the corresponding column header table
Returns:
the value from the cell.

getPossibleValues

Object[] getPossibleValues(PivotField field)
Retrieve the possible values for the designated field.

In general, you need consider the current filtering to return possible values appropriately.

Parameters:
field - the pivot field
Returns:
possible values array.

getRowKeys

CompoundKey[] getRowKeys()
Get row key array.

Returns:
the row key array.

getColumnKeys

CompoundKey[] getColumnKeys()
Get column key array.

Returns:
the column key array.

getStatisticsType

int getStatisticsType(Values rowValues,
                      Values columnValues,
                      PivotField dataField)
Get the statistics layer. By default, it should return 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.

Parameters:
rowValues - the row values
columnValues - the column values
dataField - the data field
Returns:
the statistics layer.

setPivotFields

void setPivotFields(PivotField[] rowFields,
                    PivotField[] columnFields,
                    PivotField[] dataFields,
                    PivotField[] filterFields)
Pass fields information to PivotValueProvider for calculation.

Parameters:
rowFields - the row fields array
columnFields - the column fields array
dataFields - the data fields array
filterFields - the filter fields array

forceCalculate

void forceCalculate()
Ask PivotValueProvider to start calculate. The calculation could be done in a separate thread so it does not mean that the calculation has completed after invoking this method. The pivot value user will wait for the PivotValueProviderEvent to get the information that the calculation has completed.

The upper level could call this method in any time. You need consider the performance on this scenario.


isCalculating

boolean isCalculating()
Returns if PivotValueProvider is calculating.

Returns:
true if it is calculating. Otherwise false.

addPivotValueProviderListener

void addPivotValueProviderListener(PivotValueProviderListener l)
Add PivotValueProviderListener so that the listener could know when calculation starts or ends.

Parameters:
l - the listener

removePivotValueProviderListener

void removePivotValueProviderListener(PivotValueProviderListener l)
Remove registered PivotValueProviderListener.

Parameters:
l - the listener

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.

JIDE 3.5.15