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
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
ConstructorsConstructorDescriptionColumnGroupGroupHeaderLayer(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 TypeMethodDescriptionvoidaddColumnsIndexesToGroup(String colGroupName, int... colIndexes) voidgetCellByPosition(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.intgetColumnSpan(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 activeDisplayModefor the cell at the given coordinates.intReturns the total height in pixels of this layer.intintgetRegionLabelsByXY(int x, int y) Return theLabelStackcontaining the region labels for the cell at the given pixel position.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.intgetStartPositionOfGroup(int columnPosition) Figures out the start position of the group.intgetStartYOfRowPosition(int rowPosition) Returns the y offset in pixels of the given row.booleanisColumnInGroup(int bodyColumnIndex) booleanisRowPositionResizable(int rowPosition) Check if the row at the given position is resizable.intlocalToUnderlyingRowPosition(int localRowPosition) Convert a row position to the coordinates of the underlying layer.voidsetGroupAsCollapsed(int columnIndex) voidsetGroupUnbreakable(int columnIndex) voidsetRowHeight(int rowHeight) voidsetStaticColumnIndexesByGroup(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, underlyingToLocalRowPositionsMethods 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- TheColumnGroupHeaderLayerto stack on.selectionLayer- unusedcolumnGroupModel- TheColumnGroupModelused 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- TheColumnGroupHeaderLayerto stack on.selectionLayer- unusedcolumnGroupModel- TheColumnGroupModelused to build the column groups.useDefaultConfiguration-trueif the default configuration should be applied,falseif not.
-
ColumnGroupGroupHeaderLayer
public ColumnGroupGroupHeaderLayer(ColumnGroupHeaderLayer columnGroupHeaderLayer, ColumnGroupModel columnGroupModel) - Parameters:
columnGroupHeaderLayer- TheColumnGroupHeaderLayerto stack on.columnGroupModel- TheColumnGroupModelused to build the column groups.- Since:
- 2.0
-
ColumnGroupGroupHeaderLayer
public ColumnGroupGroupHeaderLayer(ColumnGroupHeaderLayer columnGroupHeaderLayer, ColumnGroupModel columnGroupModel, boolean useDefaultConfiguration) - Parameters:
columnGroupHeaderLayer- TheColumnGroupHeaderLayerto stack on.columnGroupModel- TheColumnGroupModelused to build the column groups.useDefaultConfiguration-trueif the default configuration should be applied,falseif not.- Since:
- 2.0
-
-
Method Details
-
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
-
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) -
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.
-
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
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:
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.
-
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: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.
-
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:
getProvidedLabelsin interfaceILayer- Overrides:
getProvidedLabelsin classAbstractLayer- Returns:
- The collection of labels that are provided by this layer.
- Since:
- 1.4
-