Class ColumnGroupGroupHeaderLayer
java.lang.Object
org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
org.eclipse.nebula.widgets.nattable.group.ColumnGroupGroupHeaderLayer
- All Implemented Interfaces:
ILayer
,ILayerListener
,IPersistable
Adds the Column grouping functionality to the column headers. Also persists
the state of the column groups when
NatTable.saveState(String, Properties)
is invoked.
Internally uses the ColumnGroupModel
to track the column groups.
See ColumnGroupGridExample
-
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
ConstructorDescriptionColumnGroupGroupHeaderLayer
(ColumnGroupHeaderLayer columnGroupHeaderLayer, ColumnGroupModel columnGroupModel) ColumnGroupGroupHeaderLayer
(ColumnGroupHeaderLayer columnGroupHeaderLayer, ColumnGroupModel columnGroupModel, boolean useDefaultConfiguration) ColumnGroupGroupHeaderLayer
(ColumnGroupHeaderLayer columnGroupHeaderLayer, SelectionLayer selectionLayer, ColumnGroupModel columnGroupModel) Deprecated.Use constructor without SelectionLayer parameterColumnGroupGroupHeaderLayer
(ColumnGroupHeaderLayer columnGroupHeaderLayer, SelectionLayer selectionLayer, ColumnGroupModel columnGroupModel, boolean useDefaultConfiguration) Deprecated.Use constructor without SelectionLayer parameter -
Method Summary
Modifier and TypeMethodDescriptionvoid
addColumnsIndexesToGroup
(String colGroupName, int... colIndexes) void
getCellByPosition
(int columnPosition, int rowPosition) If a cell belongs to a column group: column position - set to the start position of the group span - set to the width/size of the column group NOTE: gc.setClip() is used in the CompositeLayerPainter to ensure that partially visible Column group header cells are rendered properly.int
getColumnSpan
(int columnPosition) Calculates the span of a cell in a Column 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 activeDisplayMode
for the cell at the given coordinates.int
Returns the total height in pixels of this layer.int
int
getRegionLabelsByXY
(int x, int y) Return theLabelStack
containing the region labels for the cell at the given pixel position.int
int
getRowHeightByPosition
(int rowPosition) Returns the height in pixels of the given row.int
getRowIndexByPosition
(int rowPosition) Gets the underlying non-transformed row index for the given row position on this layer.int
getRowPositionByY
(int y) Returns the row position that contains the given y coordinate.int
getStartPositionOfGroup
(int columnPosition) Figures out the start position of the group.int
getStartYOfRowPosition
(int rowPosition) Returns the y offset in pixels of the given row.boolean
isColumnInGroup
(int bodyColumnIndex) boolean
isRowPositionResizable
(int rowPosition) Check if the row at the given position is resizable.int
localToUnderlyingRowPosition
(int localRowPosition) Convert a row position to the coordinates of the underlying layer.void
setGroupAsCollapsed
(int columnIndex) void
setGroupUnbreakable
(int columnIndex) void
setRowHeight
(int rowHeight) void
setStaticColumnIndexesByGroup
(String colGroupName, int... staticColumnIndexes) Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
configure, dispose, doCommand, getCellPainter, getColumnCount, getColumnIndexByPosition, getColumnPositionByX, getColumnWidthByPosition, getLayerPainter, getPreferredColumnCount, getPreferredWidth, getStartXOfColumnPosition, getUnderlyingLayer, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, isColumnPositionResizable, isDynamicSizeLayer, loadState, localToUnderlyingColumnPosition, saveState, setClientAreaProvider, setUnderlyingLayer, underlyingToLocalColumnPosition, underlyingToLocalColumnPositions, underlyingToLocalRowPosition, underlyingToLocalRowPositions
Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
addConfiguration, addLayerListener, clearConfiguration, fireLayerEvent, getBoundsByPosition, getClientAreaProvider, getConfigLabelAccumulator, getRegionName, handleLayerEvent, hasLayerListener, registerCommandHandler, registerCommandHandlers, registerEventHandler, registerPersistable, removeLayerListener, setConfigLabelAccumulator, setLayerPainter, setRegionName, toString, unregisterCommandHandler, unregisterEventHandler, unregisterPersistable
-
Constructor Details
-
ColumnGroupGroupHeaderLayer
@Deprecated public ColumnGroupGroupHeaderLayer(ColumnGroupHeaderLayer columnGroupHeaderLayer, SelectionLayer selectionLayer, ColumnGroupModel columnGroupModel) Deprecated.Use constructor without SelectionLayer parameter- Parameters:
columnGroupHeaderLayer
- TheColumnGroupHeaderLayer
to stack on.selectionLayer
- unusedcolumnGroupModel
- TheColumnGroupModel
used to build the column groups.
-
ColumnGroupGroupHeaderLayer
@Deprecated public ColumnGroupGroupHeaderLayer(ColumnGroupHeaderLayer columnGroupHeaderLayer, SelectionLayer selectionLayer, ColumnGroupModel columnGroupModel, boolean useDefaultConfiguration) Deprecated.Use constructor without SelectionLayer parameter- Parameters:
columnGroupHeaderLayer
- TheColumnGroupHeaderLayer
to stack on.selectionLayer
- unusedcolumnGroupModel
- TheColumnGroupModel
used to build the column groups.useDefaultConfiguration
-true
if the default configuration should be applied,false
if not.
-
ColumnGroupGroupHeaderLayer
public ColumnGroupGroupHeaderLayer(ColumnGroupHeaderLayer columnGroupHeaderLayer, ColumnGroupModel columnGroupModel) - Parameters:
columnGroupHeaderLayer
- TheColumnGroupHeaderLayer
to stack on.columnGroupModel
- TheColumnGroupModel
used to build the column groups.- Since:
- 2.0
-
ColumnGroupGroupHeaderLayer
public ColumnGroupGroupHeaderLayer(ColumnGroupHeaderLayer columnGroupHeaderLayer, ColumnGroupModel columnGroupModel, boolean useDefaultConfiguration) - Parameters:
columnGroupHeaderLayer
- TheColumnGroupHeaderLayer
to stack on.columnGroupModel
- TheColumnGroupModel
used to build the column groups.useDefaultConfiguration
-true
if the default configuration should be applied,false
if not.- Since:
- 2.0
-
-
Method Details
-
getRowCount
public int getRowCount()- Specified by:
getRowCount
in interfaceILayer
- Overrides:
getRowCount
in classAbstractLayerTransform
- Returns:
- The number of rows in this layer.
-
getPreferredRowCount
public int getPreferredRowCount()- Specified by:
getPreferredRowCount
in interfaceILayer
- Overrides:
getPreferredRowCount
in classAbstractLayerTransform
-
getRowIndexByPosition
public int getRowIndexByPosition(int rowPosition) Description copied from interface:ILayer
Gets the underlying non-transformed row index for the given row position on this layer.- Specified by:
getRowIndexByPosition
in interfaceILayer
- Overrides:
getRowIndexByPosition
in 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:ILayer
Convert a row position to the coordinates of the underlying layer. This is possible since each layer is aware of its underlying layer.- Specified by:
localToUnderlyingRowPosition
in interfaceILayer
- Overrides:
localToUnderlyingRowPosition
in classAbstractLayerTransform
- Parameters:
localRowPosition
- row position in local (the layer's own) coordinates- Returns:
- row position in the underlying layer's coordinates
-
getHeight
public int getHeight()Description copied from interface:ILayer
Returns the total height in pixels of this layer.- Specified by:
getHeight
in interfaceILayer
- Overrides:
getHeight
in classAbstractLayerTransform
- Returns:
- The total height in pixels of this layer.
-
getPreferredHeight
public int getPreferredHeight()- Specified by:
getPreferredHeight
in interfaceILayer
- Overrides:
getPreferredHeight
in classAbstractLayerTransform
-
getRowHeightByPosition
public int getRowHeightByPosition(int rowPosition) Description copied from interface:ILayer
Returns the height in pixels of the given row. The height of invisible and non-existing rows is 0.- Specified by:
getRowHeightByPosition
in interfaceILayer
- Overrides:
getRowHeightByPosition
in classAbstractLayerTransform
- Parameters:
rowPosition
- The row position in this layer.- Returns:
- The height of the row.
-
setRowHeight
public void setRowHeight(int rowHeight) -
isRowPositionResizable
public boolean isRowPositionResizable(int rowPosition) Description copied from interface:ILayer
Check if the row at the given position is resizable.- Specified by:
isRowPositionResizable
in interfaceILayer
- Overrides:
isRowPositionResizable
in classAbstractLayerTransform
- Parameters:
rowPosition
- The row position to check.- Returns:
true
if the row is resizable,false
if not.
-
getRowPositionByY
public int getRowPositionByY(int y) Description copied from interface:ILayer
Returns the row position that contains the given y coordinate.- Specified by:
getRowPositionByY
in interfaceILayer
- Overrides:
getRowPositionByY
in 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:ILayer
Returns the y offset in pixels of the given row.- Specified by:
getStartYOfRowPosition
in interfaceILayer
- Overrides:
getStartYOfRowPosition
in classAbstractLayerTransform
- Parameters:
rowPosition
- the row position in this layer- Returns:
- the y offset of the row, or -1
-
getCellByPosition
If a cell belongs to a column group: column position - set to the start position of the group span - set to the width/size of the column group NOTE: gc.setClip() is used in the CompositeLayerPainter to ensure that partially visible Column group header cells are rendered properly.- 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.
-
getColumnSpan
public int getColumnSpan(int columnPosition) Calculates the span of a cell in a Column Group. Takes into account collapsing and hidden columns in the group.- Parameters:
columnPosition
- position of any column belonging to the group- Returns:
- the column span
- Since:
- 1.6
-
getStartPositionOfGroup
public int getStartPositionOfGroup(int columnPosition) Figures out the start position of the group.- Parameters:
columnPosition
- of any column belonging to the group- Returns:
- first position of the column group
- Since:
- 1.6
-
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.
-
addColumnsIndexesToGroup
-
clearAllGroups
public void clearAllGroups() -
setStaticColumnIndexesByGroup
-
isColumnInGroup
public boolean isColumnInGroup(int bodyColumnIndex) -
setGroupUnbreakable
public void setGroupUnbreakable(int columnIndex) -
setGroupAsCollapsed
public void setGroupAsCollapsed(int columnIndex) -
getProvidedLabels
- Specified by:
getProvidedLabels
in interfaceILayer
- Overrides:
getProvidedLabels
in classAbstractLayer
- Returns:
- The collection of labels that are provided by this layer.
- Since:
- 1.4
-