Class ColumnGroupHeaderLayer
- All Implemented Interfaces:
ILayer,ILayerListener,IPersistable
NatTable.saveState(String, Properties) is invoked.
Internally uses a collection of GroupModel to track the column groups
on multiple levels.
It supports multiple column grouping levels. The levels are 0 based and configured bottom up. That means if 3 levels of column groups are defined, the first level==0 is the bottom most rowPosition==2, and the top most level==2 is on rowPosition==0.
- Since:
- 1.6
-
Field Summary
Fields inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
underlyingLayerFields inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
commandHandlers, eventHandlers, eventHelperLock, layerPainterFields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
DOT, VALUE_SEPARATOR -
Constructor Summary
ConstructorsConstructorDescriptionColumnGroupHeaderLayer(ILayer underlyingHeaderLayer, IUniqueIndexLayer positionLayer, SelectionLayer selectionLayer) Creates aColumnGroupHeaderLayerwith the specified configurations and one grouping level.ColumnGroupHeaderLayer(ILayer underlyingHeaderLayer, IUniqueIndexLayer positionLayer, SelectionLayer selectionLayer, boolean useDefaultConfiguration) Creates aColumnGroupHeaderLayerwith one grouping level and the specified configurations.ColumnGroupHeaderLayer(ILayer underlyingHeaderLayer, IUniqueIndexLayer positionLayer, SelectionLayer selectionLayer, int numberOfGroupLevels) Creates aColumnGroupHeaderLayerwith the specified configurations.ColumnGroupHeaderLayer(ILayer underlyingHeaderLayer, IUniqueIndexLayer positionLayer, SelectionLayer selectionLayer, int numberOfGroupLevels, boolean useDefaultConfiguration) Creates aColumnGroupHeaderLayerwith the specified configurations.ColumnGroupHeaderLayer(ILayer underlyingHeaderLayer, SelectionLayer selectionLayer) Creates aColumnGroupHeaderLayerwith the specified configurations and one grouping level.ColumnGroupHeaderLayer(ILayer underlyingHeaderLayer, SelectionLayer selectionLayer, boolean useDefaultConfiguration) Creates aColumnGroupHeaderLayerwith one grouping level and the specified configurations.ColumnGroupHeaderLayer(ILayer underlyingHeaderLayer, SelectionLayer selectionLayer, int numberOfGroupLevels) Creates aColumnGroupHeaderLayerwith the specified configurations.ColumnGroupHeaderLayer(ILayer underlyingHeaderLayer, SelectionLayer selectionLayer, int numberOfGroupLevels, boolean useDefaultConfiguration) Creates aColumnGroupHeaderLayerwith the specified configurations. -
Method Summary
Modifier and TypeMethodDescriptionvoidCreates and adds a group.voidCreates and adds a group.voidAdds a new grouping level on top.voidaddPositionsToGroup(int level, int columnPosition, int... positions) Adds the given positions to the group to which the given column position belongs to.voidaddPositionsToGroup(int level, String groupName, int... positions) Adds the given positions to the group with the given name.protected voidaddPositionsToGroup(int level, GroupModel.Group group, int... positions) Adds the given positions to the givenGroupModel.Group.voidaddPositionsToGroup(String groupName, int... positions) Adds the given positions to the group with the given name.protected voidaddPositionsToGroup(GroupModel.Group group, int... positions) Adds the given positions to the givenGroupModel.Group.voidaddStaticColumnIndexesToGroup(int level, int columnPosition, int... staticIndexes) Adds the given indexes as static indexes to the group that is identified by the given column position.voidaddStaticColumnIndexesToGroup(int level, String groupName, int... staticIndexes) Adds the given indexes as static indexes to the group that is identified by the given group name.voidaddStaticColumnIndexesToGroup(String groupName, int... staticIndexes) Adds the given indexes as static indexes to the group that is identified by the given group name.voidRemoves all groups in all levels.voidclearAllGroups(int level) Removes all groups in the given level.voidCollapses all groups in all levels.voidcollapseAllGroups(int level) Collapses all groups in the given level.voidcollapseGroup(int position) Collapses the group for the given position, if the column at the specified position belongs to a group.voidcollapseGroup(int level, int position) Collapses the group for the given position, if the column at the specified position belongs to a group.voidcollapseGroup(int level, String groupName) Collapses the group with the given name.voidcollapseGroup(String groupName) Collapses the group with the given name.voidcollapseGroup(GroupModel groupModel, GroupModel.Group group) Collapses the given group of the given group model.protected intconvertColumnPositionUpwards(int columnPosition) Converts the given column position thelayerPathupwards.booleandoCommand(ILayerCommand command) Opportunity to respond to a command as it flows down the stack.voidExpands all groups in all levels.voidexpandAllGroups(int level) Expands all groups in the given level.voidexpandGroup(int position) Expands the group for the given position, if the column at the specified position belongs to a group.voidexpandGroup(int level, int position) Expands the group for the given position, if the column at the specified position belongs to a group.voidexpandGroup(int level, String groupName) Expands the group with the given name.voidexpandGroup(String groupName) Expands the group with the given name.voidexpandGroup(GroupModel groupModel, GroupModel.Group group) Expands the given group of the given group model.protected Object[]findGroupForCoordinates(int columnPosition, int rowPosition) Finds aGroupModel.Groupand its parentGroupModelbased on the coordinates.org.eclipse.swt.graphics.RectanglegetBoundsByPosition(int columnPosition, int rowPosition) Calculates the bounds in pixel for the given cell position.getCellByPosition(int columnPosition, int rowPosition) Returns the cell for the given coordinates on this layer.intgetColumnSpan(GroupModel.Group group) Calculates the span of a cell in a group.getConfigLabelsByPosition(int columnPosition, int rowPosition) Returns the config labels for the cell at the given coordinates.getDataValueByPosition(int columnPosition, int rowPosition) Returns the data value for the cell at the given coordinates.getDisplayModeByPosition(int columnPosition, int rowPosition) Returns the activeDisplayModefor the cell at the given coordinates.getGroupByName(int level, String name) Returns theGroupModel.Groupfor the given name.getGroupByName(String name) Returns theGroupModel.Groupfor the given name at level 0.getGroupByPosition(int columnPosition) Get theGroupModel.Groupfor the column at the given column position for level 0.getGroupByPosition(int level, int columnPosition) Get theGroupModel.Groupfor the column at the given column position for the given grouping level.Convenience method to get theGroupModelon level 0.getGroupModel(int level) Return theGroupModelfor the given grouping level.intReturns the total height in pixels of this layer.intintgetLevelForRowPosition(int rowPosition) intintgetRegionLabelsByXY(int x, int y) Return theLabelStackcontaining the region labels for the cell at the given pixel position.intUsed to support column reordering via drag and drop.intintgetRowHeightByPosition(int rowPosition) Returns the height in pixels of the given row.intgetRowIndexByPosition(int rowPosition) Gets the underlying non-transformed row index for the given row position on this layer.intgetRowPositionByY(int y) Returns the row position that contains the given y coordinate.intgetRowPositionForLevel(int level) intgetStartYOfRowPosition(int rowPosition) Returns the y offset in pixels of the given row.booleanbooleanisDefaultCollapseable(int level) booleanisDefaultUnbreakable(int level) booleanisPartOfAGroup(int columnPosition) Checks if there is aGroupModel.Groupconfigured for the given column position at any level.booleanisPartOfAGroup(int level, int columnPosition) Checks if there is aGroupModel.Groupconfigured for the given column position at the given level.booleanisPartOfAnUnbreakableGroup(int columnPosition) Check if the specified position belongs to aGroupModel.Groupand if thisGroupModel.Groupis unbreakable.booleanisPartOfAnUnbreakableGroup(int level, int columnPosition) Check if the specified position belongs to aGroupModel.Groupat the specified level and if thisGroupModel.Groupis unbreakable.booleanisReorderSupportedOnLevel(int level) Check if reordering for the given grouping level is supported or not.booleanisRowPositionResizable(int rowPosition) Check if the row at the given position is resizable.booleanvoidloadState(String prefix, Properties properties) Underlying layers must load state first.intlocalToUnderlyingRowPosition(int localRowPosition) Convert a row position to the coordinates of the underlying layer.protected voidregisterCommandHandlers(SelectionLayer selectionLayer) Register command handlers for this layer.voidremoveGroup(int columnPosition) Removes the group identified by the given column position.voidremoveGroup(int level, int columnPosition) Removes the group identified by the given column position.voidremoveGroup(int level, String groupName) Removes the group identified by the given name.voidremoveGroup(int level, GroupModel.Group group) Removes the given group.voidremoveGroup(String groupName) Removes the group identified by the given name.voidremoveGroup(GroupModel.Group group) Removes the given group.voidremovePositionsFromGroup(int level, int... positions) Removes the given positions from corresponding groups.booleanreorderColumnGroup(int level, int fromColumnPosition, int toColumnPosition) Reorder a column group for the fromColumnPosition at the given level to the specified toColumnPosition.voidsaveState(String prefix, Properties properties) Saves the state to the given Properties using the specified prefix.voidsetCalculateHeight(boolean calculateHeight) Configure whether theColumnGroupHeaderLayershould calculate the height of the layer dependent on column group configuration or not.voidsetDefaultCollapseable(boolean defaultCollapseable) Sets the default value for the collapseable flag when creating group objects for all group levels.voidsetDefaultCollapseable(int level, boolean defaultCollapseable) Sets the default value for the collapseable flag when creating group objects.voidsetDefaultUnbreakable(boolean defaultUnbreakable) Sets the default value for the unbreakable flag when creating group objects for all grouping levels.voidsetDefaultUnbreakable(int level, boolean defaultUnbreakable) Sets the default value for the unbreakable flag when creating group objects.voidsetGroupCollapseable(int position, boolean collabseable) Set the group to which the specified position belongs to, to be collapseable or not.voidsetGroupCollapseable(int level, int position, boolean collabseable) Set the group to which the specified position belongs to, to be collapseable or not.voidsetGroupCollapseable(int level, String groupName, boolean collabseable) Set the group with the given group name to be collapseable or not.voidsetGroupCollapseable(String groupName, boolean collabseable) Set the group with the given group name to be collapseable or not.voidsetGroupUnbreakable(int position, boolean unbreakable) Set the group to which the position belongs to unbreakable/breakable.voidsetGroupUnbreakable(int level, int position, boolean unbreakable) Set the group to which the position belongs to unbreakable/breakable.voidsetGroupUnbreakable(int level, String groupName, boolean unbreakable) Set the group with the given name to unbreakable/breakable.voidsetGroupUnbreakable(String groupName, boolean unbreakable) Set the group with the given name to unbreakable/breakable.voidsetLayerPainter(ILayerPainter layerPainter) voidsetReorderFromColumnPosition(int fromColumnPosition) Set the position from which a column group drag operation was started.voidsetReorderSupportedOnLevel(int level, boolean supported) Configure whether reordering for a grouping level should be supported or not.voidsetRowHeight(int rowHeight) Set the row height for grouping level 0.voidsetRowHeight(int row, int rowHeight) Set the row height for the given row in this layer.voidsetRowPositionResizable(int rowPosition, boolean resizable) Set the row resizable configuration for the given row position.voidsetShowAlwaysGroupNames(boolean showAlwaysGroupNames) Configure whether group names should be always visible on rendering, e.g.intunderlyingToLocalRowPosition(ILayer sourceUnderlyingLayer, int underlyingRowPosition) Transforms the row position relative to the given underlying layer to this layer coordinates.Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
configure, dispose, getCellPainter, getColumnCount, getColumnIndexByPosition, getColumnPositionByX, getColumnWidthByPosition, getPreferredColumnCount, getPreferredWidth, getStartXOfColumnPosition, getUnderlyingLayer, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, isColumnPositionResizable, isDynamicSizeLayer, localToUnderlyingColumnPosition, setClientAreaProvider, setUnderlyingLayer, underlyingToLocalColumnPosition, underlyingToLocalColumnPositions, underlyingToLocalRowPositionsMethods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
addConfiguration, addLayerListener, clearConfiguration, fireLayerEvent, getClientAreaProvider, getConfigLabelAccumulator, getRegionName, handleLayerEvent, hasLayerListener, registerCommandHandler, registerCommandHandlers, registerEventHandler, registerPersistable, removeLayerListener, setConfigLabelAccumulator, setRegionName, toString, unregisterCommandHandler, unregisterEventHandler, unregisterPersistable
-
Constructor Details
-
ColumnGroupHeaderLayer
Creates aColumnGroupHeaderLayerwith the specified configurations and one grouping level. Uses the SelectionLayer as positionLayer and the default configuration.- Parameters:
underlyingHeaderLayer- The underlying layer on whose top this layer should be created, typically the ColumnHeaderLayer.selectionLayer- The SelectionLayer needed for command handlers that inspect the selection on handling.
-
ColumnGroupHeaderLayer
public ColumnGroupHeaderLayer(ILayer underlyingHeaderLayer, SelectionLayer selectionLayer, int numberOfGroupLevels) Creates aColumnGroupHeaderLayerwith the specified configurations. Uses the SelectionLayer as positionLayer and the default configuration.- Parameters:
underlyingHeaderLayer- The underlying layer on whose top this layer should be created, typically the ColumnHeaderLayer.selectionLayer- The SelectionLayer needed for command handlers that inspect the selection on handling.numberOfGroupLevels- The number of group levels that should be supported. Additional levels can also be added viaaddGroupingLevel().
-
ColumnGroupHeaderLayer
public ColumnGroupHeaderLayer(ILayer underlyingHeaderLayer, IUniqueIndexLayer positionLayer, SelectionLayer selectionLayer) Creates aColumnGroupHeaderLayerwith the specified configurations and one grouping level. Uses the default configuration.- Parameters:
underlyingHeaderLayer- The underlying layer on whose top this layer should be created, typically the ColumnHeaderLayer.positionLayer- The positionLayer to which this layer should be mapped to, needed to handle column position transformations without taking the viewport into account. Typically the SelectionLayer.selectionLayer- The SelectionLayer needed for command handlers that inspect the selection on handling.
-
ColumnGroupHeaderLayer
public ColumnGroupHeaderLayer(ILayer underlyingHeaderLayer, IUniqueIndexLayer positionLayer, SelectionLayer selectionLayer, int numberOfGroupLevels) Creates aColumnGroupHeaderLayerwith the specified configurations. Uses the default configuration.- Parameters:
underlyingHeaderLayer- The underlying layer on whose top this layer should be created, typically the ColumnHeaderLayer.positionLayer- The positionLayer to which this layer should be mapped to, needed to handle column position transformations without taking the viewport into account. Typically the SelectionLayer.selectionLayer- The SelectionLayer needed for command handlers that inspect the selection on handling.numberOfGroupLevels- The number of group levels that should be supported. Additional levels can also be added viaaddGroupingLevel().
-
ColumnGroupHeaderLayer
public ColumnGroupHeaderLayer(ILayer underlyingHeaderLayer, SelectionLayer selectionLayer, int numberOfGroupLevels, boolean useDefaultConfiguration) Creates aColumnGroupHeaderLayerwith the specified configurations. Takes theSelectionLayeras positionLayer.- Parameters:
underlyingHeaderLayer- The underlying layer on whose top this layer should be created, typically the ColumnHeaderLayer.selectionLayer- The SelectionLayer needed for command handlers that inspect the selection on handling.numberOfGroupLevels- The number of group levels that should be supported. Additional levels can also be added viaaddGroupingLevel().useDefaultConfiguration-trueif the default configuration should be applied,falseif a custom configuration will be applied afterwards.
-
ColumnGroupHeaderLayer
public ColumnGroupHeaderLayer(ILayer underlyingHeaderLayer, SelectionLayer selectionLayer, boolean useDefaultConfiguration) Creates aColumnGroupHeaderLayerwith one grouping level and the specified configurations. Takes theSelectionLayeras positionLayer.- Parameters:
underlyingHeaderLayer- The underlying layer on whose top this layer should be created, typically the ColumnHeaderLayer.selectionLayer- The SelectionLayer needed for command handlers that inspect the selection on handling.useDefaultConfiguration-trueif the default configuration should be applied,falseif a custom configuration will be applied afterwards.
-
ColumnGroupHeaderLayer
public ColumnGroupHeaderLayer(ILayer underlyingHeaderLayer, IUniqueIndexLayer positionLayer, SelectionLayer selectionLayer, boolean useDefaultConfiguration) Creates aColumnGroupHeaderLayerwith one grouping level and the specified configurations.- Parameters:
underlyingHeaderLayer- The underlying layer on whose top this layer should be created, typically the ColumnHeaderLayer.positionLayer- The positionLayer to which this layer should be mapped to, needed to handle column position transformations without taking the viewport into account. Typically the SelectionLayer.selectionLayer- The SelectionLayer needed for command handlers that inspect the selection on handling.useDefaultConfiguration-trueif the default configuration should be applied,falseif a custom configuration will be applied afterwards.
-
ColumnGroupHeaderLayer
public ColumnGroupHeaderLayer(ILayer underlyingHeaderLayer, IUniqueIndexLayer positionLayer, SelectionLayer selectionLayer, int numberOfGroupLevels, boolean useDefaultConfiguration) Creates aColumnGroupHeaderLayerwith the specified configurations.- Parameters:
underlyingHeaderLayer- The underlying layer on whose top this layer should be created, typically the ColumnHeaderLayer.positionLayer- The positionLayer to which this layer should be mapped to, needed to handle column position transformations without taking the viewport into account. Typically the SelectionLayer.selectionLayer- The SelectionLayer needed for command handlers that inspect the selection on handling.numberOfGroupLevels- The number of group levels that should be supported. Additional levels can also be added viaaddGroupingLevel().useDefaultConfiguration-trueif the default configuration should be applied,falseif a custom configuration will be applied afterwards.
-
-
Method Details
-
getLayerPainter
- Specified by:
getLayerPainterin interfaceILayer- Overrides:
getLayerPainterin classAbstractLayerTransform- Returns:
- The
ILayerPainterthat is used by this layer. Typically theColumnGroupHeaderGridLineCellLayerPainterto support rendering of huge column group cells by inspecting theshowAlwaysGroupNamesattribute.
-
setLayerPainter
- Overrides:
setLayerPainterin classAbstractLayer
-
registerCommandHandlers
Register command handlers for this layer.- Parameters:
selectionLayer- TheSelectionLayerneeded for handling selections on grouping/ungrouping.
-
getGroupModel
Convenience method to get theGroupModelon level 0. Useful for single level column grouping.- Returns:
- The
GroupModelfor level 0.
-
getGroupModel
Return theGroupModelfor the given grouping level. Note that the levels are bottom up, so level 0 is the bottom most grouping level.- Parameters:
level- The grouping level. Value is bottom up.- Returns:
- The
GroupModelfor the corresponding level.
-
addGroupingLevel
public void addGroupingLevel()Adds a new grouping level on top. -
getLevelCount
public int getLevelCount()- Returns:
- The number of grouping levels configured in this layer.
-
getPositionLayer
- Returns:
- The layer to which the positions in the group should match.
Typically this is the
SelectionLayer.
-
convertColumnPositionUpwards
protected int convertColumnPositionUpwards(int columnPosition) Converts the given column position thelayerPathupwards.- Parameters:
columnPosition- The column position to convert.- Returns:
- The upwards converted column position.
-
doCommand
Description copied from interface:ILayerOpportunity 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)- Specified by:
doCommandin interfaceILayer- Overrides:
doCommandin classAbstractLayerTransform- Parameters:
command- The command to execute.- Returns:
trueif the command has been handled and was therefore consumed,falseotherwise.
-
saveState
Description copied from interface:IPersistableSaves the state to the given Properties using the specified prefix. Note: The prefix must be prepended to the property key to support multiple states within one Properties instance.- Specified by:
saveStatein interfaceIPersistable- Overrides:
saveStatein classAbstractLayerTransform- Parameters:
prefix- The prefix to use for the state keys. Is also used as the state configuration name.properties- The Properties instance to save the state to.
-
loadState
Description copied from class:AbstractLayerTransformUnderlying layers must load state first. If this is not done,IStructuralChangeEventfrom underlying layers will reset caches after state has been loaded- Specified by:
loadStatein interfaceIPersistable- Overrides:
loadStatein classAbstractLayerTransform- Parameters:
prefix- The prefix to use for the state keys. Is also used as the state configuration name.properties- The Properties instance to load the state from.
-
getRowCount
public int getRowCount()- Specified by:
getRowCountin interfaceILayer- Overrides:
getRowCountin classAbstractLayerTransform- Returns:
- The number of rows in this layer.
-
getPreferredRowCount
public int getPreferredRowCount()- Specified by:
getPreferredRowCountin interfaceILayer- Overrides:
getPreferredRowCountin classAbstractLayerTransform
-
getRowIndexByPosition
public int getRowIndexByPosition(int rowPosition) Description copied from interface:ILayerGets the underlying non-transformed row index for the given row position on this layer.- Specified by:
getRowIndexByPositionin interfaceILayer- Overrides:
getRowIndexByPositionin classAbstractLayerTransform- Parameters:
rowPosition- The row position relative to this layer.- Returns:
- An underlying non-transformed row index, or -1 if the given row position does not exist within this coordinate system.
-
localToUnderlyingRowPosition
public int localToUnderlyingRowPosition(int localRowPosition) Description copied from interface:ILayerConvert a row position to the coordinates of the underlying layer. This is possible since each layer is aware of its underlying layer.- Specified by:
localToUnderlyingRowPositionin interfaceILayer- Overrides:
localToUnderlyingRowPositionin classAbstractLayerTransform- Parameters:
localRowPosition- row position in local (the layer's own) coordinates- Returns:
- row position in the underlying layer's coordinates
-
underlyingToLocalRowPosition
Description copied from interface:ILayerTransforms the row position relative to the given underlying layer to this layer coordinates.- Specified by:
underlyingToLocalRowPositionin interfaceILayer- Overrides:
underlyingToLocalRowPositionin classAbstractLayerTransform- Parameters:
sourceUnderlyingLayer- The underlying layer to which the given row position matches.underlyingRowPosition- The row position in the given underlying layer that should be converted to a local row position.- Returns:
- The given row position transformed to be local to this layer.
-
getHeight
public int getHeight()Description copied from interface:ILayerReturns the total height in pixels of this layer.- Specified by:
getHeightin interfaceILayer- Overrides:
getHeightin classAbstractLayerTransform- Returns:
- The total height in pixels of this layer.
-
getPreferredHeight
public int getPreferredHeight()- Specified by:
getPreferredHeightin interfaceILayer- Overrides:
getPreferredHeightin classAbstractLayerTransform
-
getRowHeightByPosition
public int getRowHeightByPosition(int rowPosition) Description copied from interface:ILayerReturns the height in pixels of the given row. The height of invisible and non-existing rows is 0.- Specified by:
getRowHeightByPositionin interfaceILayer- Overrides:
getRowHeightByPositionin classAbstractLayerTransform- Parameters:
rowPosition- The row position in this layer.- Returns:
- The height of the row.
-
setRowHeight
public void setRowHeight(int rowHeight) Set the row height for grouping level 0.- Parameters:
rowHeight- The height to set for grouping level 0.
-
setRowHeight
public void setRowHeight(int row, int rowHeight) Set the row height for the given row in this layer.Note: Use
getLevelForRowPosition(int)if the row position for a level needs to be determined.- Parameters:
row- The row whose height should be set.rowHeight- The height to set for the given row position.
-
getRowPositionForLevel
public int getRowPositionForLevel(int level) - Parameters:
level- The level for which the row position is requested.- Returns:
- The row positions for the given grouping level.
-
getLevelForRowPosition
public int getLevelForRowPosition(int rowPosition) - Parameters:
rowPosition- The row position for which the level is requested.- Returns:
- The level for the given row position.
-
isRowPositionResizable
public boolean isRowPositionResizable(int rowPosition) Description copied from interface:ILayerCheck if the row at the given position is resizable.- Specified by:
isRowPositionResizablein interfaceILayer- Overrides:
isRowPositionResizablein classAbstractLayerTransform- Parameters:
rowPosition- The row position to check.- Returns:
trueif the row is resizable,falseif not.
-
setRowPositionResizable
public void setRowPositionResizable(int rowPosition, boolean resizable) Set the row resizable configuration for the given row position.- Parameters:
rowPosition- The row for which the resizable flag should be set.resizable-trueif the row should be resizable,falseif not.
-
getRowPositionByY
public int getRowPositionByY(int y) Description copied from interface:ILayerReturns the row position that contains the given y coordinate.- Specified by:
getRowPositionByYin interfaceILayer- Overrides:
getRowPositionByYin classAbstractLayerTransform- Parameters:
y- a vertical pixel location relative to the pixel boundary of this layer- Returns:
- a row position relative to the associated coordinate system, or -1 if there is no row that contains y
-
getStartYOfRowPosition
public int getStartYOfRowPosition(int rowPosition) Description copied from interface:ILayerReturns the y offset in pixels of the given row.- Specified by:
getStartYOfRowPositionin interfaceILayer- Overrides:
getStartYOfRowPositionin classAbstractLayerTransform- Parameters:
rowPosition- the row position in this layer- Returns:
- the y offset of the row, or -1
-
getCellByPosition
Description copied from interface:ILayerReturns the cell for the given coordinates on this layer.- Specified by:
getCellByPositionin interfaceILayer- Overrides:
getCellByPositionin classAbstractLayerTransform- Parameters:
columnPosition- The column position of the requested cell.rowPosition- The row position of the requested cell.- Returns:
- The
ILayerCellfor the given coordinates in this layer ornullif the coordinates are invalid on this layer.
-
getBoundsByPosition
public org.eclipse.swt.graphics.Rectangle getBoundsByPosition(int columnPosition, int rowPosition) Description copied from interface:ILayerCalculates the bounds in pixel for the given cell position.- Specified by:
getBoundsByPositionin interfaceILayer- Overrides:
getBoundsByPositionin classAbstractLayer- Parameters:
columnPosition- the column position of the cellrowPosition- the row position of the cell- Returns:
- the bounds, or
nullif there are no valid bounds
-
getGroupByPosition
Get theGroupModel.Groupfor the column at the given column position for level 0. Will transform the given column position to a position matching the position layer for correct resolution.- Parameters:
columnPosition- The column position related to this layer.- Returns:
- The
GroupModel.Groupat the given column position ornullif there is noGroupModel.Groupat this position.
-
getGroupByPosition
Get theGroupModel.Groupfor the column at the given column position for the given grouping level. Will transform the given column position to a position matching the position layer for correct resolution.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.columnPosition- The column position related to this layer.- Returns:
- The
GroupModel.Groupat the given column position ornullif there is noGroupModel.Groupat this position.
-
findGroupForCoordinates
Finds aGroupModel.Groupand its parentGroupModelbased on the coordinates.- Parameters:
columnPosition- The column position based on the position layer.rowPosition- The row position based on this layer.- Returns:
- Object array where the first item is the
GroupModeland the second item is the foundGroupModel.Group. Returnsnullif either noGroupModelor noGroupModel.Groupwas found.
-
isPartOfAGroup
public boolean isPartOfAGroup(int columnPosition) Checks if there is aGroupModel.Groupconfigured for the given column position at any level.- Parameters:
columnPosition- The column position related to this layer.- Returns:
trueif there is aGroupModel.Groupat the given column position,falseif not.
-
isPartOfAGroup
public boolean isPartOfAGroup(int level, int columnPosition) Checks if there is aGroupModel.Groupconfigured for the given column position at the given level.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.columnPosition- The column position related to this layer.- Returns:
trueif there is aGroupModel.Groupat the given column position,falseif not.
-
isPartOfAnUnbreakableGroup
public boolean isPartOfAnUnbreakableGroup(int columnPosition) Check if the specified position belongs to aGroupModel.Groupand if thisGroupModel.Groupis unbreakable. Convenience method for checks on level 0.- Parameters:
columnPosition- The position used to retrieve the corresponding group related to this layer.- Returns:
trueif the specified position belongs to aGroupModel.Groupand thisGroupModel.Groupis unbreakable,falseif not.
-
isPartOfAnUnbreakableGroup
public boolean isPartOfAnUnbreakableGroup(int level, int columnPosition) Check if the specified position belongs to aGroupModel.Groupat the specified level and if thisGroupModel.Groupis unbreakable.- Parameters:
level- The level for which the check should be performed.columnPosition- The position used to retrieve the corresponding group related to this layer.- Returns:
trueif the specified position belongs to aGroupModel.Groupat the specified level and thisGroupModel.Groupis unbreakable,falseif not.
-
getColumnSpan
Calculates the span of a cell in a group. Takes into account collapsed and hidden columns in the group.- Parameters:
group- the group for which the span should be calculated.
-
getDisplayModeByPosition
Description copied from interface:ILayerReturns the activeDisplayModefor the cell at the given coordinates. Needed to retrieve the corresponding configurations out of theIConfigRegistry. The default value isDisplayMode.NORMAL. The SelectionLayer for example overrides this to returnDisplayMode.SELECTfor cells that are currently selected.- Specified by:
getDisplayModeByPositionin interfaceILayer- Overrides:
getDisplayModeByPositionin classAbstractLayerTransform- Parameters:
columnPosition- The column position of the cell.rowPosition- The row position of the cell.- Returns:
DisplayModefor the cell at the given coordinates.
-
getConfigLabelsByPosition
Description copied from interface:ILayerReturns the config labels for the cell at the given coordinates. Needed to retrieve the corresponding configurations out of theIConfigRegistry.- Specified by:
getConfigLabelsByPositionin interfaceILayer- Overrides:
getConfigLabelsByPositionin classAbstractLayerTransform- Parameters:
columnPosition- The column position of the cell.rowPosition- The row position of the cell.- Returns:
- The
LabelStackwith the config labels for the cell at the given coordinates.
-
getDataValueByPosition
Description copied from interface:ILayerReturns the data value for the cell at the given coordinates.- Specified by:
getDataValueByPositionin interfaceILayer- Overrides:
getDataValueByPositionin classAbstractLayerTransform- 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.
-
getRegionLabelsByXY
Description copied from interface:ILayerReturn theLabelStackcontaining the region labels for the cell at the given pixel position.- Specified by:
getRegionLabelsByXYin interfaceILayer- Overrides:
getRegionLabelsByXYin classAbstractLayerTransform- Parameters:
x- the x pixel coordinatey- the y pixel coordinate- Returns:
- LabelStack containing the region labels for the cell at the given pixel position.
-
getGroupByName
Returns theGroupModel.Groupfor the given name at level 0.- Parameters:
name- The name of the requested group.- Returns:
- The group with the given group name or
nullif there is no group with such a name.
-
getGroupByName
Returns theGroupModel.Groupfor the given name.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.name- The name of the requested group.- Returns:
- The group with the given group name or
nullif there is no group with such a name.
-
addPositionsToGroup
Adds the given positions to the group with the given name.- Parameters:
groupName- The name of the group to which the given positions should be added.positions- The positions to add corresponding to this layer.
-
addPositionsToGroup
Adds the given positions to the group with the given name.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.groupName- The name of the group to which the given positions should be added.positions- The positions to add corresponding to this layer.
-
addPositionsToGroup
public void addPositionsToGroup(int level, int columnPosition, int... positions) Adds the given positions to the group to which the given column position belongs to.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.columnPosition- The column position related to this layer to get the corresponding group to which the given positions should be added.positions- The positions to add corresponding to this layer.
-
addPositionsToGroup
Adds the given positions to the givenGroupModel.Group.- Parameters:
group- TheGroupModel.Groupto which the positions should be added.positions- The positions to add corresponding to this layer.
-
addPositionsToGroup
Adds the given positions to the givenGroupModel.Group.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.group- TheGroupModel.Groupto which the positions should be added.positions- The positions to add corresponding to this layer.
-
removePositionsFromGroup
public void removePositionsFromGroup(int level, int... positions) Removes the given positions from corresponding groups. Only performs an action if the position is part of the group.Note:
A removal will only happen for columns at the beginning or the end of a group. Removing a position in the middle will cause removal of columns at the end of the group to avoid splitting a group.Note:
A removal does only work for visible positions. That means removing something from a collapsed group does not work.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.positions- The positions to remove corresponding to this layer.
-
addGroup
Creates and adds a group.- Parameters:
groupName- The name of the group. Typically used as value in the cell.startIndex- The index of the first item in the group.span- The configured number of items that belong to this group.
-
addGroup
Creates and adds a group.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.groupName- The name of the group. Typically used as value in the cell.startIndex- The index of the first item in the group.span- The configured number of items that belong to this group.
-
removeGroup
Removes the group identified by the given name.- Parameters:
groupName- The name of the group to remove.
-
removeGroup
Removes the group identified by the given name.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.groupName- The name of the group to remove.
-
removeGroup
public void removeGroup(int columnPosition) Removes the group identified by the given column position.- Parameters:
columnPosition- The group that contains the given column position.
-
removeGroup
public void removeGroup(int level, int columnPosition) Removes the group identified by the given column position.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.columnPosition- The group that contains the given column position.
-
removeGroup
Removes the given group.- Parameters:
group- The group to remove.
-
removeGroup
Removes the given group.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.group- The group to remove.
-
clearAllGroups
public void clearAllGroups()Removes all groups in all levels. -
clearAllGroups
public void clearAllGroups(int level) Removes all groups in the given level.- Parameters:
level- The grouping level that should be cleared. The level is zero based bottom-up.
-
addStaticColumnIndexesToGroup
Adds the given indexes as static indexes to the group that is identified by the given group name. Static indexes are the indexes that stay visible when the group is collapsed.- Parameters:
groupName- The name of a group to which the the static indexes should be added to.staticIndexes- The static indexes to add.
-
addStaticColumnIndexesToGroup
Adds the given indexes as static indexes to the group that is identified by the given group name. Static indexes are the indexes that stay visible when the group is collapsed.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.groupName- The name of a group to which the the static indexes should be added to.staticIndexes- The static indexes to add.
-
addStaticColumnIndexesToGroup
public void addStaticColumnIndexesToGroup(int level, int columnPosition, int... staticIndexes) Adds the given indexes as static indexes to the group that is identified by the given column position. Static indexes are the indexes that stay visible when the group is collapsed.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.columnPosition- The position of a group to which the the static indexes should be added to.staticIndexes- The static indexes to add.
-
collapseGroup
Collapses the group with the given name.- Parameters:
groupName- The name of the group that should be collapsed.
-
collapseGroup
Collapses the group with the given name.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.groupName- The name of the group that should be collapsed.
-
collapseGroup
public void collapseGroup(int position) Collapses the group for the given position, if the column at the specified position belongs to a group.- Parameters:
position- The position corresponding to this layer whose corresponding group should be collapsed.
-
collapseGroup
public void collapseGroup(int level, int position) Collapses the group for the given position, if the column at the specified position belongs to a group.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.position- The position corresponding to this layer whose corresponding group should be collapsed.
-
collapseGroup
Collapses the given group of the given group model.- Parameters:
groupModel- The group model to which the given group belongs to.group- The group to collapse.
-
collapseAllGroups
public void collapseAllGroups()Collapses all groups in all levels. -
collapseAllGroups
public void collapseAllGroups(int level) Collapses all groups in the given level.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.
-
expandGroup
Expands the group with the given name.- Parameters:
groupName- The name of the group that should be expanded.
-
expandGroup
Expands the group with the given name.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.groupName- The name of the group that should be expanded.
-
expandGroup
public void expandGroup(int position) Expands the group for the given position, if the column at the specified position belongs to a group.- Parameters:
position- The position corresponding to this layer whose corresponding group should be expanded.
-
expandGroup
public void expandGroup(int level, int position) Expands the group for the given position, if the column at the specified position belongs to a group.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.position- The position corresponding to this layer whose corresponding group should be expanded.
-
expandGroup
Expands the given group of the given group model.- Parameters:
groupModel- The group model to which the given group belongs to.group- The group to expand.
-
expandAllGroups
public void expandAllGroups()Expands all groups in all levels. -
expandAllGroups
public void expandAllGroups(int level) Expands all groups in the given level.- Parameters:
level- The grouping level that should be expanded. The level is zero based bottom-up.
-
setDefaultCollapseable
public void setDefaultCollapseable(boolean defaultCollapseable) Sets the default value for the collapseable flag when creating group objects for all group levels.- Parameters:
defaultCollapseable- the default value for the collapseable flag that should be set on creating group.
-
isDefaultCollapseable
public boolean isDefaultCollapseable(int level) - Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.- Returns:
- The default value for the collapseable flag of newly created group objects.
-
setDefaultCollapseable
public void setDefaultCollapseable(int level, boolean defaultCollapseable) Sets the default value for the collapseable flag when creating group objects.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.defaultCollapseable- the default value for the collapseable flag that should be set on creating group.
-
setGroupCollapseable
Set the group with the given group name to be collapseable or not.- Parameters:
groupName- The name of the group that should be modified.collabseable-trueto set the group collapseable,falseto set it not to be collapseable.
-
setGroupCollapseable
Set the group with the given group name to be collapseable or not.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.groupName- The name of the group that should be modified.collabseable-trueto set the group collapseable,falseto set it not to be collapseable.
-
setGroupCollapseable
public void setGroupCollapseable(int position, boolean collabseable) Set the group to which the specified position belongs to, to be collapseable or not.- Parameters:
position- The position used to retrieve the corresponding group.collabseable-trueto set the group collapseable,falseto set it not to be collapseable.
-
setGroupCollapseable
public void setGroupCollapseable(int level, int position, boolean collabseable) Set the group to which the specified position belongs to, to be collapseable or not.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.position- The position used to retrieve the corresponding group.collabseable-trueto set the group collapseable,falseto set it not to be collapseable.
-
setDefaultUnbreakable
public void setDefaultUnbreakable(boolean defaultUnbreakable) Sets the default value for the unbreakable flag when creating group objects for all grouping levels.- Parameters:
defaultUnbreakable- the default value for the unbreakable flag that should be set on creating group.
-
isDefaultUnbreakable
public boolean isDefaultUnbreakable(int level) - Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.- Returns:
- The default value for the unbreakable flag of newly created group objects.
-
setDefaultUnbreakable
public void setDefaultUnbreakable(int level, boolean defaultUnbreakable) Sets the default value for the unbreakable flag when creating group objects.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.defaultUnbreakable- the default value for the unbreakable flag that should be set on creating group.
-
setGroupUnbreakable
Set the group with the given name to unbreakable/breakable.- Parameters:
groupName- The name of the group that should be modified.unbreakable-trueto set the group unbreakable,falseto remove the unbreakable state.
-
setGroupUnbreakable
Set the group with the given name to unbreakable/breakable.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.groupName- The name of the group that should be modified.unbreakable-trueto set the group unbreakable,falseto remove the unbreakable state.
-
setGroupUnbreakable
public void setGroupUnbreakable(int position, boolean unbreakable) Set the group to which the position belongs to unbreakable/breakable.- Parameters:
position- The position used to retrieve the corresponding group.unbreakable-trueto set the group unbreakable,falseto remove the unbreakable state.
-
setGroupUnbreakable
public void setGroupUnbreakable(int level, int position, boolean unbreakable) Set the group to which the position belongs to unbreakable/breakable.- Parameters:
level- The grouping level for which the group is requested. The level is zero based bottom-up.position- The position used to retrieve the corresponding group.unbreakable-trueto set the group unbreakable,falseto remove the unbreakable state.
-
isCalculateHeight
public boolean isCalculateHeight()- Returns:
trueif the a check is performed whether column groups are configured or not. If not the height of the layer will not show additional height for showing column groups.falseif the height should be fixed regardless of existing column group.
-
setCalculateHeight
public void setCalculateHeight(boolean calculateHeight) Configure whether theColumnGroupHeaderLayershould calculate the height of the layer dependent on column group configuration or not.- Parameters:
calculateHeight-trueif the layer should check if column groups are configured and if not, the height of the column header will not show the double height for showing column groups.falseif the height should be fixed regardless of existing column group.
-
isShowAlwaysGroupNames
public boolean isShowAlwaysGroupNames()- Returns:
trueif the group names are always visible on rendering, e.g. on scrolling,falseif the group names stay at the fixed position in the cell and scroll with the cell. Default isfalse.
-
setShowAlwaysGroupNames
public void setShowAlwaysGroupNames(boolean showAlwaysGroupNames) Configure whether group names should be always visible on rendering, e.g. on scrolling, or if the group names should scroll with the cell. Setting this value totrueis recommended for huge column groups to ensure that the group name is always visible. This also increases the rendering performance as the spanned grouping cells are limited to the visible area.- Parameters:
showAlwaysGroupNames-trueif the group names should be always visible on rendering, e.g. on scrolling,falseif the group names should stay at the fixed position in the cell and scroll with the cell. Default isfalse.
-
getReorderFromColumnPosition
public int getReorderFromColumnPosition()Used to support column reordering via drag and drop. Needed because on drag the viewport could scroll and therefore on drag end the initial position could not be determined anymore.- Returns:
- The position from which a column reorder operation was started.
Position is based on the configured
positionLayer.
-
setReorderFromColumnPosition
public void setReorderFromColumnPosition(int fromColumnPosition) Set the position from which a column group drag operation was started.Used to support column reordering via drag and drop. Needed because on drag the viewport could scroll and therefore on drag end the initial position could not be determined anymore.
- Parameters:
fromColumnPosition- The position from which a column reorder operation was started. Position needs to be based on the configuredpositionLayer.
-
isReorderSupportedOnLevel
public boolean isReorderSupportedOnLevel(int level) Check if reordering for the given grouping level is supported or not. By default reordering is supported on all grouping levels.- Parameters:
level- The level to check.- Returns:
trueif the given grouping level does support reordering,falseif group reordering is not supported for the given level.
-
setReorderSupportedOnLevel
public void setReorderSupportedOnLevel(int level, boolean supported) Configure whether reordering for a grouping level should be supported or not. By default reordering is enabled for all grouping levels.- Parameters:
level- The level for which the reorder support should be configured.supported-trueif the given grouping level should support reordering,falseif group reordering should not be supported for the given level.
-
reorderColumnGroup
public boolean reorderColumnGroup(int level, int fromColumnPosition, int toColumnPosition) Reorder a column group for the fromColumnPosition at the given level to the specified toColumnPosition.- Parameters:
level- The group level on which the group reorder should be performed.fromColumnPosition- The column position of a column in the column group that should be reordered. Based on the configuredpositionLayer.toColumnPosition- The column position to which a column group should be reordered to. Based on the configuredpositionLayer.- Returns:
trueif the reorder command was executed and consumed successfully
-
getProvidedLabels
- Specified by:
getProvidedLabelsin interfaceILayer- Overrides:
getProvidedLabelsin classAbstractLayer- Returns:
- The collection of labels that are provided by this layer.
-