Class ColumnHeaderLayer
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
-
- org.eclipse.nebula.widgets.nattable.grid.layer.DimensionallyDependentLayer
-
- org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer
-
- All Implemented Interfaces:
ILayer
,ILayerListener
,IPersistable
- Direct Known Subclasses:
ColumnHeaderLayerFixture
public class ColumnHeaderLayer extends DimensionallyDependentLayer
Responsible for rendering, event handling etc on the column headers.
-
-
Field Summary
Fields Modifier and Type Field Description protected RenameColumnHelper
renameColumnHelper
-
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
Constructors Constructor Description ColumnHeaderLayer(IUniqueIndexLayer baseLayer, ILayer horizontalLayerDependency, SelectionLayer selectionLayer)
Creates a column header layer using the default configuration and painterColumnHeaderLayer(IUniqueIndexLayer baseLayer, ILayer horizontalLayerDependency, SelectionLayer... selectionLayer)
Creates a column header layer using the default configuration and painterColumnHeaderLayer(IUniqueIndexLayer baseLayer, ILayer horizontalLayerDependency, SelectionLayer[] selectionLayer, boolean useDefaultConfiguration)
Creates a row header layer using the default painter.ColumnHeaderLayer(IUniqueIndexLayer baseLayer, ILayer horizontalLayerDependency, SelectionLayer[] selectionLayer, boolean useDefaultConfiguration, ILayerPainter layerPainter)
ColumnHeaderLayer(IUniqueIndexLayer baseLayer, ILayer horizontalLayerDependency, SelectionLayer selectionLayer, boolean useDefaultConfiguration)
Creates a row header layer using the default painter.ColumnHeaderLayer(IUniqueIndexLayer baseLayer, ILayer horizontalLayerDependency, SelectionLayer selectionLayer, boolean useDefaultConfiguration, ILayerPainter layerPainter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LabelStack
getConfigLabelsByPosition(int columnPosition, int rowPosition)
Returns the config labels for the cell at the given coordinates.Object
getDataValueByPosition(int columnPosition, int rowPosition)
Returns the data value for the cell at the given coordinates.DisplayMode
getDisplayModeByPosition(int columnPosition, int rowPosition)
Returns the activeDisplayMode
for the cell at the given coordinates.String
getOriginalColumnLabel(int columnPosition)
String
getRenamedColumnLabel(int columnPosition)
String
getRenamedColumnLabelByIndex(int columnIndex)
void
handleLayerEvent(ILayerEvent event)
Handle layer event notification.boolean
isColumnRenamed(int columnIndex)
protected void
registerCommandHandlers()
Layers should use this method to register their command handlers and call it from their constructor.boolean
renameColumnIndex(int columnIndex, String customColumnName)
boolean
renameColumnPosition(int columnPosition, String customColumnName)
-
Methods inherited from class org.eclipse.nebula.widgets.nattable.grid.layer.DimensionallyDependentLayer
configure, doCommand, getBaseLayer, getClientAreaProvider, getColumnCount, getColumnIndexByPosition, getColumnPositionByX, getColumnWidthByPosition, getHeight, getHorizontalLayerDependency, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRegionLabelsByXY, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByY, getStartXOfColumnPosition, getStartYOfRowPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getVerticalLayerDependency, getWidth, isColumnPositionResizable, isRowPositionResizable, loadState, localToUnderlyingColumnPosition, localToUnderlyingRowPosition, saveState, setClientAreaProvider, setHorizontalLayerDependency, setVerticalLayerDependency, underlyingToLocalColumnPosition, underlyingToLocalColumnPositions, underlyingToLocalRowPosition, underlyingToLocalRowPositions
-
Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
addConfiguration, addLayerListener, clearConfiguration, dispose, fireLayerEvent, getBoundsByPosition, getCellByPosition, getCellPainter, getConfigLabelAccumulator, getProvidedLabels, getRegionName, hasLayerListener, isDynamicSizeLayer, registerCommandHandler, registerEventHandler, registerPersistable, removeLayerListener, setConfigLabelAccumulator, setLayerPainter, setRegionName, toString, unregisterCommandHandler, unregisterEventHandler, unregisterPersistable
-
-
-
-
Field Detail
-
renameColumnHelper
protected RenameColumnHelper renameColumnHelper
-
-
Constructor Detail
-
ColumnHeaderLayer
public ColumnHeaderLayer(IUniqueIndexLayer baseLayer, ILayer horizontalLayerDependency, SelectionLayer selectionLayer)
Creates a column header layer using the default configuration and painter- Parameters:
baseLayer
- The base layer for this layer, typically a DataLayer.horizontalLayerDependency
- The layer to link the horizontal dimension to, typically the body layer.selectionLayer
- The SelectionLayer needed to respond to selection events.
-
ColumnHeaderLayer
public ColumnHeaderLayer(IUniqueIndexLayer baseLayer, ILayer horizontalLayerDependency, SelectionLayer... selectionLayer)
Creates a column header layer using the default configuration and painter- Parameters:
baseLayer
- The base layer for this layer, typically a DataLayer.horizontalLayerDependency
- The layer to link the horizontal dimension to, typically the body layer.selectionLayer
- 0 to multiple SelectionLayer needed to respond to selection events.- Since:
- 1.4
-
ColumnHeaderLayer
public ColumnHeaderLayer(IUniqueIndexLayer baseLayer, ILayer horizontalLayerDependency, SelectionLayer selectionLayer, boolean useDefaultConfiguration)
Creates a row header layer using the default painter.- Parameters:
baseLayer
- The base layer for this layer, typically a DataLayer.horizontalLayerDependency
- The layer to link the horizontal dimension to, typically the body layer.selectionLayer
- The SelectionLayer needed to respond to selection events.useDefaultConfiguration
- Flag to configure whether to use the default configuration or not.
-
ColumnHeaderLayer
public ColumnHeaderLayer(IUniqueIndexLayer baseLayer, ILayer horizontalLayerDependency, SelectionLayer[] selectionLayer, boolean useDefaultConfiguration)
Creates a row header layer using the default painter.- Parameters:
baseLayer
- The base layer for this layer, typically a DataLayer.horizontalLayerDependency
- The layer to link the horizontal dimension to, typically the body layer.selectionLayer
- 0 to multiple SelectionLayer needed to respond to selection events.useDefaultConfiguration
- Flag to configure whether to use the default configuration or not.- Since:
- 1.4
-
ColumnHeaderLayer
public ColumnHeaderLayer(IUniqueIndexLayer baseLayer, ILayer horizontalLayerDependency, SelectionLayer selectionLayer, boolean useDefaultConfiguration, ILayerPainter layerPainter)
- Parameters:
baseLayer
- The base layer for this layer, typically a DataLayer.horizontalLayerDependency
- The layer to link the horizontal dimension to, typically the body layer.selectionLayer
- The SelectionLayer needed to respond to selection events.useDefaultConfiguration
- Flag to configure whether to use the default configuration or not.layerPainter
- The painter for this layer ornull
to use the painter of the base layer.
-
ColumnHeaderLayer
public ColumnHeaderLayer(IUniqueIndexLayer baseLayer, ILayer horizontalLayerDependency, SelectionLayer[] selectionLayer, boolean useDefaultConfiguration, ILayerPainter layerPainter)
- Parameters:
baseLayer
- The base layer for this layer, typically a DataLayer.horizontalLayerDependency
- The layer to link the horizontal dimension to, typically the body layer.selectionLayer
- 0 to multiple SelectionLayer needed to respond to selection events.useDefaultConfiguration
- Flag to configure whether to use the default configuration or not.layerPainter
- The painter for this layer ornull
to use the painter of the base layer.- Since:
- 1.4
-
-
Method Detail
-
getDisplayModeByPosition
public DisplayMode getDisplayModeByPosition(int columnPosition, int rowPosition)
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 classDimensionallyDependentLayer
- 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
public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition)
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 classDimensionallyDependentLayer
- 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
public Object getDataValueByPosition(int columnPosition, int rowPosition)
Description copied from interface:ILayer
Returns the data value for the cell at the given coordinates.- Specified by:
getDataValueByPosition
in interfaceILayer
- Overrides:
getDataValueByPosition
in classDimensionallyDependentLayer
- 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.
-
registerCommandHandlers
protected void registerCommandHandlers()
Description copied from class:AbstractLayer
Layers should use this method to register their command handlers and call it from their constructor. This allows easy overriding if required of command handlers- Overrides:
registerCommandHandlers
in classAbstractLayer
-
handleLayerEvent
public void handleLayerEvent(ILayerEvent event)
Description copied from class:AbstractLayer
Handle layer event notification. Convert it to your context and propagate UP. If you override this method you MUST NOT FORGET to raise the event up the layer stack by callingsuper.fireLayerEvent(event)
- unless you plan to eat the event yourself.- Specified by:
handleLayerEvent
in interfaceILayerListener
- Overrides:
handleLayerEvent
in classAbstractLayer
- Parameters:
event
- the event
-
getOriginalColumnLabel
public String getOriginalColumnLabel(int columnPosition)
- Parameters:
columnPosition
- the column position for which the original label is requested- Returns:
- column header as defined by the data source
-
getRenamedColumnLabel
public String getRenamedColumnLabel(int columnPosition)
- Parameters:
columnPosition
- the column position for which the renamed label is requested- Returns:
- renamed column header if the column has been renamed, NULL otherwise
-
getRenamedColumnLabelByIndex
public String getRenamedColumnLabelByIndex(int columnIndex)
- Parameters:
columnIndex
- the column index for which the renamed label is requested- Returns:
- renamed column header if the column has been renamed, NULL otherwise
-
isColumnRenamed
public boolean isColumnRenamed(int columnIndex)
- Parameters:
columnIndex
- the column index that should be checked- Returns:
true
if the column at the given index has been given a custom name by the user.
-
renameColumnPosition
public boolean renameColumnPosition(int columnPosition, String customColumnName)
-
renameColumnIndex
public boolean renameColumnIndex(int columnIndex, String customColumnName)
-
-