|
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
public class PivotDataModel
The model that contains the data for pivot table. It takes any table model as input. Then you can getField(String)
method to get the PivotField to specify different settings such as which ones are row fields,
column fields, filter fields or data fields, do you want to calculate subtotals, the sort order. There are also a few
settings on PivotDataModel itself such as grand total. Once you setup everything, you can call calculate()
to generate pivot data.
Nested Class Summary | |
---|---|
static interface |
PivotDataModel.RowMerger
An interface to merge the rows when they have the same row and column fields. |
Field Summary | |
---|---|
protected PivotDataSource |
_dataSource
|
protected EventListenerList |
listenerList
|
static String |
PROPERTY_HIDE_REDUNDANT_SUBTOTAL
|
static String |
PROPERTY_HIDE_SINGLE_DATA_FIELD
|
static String |
PROPERTY_SHOW_GRAND_TOTAL_FOR_COLUMN
|
static String |
PROPERTY_SHOW_GRAND_TOTAL_FOR_ROW
|
static String |
PROPERTY_SHOW_SUBTOTAL_AS_CHILD
|
Constructor Summary | |
---|---|
PivotDataModel()
|
|
PivotDataModel(PivotDataSource dataSource)
Creates a PivotDataModel using PivotDataSource interface. |
|
PivotDataModel(TableModel tableModel)
Creates a PivotDataModel using table model as the data source. |
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 dataField,
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 |
addPivotValueProviderListener(PivotValueProviderListener l)
Add PivotValueProviderListener so that the listener could know when calculation starts or ends. |
protected boolean |
addPrefixRowIndex(CompoundKey rowKey,
CompoundKey columnKey,
int rowIndex)
|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. |
protected boolean |
addRowIndex(CompoundKey rowKey,
CompoundKey columnKey,
int rowIndex)
|
void |
calculate()
Calculates the pivot data. |
protected Object |
calculateStatistics(PivotField field,
int rowIndex,
int columnIndex,
int summaryType,
Object[] objects)
Deprecated. replaced by calculateStatistics(PivotField, Values, Values, int, Object[]) |
protected Object |
calculateStatistics(PivotField field,
Values rowValues,
Values columnValues,
int summaryType,
Object[] objects)
Calculate statistics for the cell with the same rowValues and the same columnValues in DataTable. |
void |
clearHiddenColumns()
Clears the hidden columns. |
void |
clearHiddenValues()
Clears the hidden values. |
protected Object[] |
collectValuesForCell(PivotField field,
int rowIndex,
int columnIndex,
int summaryType)
|
protected Object[] |
collectValuesForCell(PivotField field,
Values rowKeys,
Values columnKeys,
int summaryType)
|
protected HeaderTableModel |
createColumnHeaderTableModel(CompoundKey[] keys)
Creates the column header table model. |
protected DataTableModel |
createDataTableModel()
Creates DataTableModel. |
protected TableModelPivotDataSource |
createDefaultPivotDataSource(TableModel tableModel)
Creates default PivotDataSource which is TableModelPivotDataSource. |
protected com.jidesoft.pivot.PivotDataCube |
createPivotDataCube()
|
protected PivotField |
createPivotField(PivotDataSource dataSource,
int columnIndex)
Creates the PivotField . |
protected HeaderTableModel |
createRowHeaderTableModel(CompoundKey[] keys)
Creates the row header table model. |
void |
firePivotValueProviderChanged(int type)
|
void |
firePivotValueProviderChanged(int type,
Object object)
|
protected void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
Support for reporting property changes for boolean properties. |
void |
forceCalculate()
Ask PivotValueProvider to start calculate. |
PivotCellStyleProvider |
getCellStyleProvider()
Gets the PivotCellStyleProvider. |
int |
getColumnAt(int actualRow)
Gets the closest column index in DataTable that includes the actual row index in the original 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. |
PivotDataEditingProvider |
getColumnHeaderEditingProvider()
Gets the PivotDataEditingProvider for the column header table. |
HeaderTableModel |
getColumnHeaderTableModel()
Gets the column header table model. |
CompoundKey[] |
getColumnKeys()
Get column key array. |
protected CompoundKey |
getCompoundKeyAt(int rowIndex,
int areaType)
Gets the designated compound key from the row index in the data source. |
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. |
protected int[] |
getFieldIndices(PivotField[] fields)
|
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. |
PivotValueProviderListener[] |
getPivotValueProviderListeners()
|
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)
Retrieve the possible values for the designated field. |
int |
getRowAt(int actualRow)
Gets the closest row index in DataTable that includes the actual row index in the original table model. |
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. |
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)
|
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()
Checks if the pivot data model works in aggregate mode. |
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 |
isAutoSortKeys()
Checks whether the CompoundKeys automatically are sorted. |
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 |
isCalculating()
Returns if PivotValueProvider is calculating. |
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 |
isComputeAffectedCellOnUpdate()
Get the flag indicating that if the PivotValueProviderEvent will contain the affected cells information on original data model change scenario. |
boolean |
isDisplayGrandTotalFirst()
Checks if the grand total is displayed as the first column (row). |
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 |
isHideExpandIconOnSingleRow()
Get the flag indicating if the expand/collapse icon will be hidden if there is only one row as its child. |
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. |
static boolean |
isUseComparable()
Checks the useComparable flag. |
static boolean |
isValueImmutable()
Checks the valueImmutable flag. |
boolean |
isValuesVisible(Values values)
Checks if the Values is visible. |
protected void |
manageCompoundKeys()
Manages CompoundKeys after calculation to fill in some necessary CompoundKeys without adding dummy records in the original table model or removing some unnecessary CompoundKeys without removing records in the original table model. |
protected void |
removeColumnKey(CompoundKey columnKey)
Removes the CompoundKey in column header area. |
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 |
removePivotValueProviderListener(PivotValueProviderListener l)
Remove registered PivotValueProviderListener. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. |
protected void |
removeRowKey(CompoundKey rowKey)
Removes the CompoundKey in row header area. |
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 |
setAutoSortKeys(boolean autoSortKeys)
Sets the flag whether the CompoundKeys should be automatically sorted when calcuate() is called. |
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 |
setComputeAffectedCellOnUpdate(boolean computeAffectedCellOnUpdate)
Set the flag indicating that if the PivotValueProviderEvent will contain the affected cells information on original data model change scenario. |
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 |
setHideExpandIconOnSingleRow(boolean hideExpandIconOnSingleRow)
Set the flag indicating if the expand/collapse icon will be hidden if there is only one row as its child. |
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 keepRowChildrenOnSummaryFilter)
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 |
setOriginalTableModel(TableModel tableModel)
Sets the original table model. |
void |
setPivotFields(PivotField[] rowFields,
PivotField[] columnFields,
PivotField[] dataFields,
PivotField[] filterFields)
Pass fields information to PivotValueProvider for calculation. |
void |
setRowHeaderEditingProvider(PivotDataEditingProvider rowHeaderEditingProvider)
Sets the PivotDataEditingProvider that is used for the row header table. |
void |
setRowMerger(PivotDataModel.RowMerger rowMerger)
Sets the row merger. |
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. |
static void |
setUseComparable(boolean useComparable)
Sets the flag of useComparable. |
static void |
setValueImmutable(boolean valueImmutable)
Sets the valueImmutable flag. |
protected boolean |
shouldCalculateSummary(int rowIndex,
int columnIndex)
Check if the cell in the DataTable need calculate summary. |
protected CompoundKey[] |
sortCompoundKeys(CompoundKey[] keys,
PivotField[] fields)
Sorts the compound keys based on the sort order in the fields. |
protected boolean |
tableCellsUpdated(int column,
int firstRow,
int lastRow)
|
protected boolean |
tableRowsDeleted(int firstRow,
int lastRow)
|
protected boolean |
tableRowsInserted(int firstRow,
int lastRow)
|
protected boolean |
tableRowsUpdated(int firstRow,
int lastRow)
|
void |
updateFields()
|
protected void |
updateFilters()
|
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 |
Field Detail |
---|
protected PivotDataSource _dataSource
protected EventListenerList listenerList
public static final String PROPERTY_SHOW_GRAND_TOTAL_FOR_ROW
public static final String PROPERTY_SHOW_GRAND_TOTAL_FOR_COLUMN
public static final String PROPERTY_HIDE_REDUNDANT_SUBTOTAL
public static final String PROPERTY_SHOW_SUBTOTAL_AS_CHILD
public static final String PROPERTY_HIDE_SINGLE_DATA_FIELD
Constructor Detail |
---|
public PivotDataModel()
public PivotDataModel(TableModel tableModel)
tableModel
- the table model.public PivotDataModel(PivotDataSource dataSource)
dataSource
- the PivotDataSource
.Method Detail |
---|
protected com.jidesoft.pivot.PivotDataCube createPivotDataCube()
public void initialize()
calculate()
. If only the data is changed, just calculate()
is enough.
initialize
in interface IPivotDataModel
public void setOriginalTableModel(TableModel tableModel)
tableModel
- the new original table model.protected TableModelPivotDataSource createDefaultPivotDataSource(TableModel tableModel)
tableModel
- the table model.
public void setDataSource(PivotDataSource dataSource)
setDataSource
in interface IPivotDataModel
dataSource
- the new data source.protected boolean tableCellsUpdated(int column, int firstRow, int lastRow)
protected boolean addRowIndex(CompoundKey rowKey, CompoundKey columnKey, int rowIndex)
protected boolean addPrefixRowIndex(CompoundKey rowKey, CompoundKey columnKey, int rowIndex)
protected boolean tableRowsUpdated(int firstRow, int lastRow)
protected boolean tableRowsInserted(int firstRow, int lastRow)
protected boolean tableRowsDeleted(int firstRow, int lastRow)
protected PivotField createPivotField(PivotDataSource dataSource, int columnIndex)
PivotField
.
dataSource
- the data source.columnIndex
- the column index.
PivotField
.public TableModel getTableModel()
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.
public PivotDataSource getDataSource()
getDataSource
in interface IPivotDataModel
public PivotField getField(String name)
getField
in interface IPivotDataModel
name
- the field name
public PivotField getField(int index)
getField
in interface IPivotDataModel
index
- the field index
public PivotField[] getFields()
getFields
in interface IPivotDataModel
public void setPivotFields(PivotField[] rowFields, PivotField[] columnFields, PivotField[] dataFields, PivotField[] filterFields)
PivotValueProvider
setPivotFields
in interface PivotValueProvider
rowFields
- the row fields arraycolumnFields
- the column fields arraydataFields
- the data fields arrayfilterFields
- the filter fields arrayprotected void handleFieldPropertyEvent(PropertyChangeEvent evt)
public void updateFields()
updateFields
in interface IPivotDataModel
public void calculate()
PivotTablePane.fieldsUpdated()
method in order for the change to take effect.
calculate
in interface IPivotDataModel
public void forceCalculate()
PivotValueProvider
forceCalculate
in interface PivotValueProvider
protected void manageCompoundKeys()
addRowIndex(CompoundKey, CompoundKey, int)
with the
third parameter as -1 to fill in the extra compound keys. Please invoke removeColumnKey(CompoundKey)
or
removeRowKey(CompoundKey)
to remove unnecessary CompoundKeys.
Please make sure you will check the getRowFields()
and getColumnFields()
first to construct correct
CompoundKeys. Otherwise, the behavior might be very odd.
// assume the first column field is year, the second is quarter and the third is month.
for (int year = 1993; year <= 1997; year++) {
for (int quarter = 0; quarter <= 3; quarter++) {
for (int month = quarter * 3; month <= quarter * 3 + 2; month++) {
addRowIndex(CompoundKey.newInstance(new Object[0]), CompoundKey.newInstance(new Object[]{year, quarter, month}), -1);
}
}
}
protected void removeRowKey(CompoundKey rowKey)
manageCompoundKeys()
to remove some unnecessary row keys as you wish.
rowKey
- the CompoundKeyprotected void removeColumnKey(CompoundKey columnKey)
manageCompoundKeys()
to remove some unnecessary column keys as you wish.
columnKey
- the CompoundKeypublic boolean isCalculating()
PivotValueProvider
isCalculating
in interface PivotValueProvider
protected void updateFilters()
public boolean isCalculated()
calculate()
is called on this pivot data model. There is no setter for this flag. Only calculate()
will set it to true.
isCalculated
in interface IPivotDataModel
calculate()
is already called.protected CompoundKey getCompoundKeyAt(int rowIndex, int areaType)
rowIndex
- the row index in the data source.areaType
- AREA_ROW or AREA_COLUMN
public int getRowAt(int actualRow)
actualRow
- the actual row index in the original table model
public int getColumnAt(int actualRow)
actualRow
- the actual row index in the original table model
public void invalidateRowHeaderTableModel()
IPivotDataModel
invalidateRowHeaderTableModel
in interface IPivotDataModel
public void invalidateColumnHeaderTableModel()
IPivotDataModel
invalidateColumnHeaderTableModel
in interface IPivotDataModel
public void invalidateCornerTableModel()
IPivotDataModel
invalidateCornerTableModel
in interface IPivotDataModel
public void invalidateDataTableModel()
IPivotDataModel
invalidateDataTableModel
in interface IPivotDataModel
@Deprecated public Object[] getPossibleValues(int columnIndex)
getPossibleValues(int, java.util.Comparator)
instead. We didn't use this method anymore in our
code.
getPossibleValues
in interface IPivotDataModel
columnIndex
- the column index.
public Object[] getPossibleValues(PivotField field)
PivotValueProvider
getPossibleValues
in interface IPivotDataModel
getPossibleValues
in interface PivotValueProvider
field
- the pivot field
public Object[] getPossibleValues(int columnIndex, Comparator comparator)
Field.isPreferSelectedPossibleValues()
returns false, all values in Field.getFilteredPossibleValues()
will also present in the return array.
getPossibleValues
in interface IPivotDataModel
columnIndex
- the column indexcomparator
- the comparator
public HeaderTableModel getRowHeaderTableModel()
getRowHeaderTableModel
in interface IPivotDataModel
protected HeaderTableModel createRowHeaderTableModel(CompoundKey[] keys)
keys
- the row keys.
public TableModel getCornerTableModel()
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);
}
getCornerTableModel
in interface IPivotDataModel
public HeaderTableModel getColumnHeaderTableModel()
getColumnHeaderTableModel
in interface IPivotDataModel
protected HeaderTableModel createColumnHeaderTableModel(CompoundKey[] keys)
keys
- the column keys.
public TableModel getDataTableModel()
getDataTableModel
in interface IPivotDataModel
protected DataTableModel createDataTableModel()
public PivotField[] getRowFields()
calculate()
is called. Otherwise, it will return null.
getRowFields
in interface IPivotDataModel
protected int[] getFieldIndices(PivotField[] fields)
public int[] getRowFieldIndices()
calculate()
is called. Otherwise, it
will return null.
getRowFieldIndices
in interface IPivotDataModel
public PivotField[] getColumnFields()
calculate()
is called. Otherwise, it will return null.
getColumnFields
in interface IPivotDataModel
public int[] getColumnFieldIndices()
calculate()
is called. Otherwise,
it will return null.
getColumnFieldIndices
in interface IPivotDataModel
public PivotField[] getDataFields()
calculate()
is called. Otherwise, it will return null.
getDataFields
in interface IPivotDataModel
public void resetDataFields()
IPivotDataModel
resetDataFields
in interface IPivotDataModel
public int[] getDataFieldIndices()
calculate()
is called. Otherwise, it
will return null.
getDataFieldIndices
in interface IPivotDataModel
public PivotField[] getFilterFields()
calculate()
is called. Otherwise, it will return null.
getFilterFields
in interface IPivotDataModel
public int[] getFilterFieldIndices()
calculate()
is called. Otherwise,
it will return null.
getFilterFieldIndices
in interface IPivotDataModel
public PivotField[] getUnassignedFields()
calculate()
is called. Otherwise, it will return
null.
getUnassignedFields
in interface IPivotDataModel
public int[] getUnassignedFieldIndices()
calculate()
is called.
Otherwise, it will return null.
getUnassignedFieldIndices
in interface IPivotDataModel
public List<Integer> getDataAt(int rowIndex, int columnIndex)
getDataAt
in interface IPivotDataModel
rowIndex
- the row index relative to DataTableModel.columnIndex
- the column index relative to DataTableModel.
getDataSource()
.public List<Integer> getDataAt(CompoundKey rowKey, CompoundKey columnKey)
getDataAt
in interface IPivotDataModel
rowKey
- the row compound keycolumnKey
- the column compound key
getDataSource()
.protected CompoundKey[] sortCompoundKeys(CompoundKey[] keys, PivotField[] fields)
keys
- the list of CompoundKeys.fields
- the array of the fields.
public boolean isRowDataFields()
isRowDataFields
in interface IPivotDataModel
public boolean isColumnDataFields()
isColumnDataFields
in interface IPivotDataModel
public boolean isAlwaysColumnDataFields()
isAlwaysColumnDataFields
in interface IPivotDataModel
public void setAlwaysColumnDataFields(boolean alwaysColumnDataFields)
setAlwaysColumnDataFields
in interface IPivotDataModel
alwaysColumnDataFields
- true or false.public boolean isAlwaysRowDataFields()
isAlwaysRowDataFields
in interface IPivotDataModel
public void setAlwaysRowDataFields(boolean alwaysRowDataFields)
setAlwaysRowDataFields
in interface IPivotDataModel
alwaysRowDataFields
- true or false.public boolean isHideSingleDataField()
isHideSingleDataField
in interface IPivotDataModel
public void setHideSingleDataField(boolean hideSingleDataField)
setHideSingleDataField
in interface IPivotDataModel
public boolean isShowGrandTotalForRow()
isShowGrandTotalForRow
in interface IPivotDataModel
public void setShowGrandTotalForRow(boolean showGrandTotalForRow)
PivotTablePane.rowHeaderUpdated()
or
PivotTablePane.bothHeadersUpdated()
if you also changed grandTotalForColumn.
setShowGrandTotalForRow
in interface IPivotDataModel
showGrandTotalForRow
- whether show grand total for row.public boolean isShowGrandTotalForColumn()
isShowGrandTotalForColumn
in interface IPivotDataModel
public void setShowGrandTotalForColumn(boolean showGrandTotalForColumn)
PivotTablePane.columnHeaderUpdated()
or PivotTablePane.bothHeadersUpdated()
if you also changed
grandTotalForRow.
setShowGrandTotalForColumn
in interface IPivotDataModel
showGrandTotalForColumn
- whether show grand total for column.public PivotCellStyleProvider getCellStyleProvider()
getCellStyleProvider
in interface IPivotDataModel
public void setCellStyleProvider(PivotCellStyleProvider cellStyleProvider)
setCellStyleProvider
in interface IPivotDataModel
cellStyleProvider
- the cell style provider.public void setRowHeaderEditingProvider(PivotDataEditingProvider rowHeaderEditingProvider)
setRowHeaderEditingProvider
in interface IPivotDataModel
rowHeaderEditingProvider
- the date editing provider.public PivotDataEditingProvider getRowHeaderEditingProvider()
getRowHeaderEditingProvider
in interface IPivotDataModel
public void setColumnHeaderEditingProvider(PivotDataEditingProvider columnHeaderEditingProvider)
setColumnHeaderEditingProvider
in interface IPivotDataModel
columnHeaderEditingProvider
- the date editing provider.public PivotDataEditingProvider getColumnHeaderEditingProvider()
getColumnHeaderEditingProvider
in interface IPivotDataModel
public PivotDataEditingProvider getDataEditingProvider()
getDataEditingProvider
in interface IPivotDataModel
public void setDataEditingProvider(PivotDataEditingProvider dataEditingProvider)
setDataEditingProvider
in interface IPivotDataModel
dataEditingProvider
- the date editing provider.public SummaryCalculator getSummaryCalculator()
getSummaryCalculator
in interface IPivotDataModel
public void setSummaryCalculator(SummaryCalculator summaryCalculator)
setSummaryCalculator
in interface IPivotDataModel
summaryCalculator
- the summary calculator.public SummaryCalculatorFactory getSummaryCalculatorFactory()
calculateStatistics(PivotField, int, int, int, Object[])
method is called from a non-EDT. On EDT, we will use
getSummaryCalculator()
method to get the SummaryCalculator.
getSummaryCalculatorFactory
in interface IPivotDataModel
public void setSummaryCalculatorFactory(SummaryCalculatorFactory summaryCalculatorFactory)
getSummaryCalculator()
method to get
the SummaryCalculator.
setSummaryCalculatorFactory
in interface IPivotDataModel
summaryCalculatorFactory
- the summary calculator factory.public boolean isDisplayGrandTotalFirstForRow()
IPivotDataModel
isDisplayGrandTotalFirstForRow
in interface IPivotDataModel
public void setDisplayGrandTotalFirstForRow(boolean displayGrandTotalFirstForRow)
IPivotDataModel
setDisplayGrandTotalFirstForRow
in interface IPivotDataModel
displayGrandTotalFirstForRow
- true or false.public boolean isDisplayGrandTotalFirstForColumn()
IPivotDataModel
isDisplayGrandTotalFirstForColumn
in interface IPivotDataModel
public void setDisplayGrandTotalFirstForColumn(boolean displayGrandTotalFirstForColumn)
IPivotDataModel
setDisplayGrandTotalFirstForColumn
in interface IPivotDataModel
displayGrandTotalFirstForColumn
- true or false.public boolean isDisplayGrandTotalFirst()
isDisplayGrandTotalFirst
in interface IPivotDataModel
@Deprecated public void setDisplayGrandTotalFirst(boolean displayGrandTotalFirst)
setDisplayGrandTotalFirstForRow(boolean)
and setDisplayGrandTotalFirstForColumn(boolean)
setDisplayGrandTotalFirstForRow(boolean)
and setDisplayGrandTotalFirstForColumn(boolean)
.
setDisplayGrandTotalFirst
in interface IPivotDataModel
displayGrandTotalFirst
- true or false.public boolean isAutoUpdate()
isAutoUpdate
in interface IPivotDataModel
public void setAutoUpdate(boolean autoUpdate)
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.
setAutoUpdate
in interface IPivotDataModel
autoUpdate
- true or false.public boolean isAdjusting()
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
public void setAdjusting(boolean adjusting)
setAdjusting
in interface IPivotDataModel
adjusting
- true or false.public boolean isSummaryMode()
isSummaryMode
in interface IPivotDataModel
isSummaryMode
in interface PivotValueProvider
public void setSummaryMode(boolean summaryMode)
setSummaryMode
in interface IPivotDataModel
setSummaryMode
in interface PivotValueProvider
summaryMode
- true to set to summary mode. Otherwise false.isSummaryMode()
public boolean isAggregateMode()
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
public boolean isSingleValueMode()
isSingleValueMode
in interface IPivotDataModel
isSingleValueMode
in interface PivotValueProvider
public void setSingleValueMode(boolean singleValueMode)
setSingleValueMode
in interface IPivotDataModel
setSingleValueMode
in interface PivotValueProvider
singleValueMode
- true or false.public boolean verify()
verify
in interface IPivotDataModel
public int getRowHeaderRowIndexAt(int rowIndex)
getRowHeaderRowIndexAt
in interface IPivotDataModel
rowIndex
- the row at the original table model.
public int getColumnHeaderColumnIndexAt(int rowIndex)
getColumnHeaderColumnIndexAt
in interface IPivotDataModel
rowIndex
- the row at the original table model.
public static boolean isValueImmutable()
public static void setValueImmutable(boolean valueImmutable)
valueImmutable
- true or false.public static boolean isUseComparable()
public static void setUseComparable(boolean useComparable)
useComparable
- true or false.public boolean isHideSummaryValues()
isHideSummaryValues
in interface IPivotDataModel
public void setHideSummaryValues(boolean hideSummaryValues)
setHideSummaryValues
in interface IPivotDataModel
hideSummaryValues
- the flagisHideSummaryValues()
public boolean isKeepRowChildrenOnSummaryFilter()
IPivotDataModel
PivotField.isDataFieldFilterOnSummary()
isKeepRowChildrenOnSummaryFilter
in interface IPivotDataModel
public void setKeepRowChildrenOnSummaryFilter(boolean keepRowChildrenOnSummaryFilter)
IPivotDataModel
setKeepRowChildrenOnSummaryFilter
in interface IPivotDataModel
keepRowChildrenOnSummaryFilter
- the flagpublic boolean isHideExpandIconOnSingleRow()
setHideExpandIconOnSingleRow(boolean)
public void setHideExpandIconOnSingleRow(boolean hideExpandIconOnSingleRow)
hideExpandIconOnSingleRow
- the flagpublic boolean isLayoutDataFieldsFirst()
isLayoutDataFieldsFirst
in interface IPivotDataModel
setLayoutDataFieldsFirst(boolean)
public void setLayoutDataFieldsFirst(boolean layoutDataFieldsFirst)
setLayoutDataFieldsFirst
in interface IPivotDataModel
layoutDataFieldsFirst
- the flagpublic boolean isHighPerformanceMode()
IPivotDataModel
isHighPerformanceMode
in interface IPivotDataModel
IPivotDataModel.setHighPerformanceMode(boolean)
public void setHighPerformanceMode(boolean highPerformanceMode)
IPivotDataModel
setHighPerformanceMode
in interface IPivotDataModel
highPerformanceMode
- the flagpublic PivotDataModel.RowMerger getRowMerger()
PivotDataModel.RowMerger
public void setRowMerger(PivotDataModel.RowMerger rowMerger)
rowMerger
- a new RowMergerPivotDataModel.RowMerger
public boolean isAutoSortKeys()
public void setAutoSortKeys(boolean autoSortKeys)
autoSortKeys
- true or false.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
rowValues
- the row valuescolumnValues
- the column valuesdataField
- the data field
protected Object calculateStatistics(PivotField field, Values rowValues, Values columnValues, int summaryType, Object[] objects)
field
- the data fieldrowValues
- the row valuescolumnValues
- the column valuessummaryType
- the summary typeobjects
- the base values
@Deprecated protected Object calculateStatistics(PivotField field, int rowIndex, int columnIndex, int summaryType, Object[] objects)
calculateStatistics(PivotField, Values, Values, int, Object[])
field
- the data fieldrowIndex
- the row index in the data tablecolumnIndex
- the column index in the data tablesummaryType
- the summary typeobjects
- the base values
protected Object[] collectValuesForCell(PivotField field, Values rowKeys, Values columnKeys, int summaryType)
protected Object[] collectValuesForCell(PivotField field, int rowIndex, int columnIndex, int summaryType)
public Object getValueAt(PivotField field, Values rowKeys, Values columnKeys)
IPivotDataModel
getValueAt
in interface IPivotDataModel
getValueAt
in interface PivotValueProvider
field
- the data fieldrowKeys
- row value keys in the corresponding row header tablecolumnKeys
- column value keys in the corresponding column header table
protected boolean shouldCalculateSummary(int rowIndex, int columnIndex)
rowIndex
- the row index of the cellcolumnIndex
- the column index of the cell
public boolean isValuesVisible(Values values)
isValuesVisible
in interface IPivotDataModel
values
- the Values.
public void addHiddenValues(Values values)
addHiddenValues(new DefaultValues(new Object[]{1994, 2, 6});
addHiddenValues
in interface IPivotDataModel
values
- the Values.public void removeHiddenValues(Values values)
removeHiddenValues
in interface IPivotDataModel
values
- the Values.public void clearHiddenValues()
clearHiddenValues
in interface IPivotDataModel
public boolean hasHiddenValues()
hasHiddenValues
in interface IPivotDataModel
public Values[] getHiddenValues()
getHiddenValues
in interface IPivotDataModel
public boolean isColumnVisible(Values values, PivotField field)
IPivotDataModel
isColumnVisible
in interface IPivotDataModel
values
- the Valuesfield
- the data field
public void addHiddenColumn(Values values, PivotField field)
IPivotDataModel
IPivotDataModel.addHiddenColumn(Values, PivotField, String)
with the string as "15\t75\t75"
addHiddenColumn
in interface IPivotDataModel
values
- the Valuesfield
- the data fieldpublic void addHiddenColumn(Values values, PivotField dataField, String width)
IPivotDataModel
addHiddenColumn
in interface IPivotDataModel
values
- the ValuesdataField
- the data fieldwidth
- the width information before the column is hiddenpublic String removeHiddenColumn(Values values, PivotField field)
IPivotDataModel
removeHiddenColumn
in interface IPivotDataModel
values
- the Valuesfield
- the data field
public void clearHiddenColumns()
IPivotDataModel
clearHiddenColumns
in interface IPivotDataModel
public boolean hasHiddenColumns()
IPivotDataModel
hasHiddenColumns
in interface IPivotDataModel
public Object[][] getHiddenColumns()
IPivotDataModel
getHiddenColumns
in interface IPivotDataModel
public boolean isAllowEmptyColumnHeader()
isAllowEmptyColumnHeader
in interface IPivotDataModel
public void setAllowEmptyColumnHeader(boolean allowEmptyColumnHeader)
setAllowEmptyColumnHeader
in interface IPivotDataModel
allowEmptyColumnHeader
- true or false.public boolean isAllowEmptyRowHeader()
isAllowEmptyRowHeader
in interface IPivotDataModel
public void setAllowEmptyRowHeader(boolean allowEmptyRowHeader)
setAllowEmptyRowHeader
in interface IPivotDataModel
allowEmptyRowHeader
- true or false.public boolean isExpandByDefault()
isExpandByDefault
in interface IPivotDataModel
public void setExpandByDefault(boolean expandByDefault)
setExpandByDefault
in interface IPivotDataModel
expandByDefault
- true or false.public boolean isShowSubtotalAsChild()
IPivotDataModel
isShowSubtotalAsChild
in interface IPivotDataModel
IPivotDataModel.setShowSubtotalAsChild(boolean)
public void setShowSubtotalAsChild(boolean showSubtotalAsChild)
setShowSubtotalAsChild
in interface IPivotDataModel
showSubtotalAsChild
- true or false.public boolean isHideRedundantSubtotal()
isHideRedundantSubtotal
in interface IPivotDataModel
public void setHideRedundantSubtotal(boolean hideRedundantSubtotal)
setHideRedundantSubtotal
in interface IPivotDataModel
hideRedundantSubtotal
- true or false.isHideRedundantSubtotal()
public void addPivotValueProviderListener(PivotValueProviderListener l)
PivotValueProvider
addPivotValueProviderListener
in interface PivotValueProvider
l
- the listenerpublic void removePivotValueProviderListener(PivotValueProviderListener l)
PivotValueProvider
removePivotValueProviderListener
in interface PivotValueProvider
l
- the listenerpublic PivotValueProviderListener[] getPivotValueProviderListeners()
public void firePivotValueProviderChanged(int type)
public void firePivotValueProviderChanged(int type, Object object)
public CompoundKey[] getRowKeys()
PivotValueProvider
getRowKeys
in interface PivotValueProvider
public CompoundKey[] getColumnKeys()
PivotValueProvider
getColumnKeys
in interface PivotValueProvider
public boolean isSummaryLayer()
IPivotDataModel
isSummaryLayer
in interface IPivotDataModel
public void setSummaryLayer(boolean summaryLayer)
IPivotDataModel
setSummaryLayer
in interface IPivotDataModel
summaryLayer
- the flagprotected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
propertyName
- the property whose value has changedoldValue
- the property's previous valuenewValue
- the property's new valuepublic void addPropertyChangeListener(PropertyChangeListener listener)
listener
is null
, no exception is thrown and no action is performed.
listener
- the property change listener to be addedremovePropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener listener)
listener
- the PropertyChangeListener to be removedaddPropertyChangeListener(java.beans.PropertyChangeListener)
public boolean isComputeAffectedCellOnUpdate()
isAutoUpdate()
,
setComputeAffectedCellOnUpdate(boolean)
public void setComputeAffectedCellOnUpdate(boolean computeAffectedCellOnUpdate)
computeAffectedCellOnUpdate
- the flag
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |