org.eclipse.nebula.widgets.nattable.group
Class ColumnGroupGroupHeaderLayer

java.lang.Object
  extended by org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
      extended by org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
          extended by org.eclipse.nebula.widgets.nattable.group.ColumnGroupGroupHeaderLayer
All Implemented Interfaces:
ILayer, ILayerListener, IPersistable

public class ColumnGroupGroupHeaderLayer
extends AbstractLayerTransform

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
layerPainter
 
Fields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
DOT, VALUE_SEPARATOR
 
Constructor Summary
ColumnGroupGroupHeaderLayer(ColumnGroupHeaderLayer columnGroupHeaderLayer, SelectionLayer selectionLayer, ColumnGroupModel columnGroupModel)
           
ColumnGroupGroupHeaderLayer(ColumnGroupHeaderLayer columnGroupHeaderLayer, SelectionLayer selectionLayer, ColumnGroupModel columnGroupModel, boolean useDefaultConfiguration)
           
 
Method Summary
 void addColumnsIndexesToGroup(String colGroupName, int... colIndexes)
           
 void clearAllGroups()
           
 ILayerCell 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.
protected  int getColumnSpan(int columnPosition)
          Calculates the span of a cell in a Column Group.
 LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition)
           
 Object getDataValueByPosition(int columnPosition, int rowPosition)
           
 String getDisplayModeByPosition(int columnPosition, int rowPosition)
           
 int getHeight()
          Returns the total height in pixels of this layer.
 int getPreferredHeight()
           
 int getPreferredRowCount()
           
 LabelStack getRegionLabelsByXY(int x, int y)
          Layer can apply its own labels to any cell it wishes.
 int getRowCount()
           
 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.
 int getRowPositionByY(int y)
          Returns the row position that contains the given y coordinate.
 int getStartYOfRowPosition(int rowPosition)
          Returns the y offset in pixels of the given row.
 boolean isColumnInGroup(int bodyColumnIndex)
           
 boolean isRowPositionResizable(int rowPosition)
           
 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, loadState, localToUnderlyingColumnPosition, localToUnderlyingRowPosition, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColumnGroupGroupHeaderLayer

public ColumnGroupGroupHeaderLayer(ColumnGroupHeaderLayer columnGroupHeaderLayer,
                                   SelectionLayer selectionLayer,
                                   ColumnGroupModel columnGroupModel)

ColumnGroupGroupHeaderLayer

public ColumnGroupGroupHeaderLayer(ColumnGroupHeaderLayer columnGroupHeaderLayer,
                                   SelectionLayer selectionLayer,
                                   ColumnGroupModel columnGroupModel,
                                   boolean useDefaultConfiguration)
Method Detail

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface ILayer
Overrides:
getRowCount in class AbstractLayerTransform
Returns:
the number of rows in this coordinate model

getPreferredRowCount

public int getPreferredRowCount()
Specified by:
getPreferredRowCount in interface ILayer
Overrides:
getPreferredRowCount in class AbstractLayerTransform

getRowIndexByPosition

public int getRowIndexByPosition(int rowPosition)
Description copied from interface: ILayer
Gets the underlying non-transformed row index for the given row position.

Specified by:
getRowIndexByPosition in interface ILayer
Overrides:
getRowIndexByPosition in class AbstractLayerTransform
Parameters:
rowPosition - a row position relative to this coordinate model
Returns:
an underlying non-transformed row index, or -1 if the given row position does not exist within this coordinate system

getHeight

public int getHeight()
Description copied from interface: ILayer
Returns the total height in pixels of this layer.

Specified by:
getHeight in interface ILayer
Overrides:
getHeight in class AbstractLayerTransform
Returns:
the height of this layer

getPreferredHeight

public int getPreferredHeight()
Specified by:
getPreferredHeight in interface ILayer
Overrides:
getPreferredHeight in class AbstractLayerTransform

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 interface ILayer
Overrides:
getRowHeightByPosition in class AbstractLayerTransform
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)
Specified by:
isRowPositionResizable in interface ILayer
Overrides:
isRowPositionResizable in class AbstractLayerTransform

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 interface ILayer
Overrides:
getRowPositionByY in class AbstractLayerTransform
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 interface ILayer
Overrides:
getStartYOfRowPosition in class AbstractLayerTransform
Parameters:
rowPosition - the row position in this layer
Returns:
the y offset of the row, or -1

getCellByPosition

public ILayerCell 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.

Specified by:
getCellByPosition in interface ILayer
Overrides:
getCellByPosition in class AbstractLayerTransform

getColumnSpan

protected 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

getDisplayModeByPosition

public String getDisplayModeByPosition(int columnPosition,
                                       int rowPosition)
Specified by:
getDisplayModeByPosition in interface ILayer
Overrides:
getDisplayModeByPosition in class AbstractLayerTransform
Parameters:
columnPosition - the column position of the cell
rowPosition - the row position of the cell
Returns:
DisplayMode for the cell at the given position. The DisplayMode affects the settings out of the ConfigRegistry. Display mode is NORMAL by default.

Example: SelectionLayer overrides this to return the SELECT label for cells which are selected.


getConfigLabelsByPosition

public LabelStack getConfigLabelsByPosition(int columnPosition,
                                            int rowPosition)
Specified by:
getConfigLabelsByPosition in interface ILayer
Overrides:
getConfigLabelsByPosition in class AbstractLayerTransform

getDataValueByPosition

public Object getDataValueByPosition(int columnPosition,
                                     int rowPosition)
Specified by:
getDataValueByPosition in interface ILayer
Overrides:
getDataValueByPosition in class AbstractLayerTransform

getRegionLabelsByXY

public LabelStack getRegionLabelsByXY(int x,
                                      int y)
Description copied from interface: ILayer
Layer can apply its own labels to any cell it wishes.

Specified by:
getRegionLabelsByXY in interface ILayer
Overrides:
getRegionLabelsByXY in class AbstractLayerTransform
Parameters:
x - the x pixel coordinate
y - the y pixel coordinate
Returns:
a LabelStack containing the region labels for the cell at the given pixel position

addColumnsIndexesToGroup

public void addColumnsIndexesToGroup(String colGroupName,
                                     int... colIndexes)

clearAllGroups

public void clearAllGroups()

setStaticColumnIndexesByGroup

public void setStaticColumnIndexesByGroup(String colGroupName,
                                          int... staticColumnIndexes)

isColumnInGroup

public boolean isColumnInGroup(int bodyColumnIndex)

setGroupUnbreakable

public void setGroupUnbreakable(int columnIndex)
See Also:
ColumnGroupModel.ColumnGroup.setUnbreakable(boolean)

setGroupAsCollapsed

public void setGroupAsCollapsed(int columnIndex)


Copyright © 2014. All rights reserved.