Class RowGroupHeaderLayer
- All Implemented Interfaces:
ILayer
,ILayerListener
,IPersistable
NatTable.saveState(String, Properties)
is invoked.
Internally uses a collection of GroupModel
to track the row groups on
multiple levels.
It supports multiple row grouping levels. The levels are 0 based and configured right-to-left. That means if 3 levels of row groups are defined, the first level==0 is the right most columnPosition==2, and the left most level==2 is on columnPosition==0.
- Since:
- 1.6
-
Field Summary
Fields inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
underlyingLayer
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
ConstructorDescriptionRowGroupHeaderLayer
(ILayer underlyingHeaderLayer, IUniqueIndexLayer positionLayer, SelectionLayer selectionLayer) Creates aRowGroupHeaderLayer
with the specified configurations and one grouping level.RowGroupHeaderLayer
(ILayer underlyingHeaderLayer, IUniqueIndexLayer positionLayer, SelectionLayer selectionLayer, boolean useDefaultConfiguration) Creates aRowGroupHeaderLayer
with one grouping level and the specified configurations.RowGroupHeaderLayer
(ILayer underlyingHeaderLayer, IUniqueIndexLayer positionLayer, SelectionLayer selectionLayer, int numberOfGroupLevels) Creates aRowGroupHeaderLayer
with the specified configurations.RowGroupHeaderLayer
(ILayer underlyingHeaderLayer, IUniqueIndexLayer positionLayer, SelectionLayer selectionLayer, int numberOfGroupLevels, boolean useDefaultConfiguration) Creates aRowGroupHeaderLayer
with the specified configurations.RowGroupHeaderLayer
(ILayer underlyingHeaderLayer, SelectionLayer selectionLayer) Creates aRowGroupHeaderLayer
with the specified configurations and one grouping level.RowGroupHeaderLayer
(ILayer underlyingHeaderLayer, SelectionLayer selectionLayer, boolean useDefaultConfiguration) Creates aRowGroupHeaderLayer
with one grouping level and the specified configurations.RowGroupHeaderLayer
(ILayer underlyingHeaderLayer, SelectionLayer selectionLayer, int numberOfGroupLevels) Creates aRowGroupHeaderLayer
with the specified configurations.RowGroupHeaderLayer
(ILayer underlyingHeaderLayer, SelectionLayer selectionLayer, int numberOfGroupLevels, boolean useDefaultConfiguration) Creates aRowGroupHeaderLayer
with the specified configurations. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Creates and adds a group.void
Creates and adds a group.void
Adds a new grouping level on top.void
addPositionsToGroup
(int level, int rowPosition, int... positions) Adds the given positions to the group to which the given row position belongs to.void
addPositionsToGroup
(int level, String groupName, int... positions) Adds the given positions to the group with the given name.protected void
addPositionsToGroup
(int level, GroupModel.Group group, int... positions) Adds the given positions to the givenGroupModel.Group
.void
addPositionsToGroup
(String groupName, int... positions) Adds the given positions to the group with the given name.protected void
addPositionsToGroup
(GroupModel.Group group, int... positions) Adds the given positions to the givenGroupModel.Group
.void
addStaticRowIndexesToGroup
(int level, int rowPosition, int... staticIndexes) Adds the given indexes as static indexes to the group that is identified by the given row position.void
addStaticRowIndexesToGroup
(int level, String groupName, int... staticIndexes) Adds the given indexes as static indexes to the group that is identified by the given group name.void
addStaticRowIndexesToGroup
(String groupName, int... staticIndexes) Adds the given indexes as static indexes to the group that is identified by the given group name.void
Removes all groups in all levels.void
clearAllGroups
(int level) Removes all groups in the given level.void
Collapses all groups in all levels.void
collapseAllGroups
(int level) Collapses all groups in the given level.void
collapseGroup
(int position) Collapses the group for the given position, if the row at the specified position belongs to a group.void
collapseGroup
(int level, int position) Collapses the group for the given position, if the row at the specified position belongs to a group.void
collapseGroup
(int level, String groupName) Collapses the group with the given name.void
collapseGroup
(String groupName) Collapses the group with the given name.void
collapseGroup
(GroupModel groupModel, GroupModel.Group group) Collapses the given group of the given group model.protected int
convertRowPositionUpwards
(int rowPosition) Converts the given row position thelayerPath
upwards.boolean
doCommand
(ILayerCommand command) Opportunity to respond to a command as it flows down the stack.void
Expands all groups in all levels.void
expandAllGroups
(int level) Expands all groups in the given level.void
expandGroup
(int position) Expands the group for the given position, if the column at the specified position belongs to a group.void
expandGroup
(int level, int position) Expands the group for the given position, if the column at the specified position belongs to a group.void
expandGroup
(int level, String groupName) Expands the group with the given name.void
expandGroup
(String groupName) Expands the group with the given name.void
expandGroup
(GroupModel groupModel, GroupModel.Group group) Expands the given group of the given group model.protected Object[]
findGroupForCoordinates
(int columnPosition, int rowPosition) Finds aGroupModel.Group
and its parentGroupModel
based on the coordinates.org.eclipse.swt.graphics.Rectangle
getBoundsByPosition
(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.int
int
getColumnIndexByPosition
(int columnPosition) Gets the underlying non-transformed column index for the given column position on this layer.int
getColumnPositionByX
(int x) Returns the column position that contains the given x coordinate.int
getColumnPositionForLevel
(int level) int
getColumnWidthByPosition
(int columnPosition) Returns the width in pixels of the given column.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 activeDisplayMode
for the cell at the given coordinates.getGroupByName
(int level, String name) Returns theGroupModel.Group
for the given name.getGroupByName
(String name) Returns theGroupModel.Group
for the given name at level 0.getGroupByPosition
(int rowPosition) Get theGroupModel.Group
for the row at the given row position for level 0.getGroupByPosition
(int level, int rowPosition) Get theGroupModel.Group
for the row at the given row position for the given grouping level.Convenience method to get theGroupModel
on level 0.getGroupModel
(int level) Return theGroupModel
for the given grouping level.int
int
getLevelForColumnPosition
(int columnPosition) int
int
getRegionLabelsByXY
(int x, int y) Return theLabelStack
containing the region labels for the cell at the given pixel position.int
Used to support row reordering via drag and drop.int
getRowSpan
(GroupModel.Group group) Calculates the span of a cell in a group.int
getStartXOfColumnPosition
(int columnPosition) Returns the x offset in pixels of the given column.int
getWidth()
Returns the total width in pixels of this layer.boolean
boolean
isColumnPositionResizable
(int columnPosition) Check if the column at the given position is resizable.boolean
isDefaultCollapseable
(int level) boolean
isDefaultUnbreakable
(int level) boolean
isPartOfAGroup
(int rowPosition) Checks if there is aGroupModel.Group
configured for the given row position at any level.boolean
isPartOfAGroup
(int level, int rowPosition) Checks if there is aGroupModel.Group
configured for the given row position at the given level.boolean
isPartOfAnUnbreakableGroup
(int rowPosition) Check if the specified position belongs to aGroupModel.Group
and if thisGroupModel.Group
is unbreakable.boolean
isPartOfAnUnbreakableGroup
(int level, int rowPosition) Check if the specified position belongs to aGroupModel.Group
at the specified level and if thisGroupModel.Group
is unbreakable.boolean
isReorderSupportedOnLevel
(int level) Check if reordering for the given grouping level is supported or not.boolean
void
loadState
(String prefix, Properties properties) Underlying layers must load state first.int
localToUnderlyingColumnPosition
(int localColumnPosition) Convert a column position to the coordinates of the underlying layer.protected void
registerCommandHandlers
(SelectionLayer selectionLayer) Register command handlers for this layer.void
removeGroup
(int rowPosition) Removes the group identified by the given row position.void
removeGroup
(int level, int rowPosition) Removes the group identified by the given row position.void
removeGroup
(int level, String groupName) Removes the group identified by the given name.void
removeGroup
(int level, GroupModel.Group group) Removes the given group.void
removeGroup
(String groupName) Removes the group identified by the given name.void
removeGroup
(GroupModel.Group group) Removes the given group.void
removePositionsFromGroup
(int level, int... positions) Removes the given positions from corresponding groups.boolean
reorderRowGroup
(int level, int fromRowPosition, int toRowPosition) Reorder a row group for the fromRowPosition at the given level to the specified toRowPosition.void
saveState
(String prefix, Properties properties) Saves the state to the given Properties using the specified prefix.void
setCalculateWidth
(boolean calculateWidth) Configure whether theRowGroupHeaderLayer
should calculate the width of the layer dependent on row group configuration or not.void
setColumnPositionResizable
(int columnPosition, boolean resizable) Set the column resizable configuration for the given column position.void
setColumnWidth
(int columnWidth) Set the column width for grouping level 0.void
setColumnWidth
(int column, int columnWidth) Set the column width for the given column in this layer.void
setDefaultCollapseable
(boolean defaultCollapseable) Sets the default value for the collapseable flag when creating group objects for all group levels.void
setDefaultCollapseable
(int level, boolean defaultCollapseable) Sets the default value for the collapseable flag when creating group objects.void
setDefaultUnbreakable
(boolean defaultUnbreakable) Sets the default value for the unbreakable flag when creating group objects for all grouping levels.void
setDefaultUnbreakable
(int level, boolean defaultUnbreakable) Sets the default value for the unbreakable flag when creating group objects.void
setGroupCollapseable
(int position, boolean collabseable) Set the group to which the specified position belongs to, to be collapseable or not.void
setGroupCollapseable
(int level, int position, boolean collabseable) Set the group to which the specified position belongs to, to be collapseable or not.void
setGroupCollapseable
(int level, String groupName, boolean collabseable) Set the group with the given group name to be collapseable or not.void
setGroupCollapseable
(String groupName, boolean collabseable) Set the group with the given group name to be collapseable or not.void
setGroupUnbreakable
(int position, boolean unbreakable) Set the group to which the position belongs to unbreakable/breakable.void
setGroupUnbreakable
(int level, int position, boolean unbreakable) Set the group to which the position belongs to unbreakable/breakable.void
setGroupUnbreakable
(int level, String groupName, boolean unbreakable) Set the group with the given name to unbreakable/breakable.void
setGroupUnbreakable
(String groupName, boolean unbreakable) Set the group with the given name to unbreakable/breakable.void
setLayerPainter
(ILayerPainter layerPainter) void
setReorderFromRowPosition
(int fromRowPosition) Set the position from which a row group drag operation was started.void
setReorderSupportedOnLevel
(int level, boolean supported) Configure whether reordering for a grouping level should be supported or not.void
setShowAlwaysGroupNames
(boolean showAlwaysGroupNames) Configure whether group names should be always visible on rendering, e.g.int
underlyingToLocalColumnPosition
(ILayer sourceUnderlyingLayer, int underlyingColumnPosition) Transforms the column 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, getHeight, getPreferredHeight, getPreferredRowCount, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByY, getStartYOfRowPosition, getUnderlyingLayer, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, isDynamicSizeLayer, isRowPositionResizable, localToUnderlyingRowPosition, setClientAreaProvider, setUnderlyingLayer, underlyingToLocalColumnPositions, underlyingToLocalRowPosition, underlyingToLocalRowPositions
Methods 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
-
RowGroupHeaderLayer
Creates aRowGroupHeaderLayer
with 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 RowHeaderLayer.selectionLayer
- The SelectionLayer needed for command handlers that inspect the selection on handling.
-
RowGroupHeaderLayer
public RowGroupHeaderLayer(ILayer underlyingHeaderLayer, SelectionLayer selectionLayer, int numberOfGroupLevels) Creates aRowGroupHeaderLayer
with 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 RowHeaderLayer.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()
.
-
RowGroupHeaderLayer
public RowGroupHeaderLayer(ILayer underlyingHeaderLayer, IUniqueIndexLayer positionLayer, SelectionLayer selectionLayer) Creates aRowGroupHeaderLayer
with 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 RowHeaderLayer.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.
-
RowGroupHeaderLayer
public RowGroupHeaderLayer(ILayer underlyingHeaderLayer, IUniqueIndexLayer positionLayer, SelectionLayer selectionLayer, int numberOfGroupLevels) Creates aRowGroupHeaderLayer
with the specified configurations. Uses the default configuration.- Parameters:
underlyingHeaderLayer
- The underlying layer on whose top this layer should be created, typically the RowHeaderLayer.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()
.
-
RowGroupHeaderLayer
public RowGroupHeaderLayer(ILayer underlyingHeaderLayer, SelectionLayer selectionLayer, int numberOfGroupLevels, boolean useDefaultConfiguration) Creates aRowGroupHeaderLayer
with the specified configurations. Takes theSelectionLayer
as positionLayer.- Parameters:
underlyingHeaderLayer
- The underlying layer on whose top this layer should be created, typically the RowHeaderLayer.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
-true
if the default configuration should be applied,false
if a custom configuration will be applied afterwards.
-
RowGroupHeaderLayer
public RowGroupHeaderLayer(ILayer underlyingHeaderLayer, SelectionLayer selectionLayer, boolean useDefaultConfiguration) Creates aRowGroupHeaderLayer
with one grouping level and the specified configurations. Takes theSelectionLayer
as positionLayer.- Parameters:
underlyingHeaderLayer
- The underlying layer on whose top this layer should be created, typically the RowHeaderLayer.selectionLayer
- The SelectionLayer needed for command handlers that inspect the selection on handling.useDefaultConfiguration
-true
if the default configuration should be applied,false
if a custom configuration will be applied afterwards.
-
RowGroupHeaderLayer
public RowGroupHeaderLayer(ILayer underlyingHeaderLayer, IUniqueIndexLayer positionLayer, SelectionLayer selectionLayer, boolean useDefaultConfiguration) Creates aRowGroupHeaderLayer
with one grouping level and the specified configurations.- Parameters:
underlyingHeaderLayer
- The underlying layer on whose top this layer should be created, typically the RowHeaderLayer.positionLayer
- The positionLayer to which this layer should be mapped to, needed to handle row 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
-true
if the default configuration should be applied,false
if a custom configuration will be applied afterwards.
-
RowGroupHeaderLayer
public RowGroupHeaderLayer(ILayer underlyingHeaderLayer, IUniqueIndexLayer positionLayer, SelectionLayer selectionLayer, int numberOfGroupLevels, boolean useDefaultConfiguration) Creates aRowGroupHeaderLayer
with the specified configurations.- Parameters:
underlyingHeaderLayer
- The underlying layer on whose top this layer should be created, typically the RowHeaderLayer.positionLayer
- The positionLayer to which this layer should be mapped to, needed to handle row 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
-true
if the default configuration should be applied,false
if a custom configuration will be applied afterwards.
-
-
Method Details
-
getLayerPainter
- Specified by:
getLayerPainter
in interfaceILayer
- Overrides:
getLayerPainter
in classAbstractLayerTransform
- Returns:
- The
ILayerPainter
that is used by this layer. Typically theRowGroupHeaderGridLineCellLayerPainter
to support rendering of huge row group cells by inspecting theshowAlwaysGroupNames
attribute.
-
setLayerPainter
- Overrides:
setLayerPainter
in classAbstractLayer
-
registerCommandHandlers
Register command handlers for this layer.- Parameters:
selectionLayer
- TheSelectionLayer
needed for handling selections on grouping/ungrouping.
-
getGroupModel
Convenience method to get theGroupModel
on level 0. Useful for single level row grouping.- Returns:
- The
GroupModel
for level 0.
-
getGroupModel
Return theGroupModel
for the given grouping level. Note that the levels are right-to-left, so level 0 is the right most grouping level.- Parameters:
level
- The grouping level. Value is right-to-left.- Returns:
- The
GroupModel
for 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
.
-
convertRowPositionUpwards
protected int convertRowPositionUpwards(int rowPosition) Converts the given row position thelayerPath
upwards.- Parameters:
rowPosition
- The row position to convert.- Returns:
- The upwards converted row position.
-
doCommand
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)
- Specified by:
doCommand
in interfaceILayer
- Overrides:
doCommand
in classAbstractLayerTransform
- Parameters:
command
- The command to execute.- Returns:
true
if the command has been handled and was therefore consumed,false
otherwise.
-
saveState
Description copied from interface:IPersistable
Saves 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:
saveState
in interfaceIPersistable
- Overrides:
saveState
in 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:AbstractLayerTransform
Underlying layers must load state first. If this is not done,IStructuralChangeEvent
from underlying layers will reset caches after state has been loaded- Specified by:
loadState
in interfaceIPersistable
- Overrides:
loadState
in 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.
-
getColumnCount
public int getColumnCount()- Specified by:
getColumnCount
in interfaceILayer
- Overrides:
getColumnCount
in classAbstractLayerTransform
- Returns:
- The number of columns in this layer.
-
getPreferredColumnCount
public int getPreferredColumnCount()- Specified by:
getPreferredColumnCount
in interfaceILayer
- Overrides:
getPreferredColumnCount
in classAbstractLayerTransform
-
getColumnIndexByPosition
public int getColumnIndexByPosition(int columnPosition) Description copied from interface:ILayer
Gets the underlying non-transformed column index for the given column position on this layer.- Specified by:
getColumnIndexByPosition
in interfaceILayer
- Overrides:
getColumnIndexByPosition
in classAbstractLayerTransform
- Parameters:
columnPosition
- The column position relative to this layer.- Returns:
- An underlying non-transformed column index, or -1 if the given column position does not exist within this coordinate system.
-
localToUnderlyingColumnPosition
public int localToUnderlyingColumnPosition(int localColumnPosition) Description copied from interface:ILayer
Convert a column position to the coordinates of the underlying layer. This is possible since each layer is aware of its underlying layer.- Specified by:
localToUnderlyingColumnPosition
in interfaceILayer
- Overrides:
localToUnderlyingColumnPosition
in classAbstractLayerTransform
- Parameters:
localColumnPosition
- column position in local (the layer's own) coordinates- Returns:
- column position in the underlying layer's coordinates
-
underlyingToLocalColumnPosition
public int underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer, int underlyingColumnPosition) Description copied from interface:ILayer
Transforms the column position relative to the given underlying layer to this layer coordinates.- Specified by:
underlyingToLocalColumnPosition
in interfaceILayer
- Overrides:
underlyingToLocalColumnPosition
in classAbstractLayerTransform
- Parameters:
sourceUnderlyingLayer
- The underlying layer to which the given column position matches.underlyingColumnPosition
- The column position in the given underlying layer that should be converted to a local column position.- Returns:
- The given column position transformed to be local to this layer.
-
getWidth
public int getWidth()Description copied from interface:ILayer
Returns the total width in pixels of this layer.- Specified by:
getWidth
in interfaceILayer
- Overrides:
getWidth
in classAbstractLayerTransform
- Returns:
- The total width in pixels of this layer.
-
getPreferredWidth
public int getPreferredWidth()- Specified by:
getPreferredWidth
in interfaceILayer
- Overrides:
getPreferredWidth
in classAbstractLayerTransform
-
getColumnWidthByPosition
public int getColumnWidthByPosition(int columnPosition) Description copied from interface:ILayer
Returns the width in pixels of the given column. The width of invisible and non-existing columns is 0.- Specified by:
getColumnWidthByPosition
in interfaceILayer
- Overrides:
getColumnWidthByPosition
in classAbstractLayerTransform
- Parameters:
columnPosition
- The column position in this layer.- Returns:
- The width of the column.
-
setColumnWidth
public void setColumnWidth(int columnWidth) Set the column width for grouping level 0.- Parameters:
columnWidth
- The width to set for grouping level 0.
-
setColumnWidth
public void setColumnWidth(int column, int columnWidth) Set the column width for the given column in this layer.Note: Use
getLevelForColumnPosition(int)
if the column position for a level needs to be determined.- Parameters:
column
- The column whose width should be set.columnWidth
- The width to set for the given column position.
-
getColumnPositionForLevel
public int getColumnPositionForLevel(int level) - Parameters:
level
- The level for which the column position is requested.- Returns:
- The column position for the given grouping level.
-
getLevelForColumnPosition
public int getLevelForColumnPosition(int columnPosition) - Parameters:
columnPosition
- The column position for which the level is requested.- Returns:
- The level for the given column position.
-
isColumnPositionResizable
public boolean isColumnPositionResizable(int columnPosition) Description copied from interface:ILayer
Check if the column at the given position is resizable.- Specified by:
isColumnPositionResizable
in interfaceILayer
- Overrides:
isColumnPositionResizable
in classAbstractLayerTransform
- Parameters:
columnPosition
- The column position to check.- Returns:
true
if the column is resizable,false
if not.
-
setColumnPositionResizable
public void setColumnPositionResizable(int columnPosition, boolean resizable) Set the column resizable configuration for the given column position.- Parameters:
columnPosition
- The column for which the resizable flag should be set.resizable
-true
if the column should be resizable,false
if not.
-
getColumnPositionByX
public int getColumnPositionByX(int x) Description copied from interface:ILayer
Returns the column position that contains the given x coordinate.- Specified by:
getColumnPositionByX
in interfaceILayer
- Overrides:
getColumnPositionByX
in classAbstractLayerTransform
- Parameters:
x
- A horizontal pixel location relative to the pixel boundary of this layer.- Returns:
- A column position relative to the associated coordinate system, or -1 if there is no column that contains x.
-
getStartXOfColumnPosition
public int getStartXOfColumnPosition(int columnPosition) Description copied from interface:ILayer
Returns the x offset in pixels of the given column.- Specified by:
getStartXOfColumnPosition
in interfaceILayer
- Overrides:
getStartXOfColumnPosition
in classAbstractLayerTransform
- Parameters:
columnPosition
- The column position in this layer.- Returns:
- The x offset of the column, or -1.
-
getCellByPosition
Description copied from interface:ILayer
Returns the cell for the given coordinates on this layer.- Specified by:
getCellByPosition
in interfaceILayer
- Overrides:
getCellByPosition
in classAbstractLayerTransform
- Parameters:
columnPosition
- The column position of the requested cell.rowPosition
- The row position of the requested cell.- Returns:
- The
ILayerCell
for the given coordinates in this layer ornull
if the coordinates are invalid on this layer.
-
getBoundsByPosition
public org.eclipse.swt.graphics.Rectangle getBoundsByPosition(int columnPosition, int rowPosition) Description copied from interface:ILayer
Calculates the bounds in pixel for the given cell position.- Specified by:
getBoundsByPosition
in interfaceILayer
- Overrides:
getBoundsByPosition
in classAbstractLayer
- Parameters:
columnPosition
- the column position of the cellrowPosition
- the row position of the cell- Returns:
- the bounds, or
null
if there are no valid bounds
-
getGroupByPosition
Get theGroupModel.Group
for the row at the given row position for level 0. Will transform the given row position to a position matching the position layer for correct resolution.- Parameters:
rowPosition
- The row position related to this layer.- Returns:
- The
GroupModel.Group
at the given row position ornull
if there is noGroupModel.Group
at this position.
-
getGroupByPosition
Get theGroupModel.Group
for the row at the given row position for the given grouping level. Will transform the given row 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.rowPosition
- The row position related to this layer.- Returns:
- The
GroupModel.Group
at the given row position ornull
if there is noGroupModel.Group
at this position.
-
findGroupForCoordinates
Finds aGroupModel.Group
and its parentGroupModel
based on the coordinates.- Parameters:
columnPosition
- The column position based on this layer.rowPosition
- The row position based on the position layer.- Returns:
- Object array where the first item is the
GroupModel
and the second item is the foundGroupModel.Group
. Returnsnull
if either noGroupModel
or noGroupModel.Group
was found.
-
isPartOfAGroup
public boolean isPartOfAGroup(int rowPosition) Checks if there is aGroupModel.Group
configured for the given row position at any level.- Parameters:
rowPosition
- The row position related to this layer.- Returns:
true
if there is aGroupModel.Group
at the given row position,false
if not.
-
isPartOfAGroup
public boolean isPartOfAGroup(int level, int rowPosition) Checks if there is aGroupModel.Group
configured for the given row position at the given level.- Parameters:
level
- The grouping level for which the group is requested. The level is zero based right-to-left.rowPosition
- The row position related to this layer.- Returns:
true
if there is aGroupModel.Group
at the given row position,false
if not.
-
isPartOfAnUnbreakableGroup
public boolean isPartOfAnUnbreakableGroup(int rowPosition) Check if the specified position belongs to aGroupModel.Group
and if thisGroupModel.Group
is unbreakable. Convenience method for checks on level 0.- Parameters:
rowPosition
- The position used to retrieve the corresponding group related to this layer.- Returns:
true
if the specified position belongs to aGroupModel.Group
and thisGroupModel.Group
is unbreakable,false
if not.
-
isPartOfAnUnbreakableGroup
public boolean isPartOfAnUnbreakableGroup(int level, int rowPosition) Check if the specified position belongs to aGroupModel.Group
at the specified level and if thisGroupModel.Group
is unbreakable.- Parameters:
level
- The level for which the check should be performed.rowPosition
- The position used to retrieve the corresponding group related to this layer.- Returns:
true
if the specified position belongs to aGroupModel.Group
at the specified level and thisGroupModel.Group
is unbreakable,false
if not.
-
getRowSpan
Calculates the span of a cell in a group. Takes into account collapsed and hidden rows in the group.- Parameters:
group
- the group for which the span should be calculated.
-
getDisplayModeByPosition
Description copied from interface:ILayer
Returns the activeDisplayMode
for 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.SELECT
for cells that are currently selected.- Specified by:
getDisplayModeByPosition
in interfaceILayer
- Overrides:
getDisplayModeByPosition
in classAbstractLayerTransform
- Parameters:
columnPosition
- The column position of the cell.rowPosition
- The row position of the cell.- Returns:
DisplayMode
for the cell at the given coordinates.
-
getConfigLabelsByPosition
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 classAbstractLayerTransform
- 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.
-
getDataValueByPosition
Description copied from interface:ILayer
Returns the data value for the cell at the given coordinates.- Specified by:
getDataValueByPosition
in interfaceILayer
- Overrides:
getDataValueByPosition
in 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:ILayer
Return theLabelStack
containing the region labels for the cell at the given pixel position.- Specified by:
getRegionLabelsByXY
in interfaceILayer
- Overrides:
getRegionLabelsByXY
in 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.Group
for the given name at level 0.- Parameters:
name
- The name of the requested group.- Returns:
- The group with the given group name or
null
if there is no group with such a name.
-
getGroupByName
Returns theGroupModel.Group
for 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
null
if 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 rowPosition, int... positions) Adds the given positions to the group to which the given row position belongs to.- Parameters:
level
- The grouping level for which the group is requested. The level is zero based bottom-up.rowPosition
- The row 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.Group
to 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.Group
to 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 rows at the beginning or the end of a group. Removing a position in the middle will cause removal of rows 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 rowPosition) Removes the group identified by the given row position.- Parameters:
rowPosition
- The group that contains the given row position.
-
removeGroup
public void removeGroup(int level, int rowPosition) Removes the group identified by the given row position.- Parameters:
level
- The grouping level for which the group is requested. The level is zero based right-to-left.rowPosition
- The group that contains the given row 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 right-to-left.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.
-
addStaticRowIndexesToGroup
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.
-
addStaticRowIndexesToGroup
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 right-to-left.groupName
- The name of a group to which the the static indexes should be added to.staticIndexes
- The static indexes to add.
-
addStaticRowIndexesToGroup
public void addStaticRowIndexesToGroup(int level, int rowPosition, int... staticIndexes) Adds the given indexes as static indexes to the group that is identified by the given row 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 right-to-left.rowPosition
- 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 right-to-left.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 row 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 row at the specified position belongs to a group.- Parameters:
level
- The grouping level for which the group is requested. The level is zero based right-to-left.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 right-to-left.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 right-to-left.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 right-to-left.
-
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 right-to-left.- 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 right-to-left.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
-true
to set the group collapseable,false
to 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 right-to-left.groupName
- The name of the group that should be modified.collabseable
-true
to set the group collapseable,false
to 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
-true
to set the group collapseable,false
to 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 right-to-left.position
- The position used to retrieve the corresponding group.collabseable
-true
to set the group collapseable,false
to 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 right-to-left.- 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 right-to-left.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
-true
to set the group unbreakable,false
to 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 right-to-left.groupName
- The name of the group that should be modified.unbreakable
-true
to set the group unbreakable,false
to 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
-true
to set the group unbreakable,false
to 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 right-to-left.position
- The position used to retrieve the corresponding group.unbreakable
-true
to set the group unbreakable,false
to remove the unbreakable state.
-
isCalculateWidth
public boolean isCalculateWidth()- Returns:
true
if the a check is performed whether row groups are configured or not. If not the width of the layer will not show additional width for showing row groups.false
if the width should be fixed regardless of existing row groups.
-
setCalculateWidth
public void setCalculateWidth(boolean calculateWidth) Configure whether theRowGroupHeaderLayer
should calculate the width of the layer dependent on row group configuration or not.- Parameters:
calculateWidth
-true
if the layer should check if row groups are configured and if not, the width of the row header will not show the double width for showing row groups.false
if the width should be fixed regardless of existing row groups.
-
isShowAlwaysGroupNames
public boolean isShowAlwaysGroupNames()- Returns:
true
if the group names are always visible on rendering, e.g. on scrolling,false
if 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 totrue
is recommended for huge row 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
-true
if the group names should be always visible on rendering, e.g. on scrolling,false
if the group names should stay at the fixed position in the cell and scroll with the cell. Default isfalse
.
-
getReorderFromRowPosition
public int getReorderFromRowPosition()Used to support row 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 row reorder operation was started.
Position is based on the configured
positionLayer
.
-
setReorderFromRowPosition
public void setReorderFromRowPosition(int fromRowPosition) Set the position from which a row group drag operation was started.Used to support row 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:
fromRowPosition
- The position from which a row 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:
true
if the given grouping level does support reordering,false
if 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
-true
if the given grouping level should support reordering,false
if group reordering should not be supported for the given level.
-
reorderRowGroup
public boolean reorderRowGroup(int level, int fromRowPosition, int toRowPosition) Reorder a row group for the fromRowPosition at the given level to the specified toRowPosition.- Parameters:
level
- The group level on which the group reorder should be performed.fromRowPosition
- The row position of a row in the row group that should be reordered. Based on the configuredpositionLayer
.toRowPosition
- The row position to which a row group should be reordered to. Based on the configuredpositionLayer
.- Returns:
true
if the reorder command was executed and consumed successfully
-
getProvidedLabels
- Specified by:
getProvidedLabels
in interfaceILayer
- Overrides:
getProvidedLabels
in classAbstractLayer
- Returns:
- The collection of labels that are provided by this layer.
-