Class GridLayer
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
-
- org.eclipse.nebula.widgets.nattable.layer.CompositeLayer
-
- org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer
-
- All Implemented Interfaces:
ILayer
,ILayerListener
,IPersistable
- Direct Known Subclasses:
ColumnStructureUpdatesExampleGridLayer
,DefaultGridLayer
,FilterRowExampleGridLayer
,GlazedListsGridLayer
,GlazedListsGridLayer
,SelectionExampleGridLayer
,StaticFilterExampleGridLayer
public class GridLayer extends CompositeLayer
Top level layer. It is composed of the smaller child layers: RowHeader, ColumnHeader, Corner and Body It does not have its own coordinate system unlike the other layers. It simply delegates most functions to its child layers.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.nebula.widgets.nattable.layer.CompositeLayer
CompositeLayer.CompositeLayerPainter
-
-
Field Summary
-
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 Modifier Constructor Description protected
GridLayer(boolean useDefaultConfiguration)
GridLayer(ILayer bodyLayer, ILayer columnHeaderLayer, ILayer rowHeaderLayer, ILayer cornerLayer)
GridLayer(ILayer bodyLayer, ILayer columnHeaderLayer, ILayer rowHeaderLayer, ILayer cornerLayer, boolean useDefaultConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
doCommand(ILayerCommand command)
Opportunity to respond to a command as it flows down the stack.protected boolean
doCommandOnChildLayers(ILayerCommand command)
How the GridLayer processes commands is very important.ILayer
getBodyLayer()
ILayer
getColumnHeaderLayer()
ILayer
getCornerLayer()
ILayer
getRowHeaderLayer()
protected void
init(boolean useDefaultConfiguration)
protected void
registerCommandHandlers()
Layers should use this method to register their command handlers and call it from their constructor.void
setBodyLayer(ILayer bodyLayer)
void
setColumnHeaderLayer(ILayer columnHeaderLayer)
void
setCornerLayer(ILayer cornerLayer)
void
setRowHeaderLayer(ILayer rowHeaderLayer)
String
toString()
-
Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.CompositeLayer
addConfigLabelAccumulatorForRegion, configure, dispose, getBoundsByPosition, getCellByPosition, getCellPainter, getChildLayerByLayoutCoordinate, getChildLayerByRegionName, getChildLayerLayout, getColumnCount, getColumnIndexByPosition, getColumnPositionByX, getColumnPositionOffset, getColumnWidthByPosition, getConfigLabelAccumulatorByRegionName, getConfigLabelsByPosition, getDataValueByPosition, getDisplayModeByPosition, getHeight, getHeightOffset, getLayoutXByColumnPosition, getLayoutXByPixelX, getLayoutXCount, getLayoutXYByChildLayer, getLayoutXYByPixelXY, getLayoutXYByPosition, getLayoutYByPixelY, getLayoutYByRowPosition, getLayoutYCount, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getProvidedLabels, getRegionLabelsByXY, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByY, getRowPositionOffset, getStartXOfColumnPosition, getStartYOfRowPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, getWidthOffset, isColumnPositionResizable, isDynamicSizeLayer, isRowPositionResizable, loadState, localToUnderlyingColumnPosition, localToUnderlyingRowPosition, saveState, setChildLayer, setConfigLabelAccumulatorForRegion, underlyingToLocalColumnPosition, underlyingToLocalColumnPositions, underlyingToLocalRowPosition, underlyingToLocalRowPositions
-
Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
addConfiguration, addLayerListener, clearConfiguration, fireLayerEvent, getClientAreaProvider, getConfigLabelAccumulator, getLayerPainter, getRegionName, handleLayerEvent, hasLayerListener, registerCommandHandler, registerEventHandler, registerPersistable, removeLayerListener, setClientAreaProvider, setConfigLabelAccumulator, setLayerPainter, setRegionName, unregisterCommandHandler, unregisterEventHandler, unregisterPersistable
-
-
-
-
Constructor Detail
-
GridLayer
public GridLayer(ILayer bodyLayer, ILayer columnHeaderLayer, ILayer rowHeaderLayer, ILayer cornerLayer)
-
GridLayer
public GridLayer(ILayer bodyLayer, ILayer columnHeaderLayer, ILayer rowHeaderLayer, ILayer cornerLayer, boolean useDefaultConfiguration)
-
GridLayer
protected GridLayer(boolean useDefaultConfiguration)
-
-
Method Detail
-
init
protected void init(boolean useDefaultConfiguration)
-
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
-
doCommandOnChildLayers
protected boolean doCommandOnChildLayers(ILayerCommand command)
How the GridLayer processes commands is very important. Do not change this unless you know what you are doing and understand the full ramifications of your change. Otherwise your grid will not behave correctly! The Body is always given the first chance to process a command. There are two reasons for this: (1) most commands (80%) are destined for the body anyways so it's faster to check there first (2) the other layers all transitively depend on the body so it's not wise to ask them to do stuff until after the body has done it. This is especially true of grid initialization where the body must be initialized before any of its dependent layers. Because of this, if you want to intercept well-known commands to implement custom behavior (for example, you want to intercept theSelectCellCommand
) then you must inject your special layer into the body. An injected column or row header will never see the command because it will be consumed first by the body. In practice, it's a good idea to implement all your command-handling logic in the body.- Overrides:
doCommandOnChildLayers
in classCompositeLayer
-
getCornerLayer
public ILayer getCornerLayer()
-
setCornerLayer
public void setCornerLayer(ILayer cornerLayer)
-
getColumnHeaderLayer
public ILayer getColumnHeaderLayer()
-
setColumnHeaderLayer
public void setColumnHeaderLayer(ILayer columnHeaderLayer)
-
getRowHeaderLayer
public ILayer getRowHeaderLayer()
-
setRowHeaderLayer
public void setRowHeaderLayer(ILayer rowHeaderLayer)
-
getBodyLayer
public ILayer getBodyLayer()
-
setBodyLayer
public void setBodyLayer(ILayer bodyLayer)
-
toString
public String toString()
- Overrides:
toString
in classAbstractLayer
-
doCommand
public boolean doCommand(ILayerCommand command)
Description copied from class:CompositeLayer
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)
Handle commands- Specified by:
doCommand
in interfaceILayer
- Overrides:
doCommand
in classCompositeLayer
- Parameters:
command
- The command to execute.- Returns:
true
if the command has been handled and was therefore consumed,false
otherwise.
-
-