Class GroupByDataLayer<T>
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
-
- org.eclipse.nebula.widgets.nattable.layer.DataLayer
-
- org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByDataLayer<T>
-
- Type Parameters:
T
- The type of the row objects.
- All Implemented Interfaces:
Observer
,ILayer
,ILayerListener
,IUniqueIndexLayer
,IPersistable
public class GroupByDataLayer<T> extends DataLayer implements Observer
SpecializedDataLayer
that needs to be used in the body layer stack for adding the groupBy feature to a NatTable composition. Internally creates aTreeList
and aIDataProvider
for Objects, necessary as dynamically newGroupByObject
s will be added to theTreeList
by theGroupByTreeFormat
.This layer also supports calculating summary values for created groups. Note that it is necessary to call
initializeTreeComparator(ISortModel, IUniqueIndexLayer, boolean)
after creation to ensure that sorting is working correctly with the groupBy feature.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GroupByDataLayer.GroupDescriptorMatcher<T>
To find out if an element is part of a group
-
Field Summary
Fields Modifier and Type Field Description static String
GROUP_BY_COLUMN_PREFIX
Label prefix for labels that are added to cells for a group by object.static String
GROUP_BY_OBJECT
Label that indicates the shown tree item object as GroupByObjectstatic String
GROUP_BY_SUMMARY
Label that indicates the shown tree item object as GroupByObject and contains a summary value.static String
GROUP_BY_SUMMARY_COLUMN_PREFIX
Label prefix for labels that are added to cells for a group by object summary.-
Fields inherited from class org.eclipse.nebula.widgets.nattable.layer.DataLayer
columnWidthConfig, dataProvider, DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_HEIGHT, PERSISTENCE_KEY_COLUMN_WIDTH, PERSISTENCE_KEY_ROW_HEIGHT, rowHeightConfig
-
Fields inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
commandHandlers, eventHandlers, eventHelperLock, layerPainter
-
Fields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
DOT, VALUE_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description GroupByDataLayer(GroupByModel groupByModel, ca.odell.glazedlists.EventList<T> eventList, IColumnAccessor<T> columnAccessor)
Create a newGroupByDataLayer
with the given configuration that: uses the defaultGroupByExpansionModel
which shows all nodes initially expanded has smoothUpdates enabled which leads to showing the summary values that were calculated before until the new value calculation is done uses the defaultGroupByDataLayerConfiguration
does not support groupBy summary values because of the missingIConfigRegistry
referenceGroupByDataLayer(GroupByModel groupByModel, ca.odell.glazedlists.EventList<T> eventList, IColumnAccessor<T> columnAccessor, boolean useDefaultConfiguration)
Create a newGroupByDataLayer
with the given configuration that: uses the defaultGroupByExpansionModel
which shows all nodes initially expanded has smoothUpdates enabled which leads to showing the summary values that were calculated before until the new value calculation is done does not support groupBy summary values because of the missingIConfigRegistry
referenceGroupByDataLayer(GroupByModel groupByModel, ca.odell.glazedlists.EventList<T> eventList, IColumnAccessor<T> columnAccessor, ca.odell.glazedlists.TreeList.ExpansionModel<Object> expansionModel, IConfigRegistry configRegistry, boolean smoothUpdates, boolean useDefaultConfiguration)
Create a newGroupByDataLayer
with the given configuration.GroupByDataLayer(GroupByModel groupByModel, ca.odell.glazedlists.EventList<T> eventList, IColumnAccessor<T> columnAccessor, IConfigRegistry configRegistry)
Create a newGroupByDataLayer
with the given configuration that: uses the defaultGroupByExpansionModel
which shows all nodes initially expanded has smoothUpdates enabled which leads to showing the summary values that were calculated before until the new value calculation is done uses the defaultGroupByDataLayerConfiguration
GroupByDataLayer(GroupByModel groupByModel, ca.odell.glazedlists.EventList<T> eventList, IColumnAccessor<T> columnAccessor, IConfigRegistry configRegistry, boolean useDefaultConfiguration)
Create a newGroupByDataLayer
with the given configuration that: uses the defaultGroupByExpansionModel
which shows all nodes initially expanded has smoothUpdates enabled which leads to showing the summary values that were calculated before until the new value calculation is doneGroupByDataLayer(GroupByModel groupByModel, ca.odell.glazedlists.EventList<T> eventList, IColumnAccessor<T> columnAccessor, IConfigRegistry configRegistry, boolean smoothUpdates, boolean useDefaultConfiguration)
Create a newGroupByDataLayer
with the given configuration that: uses the defaultGroupByExpansionModel
which shows all nodes initially expanded
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearCache()
Clear the internal cache to trigger new calculations.protected GroupByTreeFormat<T>
createGroupByTreeFormat(GroupByModel groupByModel, IColumnAccessor<T> groupByColumnAccessor)
boolean
doCommand(ILayerCommand command)
Opportunity to respond to a command as it flows down the stack.LabelStack
getConfigLabelsByPosition(int columnPosition, int rowPosition)
Returns the config labels for the cell at the given coordinates.Object
getDataValueByPosition(int columnPosition, int rowPosition)
Returns the data value for the cell at the given coordinates.Object
getDataValueByPosition(int columnPosition, int rowPosition, LabelStack labelStack, boolean calculateInBackground)
This method is used to retrieve a data value of anILayerCell
.IGroupBySummaryProvider<T>
getGroupBySummaryProvider(LabelStack labelStack)
protected ca.odell.glazedlists.matchers.Matcher<T>
getGroupDescriptorMatcher(GroupByObject group, IColumnAccessor<T> columnAccessor)
List<T>
getItemsInGroup(GroupByObject group)
Get the list of the items in a group.Collection<String>
getProvidedLabels()
ISortModel
getSortModel()
ca.odell.glazedlists.TreeList<Object>
getTreeList()
GlazedListTreeRowModel<Object>
getTreeRowModel()
ICalculatedValueCache
getValueCache()
void
handleLayerEvent(ILayerEvent event)
Handle layer event notification.void
initializeTreeComparator(ISortModel sortModel, IUniqueIndexLayer treeLayer, boolean setDataLayerReference)
Initialize theComparator
that is used to build the tree structure.void
killCache()
Clears all values in the internal cache to trigger new calculations.void
setComparator(IGroupByComparator<T> comparator)
void
setValueCache(ICalculatedValueCache valueCache)
Set theICalculatedValueCache
that should be used internally to calculate the summary values in a background thread and cache the results.void
update(Observable o, Object arg)
protected void
updateTree()
Method to update the tree list after filter or TreeList.Format changed.-
Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.DataLayer
downScaleColumnWidth, downScaleRowHeight, getColumnCount, getColumnIndexByPosition, getColumnPositionByIndex, getColumnPositionByX, getColumnWidthByPosition, getConfiguredColumnWidthByPosition, getConfiguredColumnWidthPercentageByPosition, getConfiguredMinColumnWidthByPosition, getConfiguredMinRowHeightByPosition, getConfiguredRowHeightByPosition, getConfiguredRowHeightPercentageByPosition, getDataProvider, getDataValue, getDefaultColumnWidth, getDefaultMinColumnWidth, getDefaultMinRowHeight, getDefaultRowHeight, getHeight, getMinColumnWidth, getMinRowHeight, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByIndex, getRowPositionByY, getStartXOfColumnPosition, getStartYOfRowPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, isColumnPercentageSizing, isColumnPercentageSizing, isColumnPositionResizable, isDistributeRemainingColumnSpace, isDistributeRemainingRowSpace, isFixColumnPercentageValuesOnResize, isFixRowPercentageValuesOnResize, isMinColumnWidthConfigured, isMinColumnWidthConfigured, isMinRowHeightConfigured, isMinRowHeightConfigured, isRowPercentageSizing, isRowPercentageSizing, isRowPositionResizable, loadState, localToUnderlyingColumnPosition, localToUnderlyingRowPosition, registerCommandHandlers, resetColumnWidth, resetColumnWidthConfiguration, resetMinColumnWidth, resetMinRowHeight, resetRowHeight, resetRowHeightConfiguration, saveState, setColumnPercentageSizing, setColumnPercentageSizing, setColumnPositionResizable, setColumnsResizableByDefault, setColumnWidthByPosition, setColumnWidthByPosition, setColumnWidthPercentageByPosition, setColumnWidthPercentageByPosition, setDataProvider, setDataValue, setDataValueByPosition, setDefaultColumnWidth, setDefaultColumnWidthByPosition, setDefaultMinColumnWidth, setDefaultMinRowHeight, setDefaultRowHeight, setDefaultRowHeightByPosition, setDistributeRemainingColumnSpace, setDistributeRemainingRowSpace, setFixColumnPercentageValuesOnResize, setFixRowPercentageValuesOnResize, setMinColumnWidth, setMinRowHeight, setRowHeightByPosition, setRowHeightByPosition, setRowHeightPercentageByPosition, setRowHeightPercentageByPosition, setRowPercentageSizing, setRowPercentageSizing, setRowPositionResizable, setRowsResizableByDefault, underlyingToLocalColumnPosition, underlyingToLocalColumnPositions, underlyingToLocalRowPosition, underlyingToLocalRowPositions, upScaleColumnWidth, upScaleRowHeight
-
Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
addConfiguration, addLayerListener, clearConfiguration, configure, dispose, fireLayerEvent, getBoundsByPosition, getCellByPosition, getCellPainter, getClientAreaProvider, getConfigLabelAccumulator, getDisplayModeByPosition, getLayerPainter, getRegionLabelsByXY, getRegionName, hasLayerListener, isDynamicSizeLayer, registerCommandHandler, registerEventHandler, registerPersistable, removeLayerListener, setClientAreaProvider, setConfigLabelAccumulator, setLayerPainter, setRegionName, toString, unregisterCommandHandler, unregisterEventHandler, unregisterPersistable
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.nebula.widgets.nattable.layer.ILayer
addLayerListener, configure, dispose, fireLayerEvent, getBoundsByPosition, getCellByPosition, getCellPainter, getClientAreaProvider, getDisplayModeByPosition, getLayerPainter, getRegionLabelsByXY, hasLayerListener, isDynamicSizeLayer, registerCommandHandler, registerPersistable, removeLayerListener, setClientAreaProvider, unregisterCommandHandler, unregisterPersistable
-
-
-
-
Field Detail
-
GROUP_BY_OBJECT
public static final String GROUP_BY_OBJECT
Label that indicates the shown tree item object as GroupByObject- See Also:
- Constant Field Values
-
GROUP_BY_COLUMN_PREFIX
public static final String GROUP_BY_COLUMN_PREFIX
Label prefix for labels that are added to cells for a group by object.- See Also:
- Constant Field Values
-
GROUP_BY_SUMMARY
public static final String GROUP_BY_SUMMARY
Label that indicates the shown tree item object as GroupByObject and contains a summary value.- See Also:
- Constant Field Values
-
GROUP_BY_SUMMARY_COLUMN_PREFIX
public static final String GROUP_BY_SUMMARY_COLUMN_PREFIX
Label prefix for labels that are added to cells for a group by object summary.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GroupByDataLayer
public GroupByDataLayer(GroupByModel groupByModel, ca.odell.glazedlists.EventList<T> eventList, IColumnAccessor<T> columnAccessor)
Create a newGroupByDataLayer
with the given configuration that:- uses the default
GroupByExpansionModel
which shows all nodes initially expanded - has smoothUpdates enabled which leads to showing the summary values that were calculated before until the new value calculation is done
- uses the default
GroupByDataLayerConfiguration
- does not support groupBy summary values because of the missing
IConfigRegistry
reference
- Parameters:
groupByModel
- TheGroupByModel
that is used to define the tree structure based on the groupBy state. Needs to be provided as it is at least shared between theGroupByDataLayer
and theGroupByHeaderLayer
.eventList
- TheEventList
that should be used as source of the internally createdTreeList
. This should be highest list in theEventList
stack in use, e.g. if sorting and filtering is also enabled and the lists are created like this:EventList<T> eventList = GlazedLists.eventList(values); TransformedList<T, T> rowObjectsGlazedList = GlazedLists.threadSafeList(eventList); SortedList<T> sortedList = new SortedList<>(rowObjectsGlazedList, null); FilterList<T> filterList = new FilterList<>(sortedList);
theFilterList
needs to be used as parameter here.columnAccessor
- TheIColumnAccessor
that should be used to access the base row objects.
- uses the default
-
GroupByDataLayer
public GroupByDataLayer(GroupByModel groupByModel, ca.odell.glazedlists.EventList<T> eventList, IColumnAccessor<T> columnAccessor, boolean useDefaultConfiguration)
Create a newGroupByDataLayer
with the given configuration that:- uses the default
GroupByExpansionModel
which shows all nodes initially expanded - has smoothUpdates enabled which leads to showing the summary values that were calculated before until the new value calculation is done
- does not support groupBy summary values because of the missing
IConfigRegistry
reference
- Parameters:
groupByModel
- TheGroupByModel
that is used to define the tree structure based on the groupBy state. Needs to be provided as it is at least shared between theGroupByDataLayer
and theGroupByHeaderLayer
.eventList
- TheEventList
that should be used as source of the internally createdTreeList
. This should be highest list in theEventList
stack in use, e.g. if sorting and filtering is also enabled and the lists are created like this:EventList<T> eventList = GlazedLists.eventList(values); TransformedList<T, T> rowObjectsGlazedList = GlazedLists.threadSafeList(eventList); SortedList<T> sortedList = new SortedList<>(rowObjectsGlazedList, null); FilterList<T> filterList = new FilterList<>(sortedList);
theFilterList
needs to be used as parameter here.columnAccessor
- TheIColumnAccessor
that should be used to access the base row objects.useDefaultConfiguration
-true
to add the defaultGroupByDataLayerConfiguration
,false
for not adding the default configuration.
- uses the default
-
GroupByDataLayer
public GroupByDataLayer(GroupByModel groupByModel, ca.odell.glazedlists.EventList<T> eventList, IColumnAccessor<T> columnAccessor, IConfigRegistry configRegistry)
Create a newGroupByDataLayer
with the given configuration that:- uses the default
GroupByExpansionModel
which shows all nodes initially expanded - has smoothUpdates enabled which leads to showing the summary values that were calculated before until the new value calculation is done
- uses the default
GroupByDataLayerConfiguration
- Parameters:
groupByModel
- TheGroupByModel
that is used to define the tree structure based on the groupBy state. Needs to be provided as it is at least shared between theGroupByDataLayer
and theGroupByHeaderLayer
.eventList
- TheEventList
that should be used as source of the internally createdTreeList
. This should be highest list in theEventList
stack in use, e.g. if sorting and filtering is also enabled and the lists are created like this:EventList<T> eventList = GlazedLists.eventList(values); TransformedList<T, T> rowObjectsGlazedList = GlazedLists.threadSafeList(eventList); SortedList<T> sortedList = new SortedList<>(rowObjectsGlazedList, null); FilterList<T> filterList = new FilterList<>(sortedList);
theFilterList
needs to be used as parameter here.columnAccessor
- TheIColumnAccessor
that should be used to access the base row objects.configRegistry
- TheIConfigRegistry
needed to retrieve the groupBy summary configurations.
- uses the default
-
GroupByDataLayer
public GroupByDataLayer(GroupByModel groupByModel, ca.odell.glazedlists.EventList<T> eventList, IColumnAccessor<T> columnAccessor, IConfigRegistry configRegistry, boolean useDefaultConfiguration)
Create a newGroupByDataLayer
with the given configuration that:- uses the default
GroupByExpansionModel
which shows all nodes initially expanded - has smoothUpdates enabled which leads to showing the summary values that were calculated before until the new value calculation is done
- Parameters:
groupByModel
- TheGroupByModel
that is used to define the tree structure based on the groupBy state. Needs to be provided as it is at least shared between theGroupByDataLayer
and theGroupByHeaderLayer
.eventList
- TheEventList
that should be used as source of the internally createdTreeList
. This should be highest list in theEventList
stack in use, e.g. if sorting and filtering is also enabled and the lists are created like this:EventList<T> eventList = GlazedLists.eventList(values); TransformedList<T, T> rowObjectsGlazedList = GlazedLists.threadSafeList(eventList); SortedList<T> sortedList = new SortedList<>(rowObjectsGlazedList, null); FilterList<T> filterList = new FilterList<>(sortedList);
theFilterList
needs to be used as parameter here.columnAccessor
- TheIColumnAccessor
that should be used to access the base row objects.configRegistry
- TheIConfigRegistry
needed to retrieve the groupBy summary configurations.useDefaultConfiguration
-true
to add the defaultGroupByDataLayerConfiguration
,false
for not adding the default configuration.
- uses the default
-
GroupByDataLayer
public GroupByDataLayer(GroupByModel groupByModel, ca.odell.glazedlists.EventList<T> eventList, IColumnAccessor<T> columnAccessor, IConfigRegistry configRegistry, boolean smoothUpdates, boolean useDefaultConfiguration)
Create a newGroupByDataLayer
with the given configuration that:- uses the default
GroupByExpansionModel
which shows all nodes initially expanded
- Parameters:
groupByModel
- TheGroupByModel
that is used to define the tree structure based on the groupBy state. Needs to be provided as it is at least shared between theGroupByDataLayer
and theGroupByHeaderLayer
.eventList
- TheEventList
that should be used as source of the internally createdTreeList
. This should be highest list in theEventList
stack in use, e.g. if sorting and filtering is also enabled and the lists are created like this:EventList<T> eventList = GlazedLists.eventList(values); TransformedList<T, T> rowObjectsGlazedList = GlazedLists.threadSafeList(eventList); SortedList<T> sortedList = new SortedList<>(rowObjectsGlazedList, null); FilterList<T> filterList = new FilterList<>(sortedList);
theFilterList
needs to be used as parameter here.columnAccessor
- TheIColumnAccessor
that should be used to access the base row objects.configRegistry
- TheIConfigRegistry
needed to retrieve the groupBy summary configurations.smoothUpdates
-true
if the summary values that were calculated before should be returned until the new value calculation is done,false
ifnull
should be returned until the calculation is finished.useDefaultConfiguration
-true
to add the defaultGroupByDataLayerConfiguration
,false
for not adding the default configuration.
- uses the default
-
GroupByDataLayer
public GroupByDataLayer(GroupByModel groupByModel, ca.odell.glazedlists.EventList<T> eventList, IColumnAccessor<T> columnAccessor, ca.odell.glazedlists.TreeList.ExpansionModel<Object> expansionModel, IConfigRegistry configRegistry, boolean smoothUpdates, boolean useDefaultConfiguration)
Create a newGroupByDataLayer
with the given configuration.- Parameters:
groupByModel
- TheGroupByModel
that is used to define the tree structure based on the groupBy state. Needs to be provided as it is at least shared between theGroupByDataLayer
and theGroupByHeaderLayer
.eventList
- TheEventList
that should be used as source of the internally createdTreeList
. This should be highest list in theEventList
stack in use, e.g. if sorting and filtering is also enabled and the lists are created like this:EventList<T> eventList = GlazedLists.eventList(values); TransformedList<T, T> rowObjectsGlazedList = GlazedLists.threadSafeList(eventList); SortedList<T> sortedList = new SortedList<>(rowObjectsGlazedList, null); FilterList<T> filterList = new FilterList<>(sortedList);
theFilterList
needs to be used as parameter here.columnAccessor
- TheIColumnAccessor
that should be used to access the base row objects.expansionModel
- TheTreeList.ExpansionModel
that should be used on the internally createdTreeList
. If set tonull
the internal default GroupByExpansionModel will be used that shows all nodes initially expanded.configRegistry
- TheIConfigRegistry
needed to retrieve the groupBy summary configurations.smoothUpdates
-true
if the summary values that were calculated before should be returned until the new value calculation is done,false
ifnull
should be returned until the calculation is finished.useDefaultConfiguration
-true
to add the defaultGroupByDataLayerConfiguration
,false
for not adding the default configuration.
-
-
Method Detail
-
createGroupByTreeFormat
protected GroupByTreeFormat<T> createGroupByTreeFormat(GroupByModel groupByModel, IColumnAccessor<T> groupByColumnAccessor)
- Parameters:
groupByModel
- TheGroupByModel
that is used to specify the tree structure.groupByColumnAccessor
- TheIColumnAccessor
that is used to access the values in the data model, should be of typeGroupByColumnAccessor
.- Returns:
- The
GroupByTreeFormat
that is used to build the tree structure.
-
initializeTreeComparator
public void initializeTreeComparator(ISortModel sortModel, IUniqueIndexLayer treeLayer, boolean setDataLayerReference)
Initialize theComparator
that is used to build the tree structure. Adding all the below information will enable correct sorting of the tree structure taking the summary values and the groupBy values correctly into account.- Parameters:
sortModel
- TheISortModel
that should be set to theIGroupByComparator
. Setting theISortModel
enables the usage of the configuredComparator
per column on creating the sorted tree structure.treeLayer
- TheIUniqueIndexLayer
that should be set to theIGroupByComparator
. Typically theTreeLayer
and is needed to determine if the sort operation is performed on the tree column. Will only be inspected if a validISortModel
is set.setDataLayerReference
-true
for setting theGroupByDataLayer
reference to this instance to theGroupByComparator
,false
to set the reference tonull
. TheGroupByDataLayer
reference is used in the comparator to be able to sort by summary values. If summary values are not configured or the sorting by summary value is not needed, you should avoid setting the reference.- See Also:
IGroupByComparator.setSortModel(ISortModel)
,IGroupByComparator.setTreeLayer(IUniqueIndexLayer)
,IGroupByComparator.setDataLayer(GroupByDataLayer)
-
setComparator
public void setComparator(IGroupByComparator<T> comparator)
- Parameters:
comparator
- TheIGroupByComparator
that is necessary to create the sorted tree structure. Can not benull
.
-
getSortModel
public ISortModel getSortModel()
- Returns:
- The
ISortModel
that is set to theIGroupByComparator
. - Since:
- 1.6
- See Also:
IGroupByComparator.getSortModel()
-
updateTree
protected void updateTree()
Method to update the tree list after filter or TreeList.Format changed. Need this workaround to update the tree list for presentation because of http://java.net/ jira /browse/GLAZEDLISTS-521For more information you can also have a look at this discussion: http://glazedlists.1045722.n5.nabble.com/sorting-a-treelist-td4704550. html
-
update
public void update(Observable o, Object arg)
-
getTreeRowModel
public GlazedListTreeRowModel<Object> getTreeRowModel()
- Returns:
- The ITreeRowModel that is responsible to retrieve information and operate on tree items.
-
getTreeList
public ca.odell.glazedlists.TreeList<Object> getTreeList()
- Returns:
- The TreeList that is created internally by this GroupByDataLayer to enable groupBy.
-
getConfigLabelsByPosition
public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition)
Description copied from interface:ILayer
Returns the config labels for the cell at the given coordinates. Needed to retrieve the corresponding configurations out of theIConfigRegistry
.- Specified by:
getConfigLabelsByPosition
in interfaceILayer
- Overrides:
getConfigLabelsByPosition
in classAbstractLayer
- Parameters:
columnPosition
- The column position of the cell.rowPosition
- The row position of the cell.- Returns:
- The
LabelStack
with the config labels for the cell at the given coordinates.
-
getProvidedLabels
public Collection<String> getProvidedLabels()
- Specified by:
getProvidedLabels
in interfaceILayer
- Overrides:
getProvidedLabels
in classAbstractLayer
- Returns:
- The collection of labels that are provided by this layer.
-
getDataValueByPosition
public Object getDataValueByPosition(int columnPosition, int rowPosition)
Description copied from interface:ILayer
Returns the data value for the cell at the given coordinates.- Specified by:
getDataValueByPosition
in interfaceILayer
- Overrides:
getDataValueByPosition
in classDataLayer
- Parameters:
columnPosition
- The column position of the cell.rowPosition
- The row position of the cell.- Returns:
- The data value for the cell at the given coordinates.
-
getDataValueByPosition
public Object getDataValueByPosition(int columnPosition, int rowPosition, LabelStack labelStack, boolean calculateInBackground)
This method is used to retrieve a data value of anILayerCell
. It is intended to be used for conditional formatting. It allows to specify theLabelStack
and to disable background calculation processing, since the conditional formatting needs the summary value without a delay.- Parameters:
columnPosition
- The column position of the cell whose data value is requested.rowPosition
- The row position of the cell whose data value is requested.labelStack
- TheLabelStack
of the cell whose data value is requested. Needed to retrieve a possible existingIGroupBySummaryProvider
.calculateInBackground
-true
to calculate the summary value in the background,false
if the calculation should be processed in the UI thread.- Returns:
- The data value for the
ILayerCell
at the given coordinates.
-
getGroupBySummaryProvider
public IGroupBySummaryProvider<T> getGroupBySummaryProvider(LabelStack labelStack)
-
handleLayerEvent
public void handleLayerEvent(ILayerEvent event)
Description copied from class:AbstractLayer
Handle layer event notification. Convert it to your context and propagate UP. If you override this method you MUST NOT FORGET to raise the event up the layer stack by callingsuper.fireLayerEvent(event)
- unless you plan to eat the event yourself.- Specified by:
handleLayerEvent
in interfaceILayerListener
- Overrides:
handleLayerEvent
in classAbstractLayer
- Parameters:
event
- the event
-
clearCache
public void clearCache()
Clear the internal cache to trigger new calculations.Usually it is not necessary to call this method manually. But for certain use cases it might be useful, e.g. changing the summary provider implementation at runtime.
- See Also:
CalculatedValueCache.clearCache()
-
killCache
public void killCache()
Clears all values in the internal cache to trigger new calculations. This will also clear all values in the cache copy and will result in rendering like there was never a summary value calculated before.Usually it is not necessary to call this method manually. But for certain use cases it might be useful, e.g. changing the summary provider implementation at runtime.
- See Also:
CalculatedValueCache.killCache()
-
doCommand
public boolean doCommand(ILayerCommand command)
Description copied from interface:ILayer
Opportunity to respond to a command as it flows down the stack. If the layer is not interested in the command it should allow the command to keep traveling down the stack.Note: Before the layer can process a command it must convert the command to its local coordinates using
ILayerCommand.convertToTargetLayer(ILayer)
-
getValueCache
public ICalculatedValueCache getValueCache()
- Returns:
- The
ICalculatedValueCache
that contains the summary values and performs summary calculation in background processes if necessary.
-
setValueCache
public void setValueCache(ICalculatedValueCache valueCache)
Set theICalculatedValueCache
that should be used internally to calculate the summary values in a background thread and cache the results.Note: By default the
CalculatedValueCache
is used. Be sure you know what you are doing when you are trying to exchange the implementation.- Parameters:
valueCache
- TheICalculatedValueCache
that contains the summary values and performs summary calculation in background processes if necessary.
-
getItemsInGroup
public List<T> getItemsInGroup(GroupByObject group)
Get the list of the items in a group. Used for example to calculate the group summary values or group item count.Note: This method returns a new list and is therefore thread safe.
- Parameters:
group
- TheGroupByObject
for which the children should be retrieved.- Returns:
- The list of items in the group specified by the given
GroupByObject
- Since:
- 1.5
-
getGroupDescriptorMatcher
protected ca.odell.glazedlists.matchers.Matcher<T> getGroupDescriptorMatcher(GroupByObject group, IColumnAccessor<T> columnAccessor)
- Parameters:
group
- TheGroupByObject
for which the children should be retrieved.columnAccessor
- TheIColumnAccessor
that is used to retrieve column value of an element.- Returns:
- The
Matcher
that is used to identify the children of aGroupByObject
- See Also:
GroupByDataLayer.GroupDescriptorMatcher
-
-