Class InvertedLayer
java.lang.Object
org.eclipse.nebula.widgets.nattable.layer.InvertedLayer
- All Implemented Interfaces:
ILayer
,ILayerListener
,IUniqueIndexLayer
,IPersistable
-
Field Summary
Fields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
DOT, VALUE_SEPARATOR
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addLayerListener
(ILayerListener listener) Add a generalILayerListener
to handleILayerEvent
s on this layer.void
configure
(IConfigRegistry configRegistry, UiBindingRegistry uiBindingRegistry) Configure this layer, e.g.void
dispose()
Dispose any resource allocated by this layer.boolean
doCommand
(ILayerCommand command) Opportunity to respond to a command as it flows down the stack.void
fireLayerEvent
(ILayerEvent event) Events can be fired to notify other components of the grid.org.eclipse.swt.graphics.Rectangle
getBoundsByPosition
(int columnPosition, int rowPosition) Calculates the bounds in pixel for the given cell position.getCellByPosition
(int columnPosition, int rowPosition) Returns the cell for the given coordinates on this layer.getCellPainter
(int columnPosition, int rowPosition, ILayerCell cell, IConfigRegistry configRegistry) Return theICellPainter
for the givenILayerCell
at the given coordinates out of the givenIConfigRegistry
.int
int
getColumnIndexByPosition
(int columnPosition) Gets the underlying non-transformed column index for the given column position on this layer.int
getColumnPositionByIndex
(int columnIndex) int
getColumnPositionByX
(int x) Returns the column position that contains the given x coordinate.int
getColumnWidthByPosition
(int columnPosition) Returns the width in pixels of the given column.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
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
getRowPositionByIndex
(int rowIndex) int
getRowPositionByY
(int y) Returns the row position that contains the given y coordinate.int
getStartXOfColumnPosition
(int columnPosition) Returns the x offset in pixels of the given column.int
getStartYOfRowPosition
(int rowPosition) Returns the y offset in pixels of the given row.getUnderlyingLayerByPosition
(int columnPosition, int rowPosition) Returns the layer that is directly below this layer for the given cell coordinate.getUnderlyingLayersByColumnPosition
(int columnPosition) Returns the layers that are directly below this layer for the given column position.getUnderlyingLayersByRowPosition
(int rowPosition) Returns the layers that are directly below this layer for the given row position.int
getWidth()
Returns the total width in pixels of this layer.void
handleLayerEvent
(ILayerEvent event) Handle an event notification from anILayer
boolean
hasLayerListener
(Class<? extends ILayerListener> layerListenerClass) Check if anILayerListener
of the given type is registered on this layer or not.boolean
isColumnPositionResizable
(int columnPosition) Check if the column at the given position is resizable.boolean
isRowPositionResizable
(int rowPosition) Check if the row at the given position is resizable.void
loadState
(String prefix, Properties properties) Restore the state out of the given Properties identified by the specified prefix.int
localToUnderlyingColumnPosition
(int localColumnPosition) Convert a column position to the coordinates of the underlying layer.int
localToUnderlyingRowPosition
(int localRowPosition) Convert a row position to the coordinates of the underlying layer.void
registerCommandHandler
(ILayerCommandHandler<?> commandHandler) Register anILayerCommandHandler
to handle a command in this layer.void
registerPersistable
(IPersistable persistable) Register anIPersistable
that can write its state to the stateProperties
instance when the layer is persisted.void
removeLayerListener
(ILayerListener listener) Remove the givenILayerListener
from this layer.void
saveState
(String prefix, Properties properties) Saves the state to the given Properties using the specified prefix.void
setClientAreaProvider
(IClientAreaProvider clientAreaProvider) int
underlyingToLocalColumnPosition
(ILayer sourceUnderlyingLayer, int underlyingColumnPosition) Transforms the column position relative to the given underlying layer to this layer coordinates.underlyingToLocalColumnPositions
(ILayer sourceUnderlyingLayer, Collection<Range> underlyingColumnPositionRanges) Transforms the column position ranges relative to the given underlying layer to this layer coordinates.int
underlyingToLocalRowPosition
(ILayer sourceUnderlyingLayer, int underlyingRowPosition) Transforms the row position relative to the given underlying layer to this layer coordinates.underlyingToLocalRowPositions
(ILayer sourceUnderlyingLayer, Collection<Range> underlyingRowPositionRanges) Transforms the row position ranges relative to the given underlying layer to this layer coordinates.void
unregisterCommandHandler
(Class<? extends ILayerCommand> commandClass) Unregister theILayerCommandHandler
that is registered for the givenILayerCommand
class.void
unregisterPersistable
(IPersistable persistable) Unregister the givenIPersistable
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.nebula.widgets.nattable.layer.ILayer
getProvidedLabels, isDynamicSizeLayer
-
Constructor Details
-
InvertedLayer
-
-
Method Details
-
handleLayerEvent
Description copied from interface:ILayerListener
Handle an event notification from anILayer
- Specified by:
handleLayerEvent
in interfaceILayerListener
- Parameters:
event
- the event
-
saveState
Description copied from interface:IPersistable
Saves the state to the given Properties using the specified prefix. Note: The prefix must be prepended to the property key to support multiple states within one Properties instance.- Specified by:
saveState
in interfaceIPersistable
- Parameters:
prefix
- The prefix to use for the state keys. Is also used as the state configuration name.properties
- The Properties instance to save the state to.
-
loadState
Description copied from interface:IPersistable
Restore the state out of the given Properties identified by the specified prefix. Note: The prefix must be prepended to the property key to support multiple states within one Properties instance.- Specified by:
loadState
in interfaceIPersistable
- Parameters:
prefix
- The prefix to use for the state keys. Is also used as the state configuration name.properties
- The Properties instance to load the state from.
-
dispose
public void dispose()Description copied from interface:ILayer
Dispose any resource allocated by this layer. -
registerPersistable
Description copied from interface:ILayer
Register anIPersistable
that can write its state to the stateProperties
instance when the layer is persisted.- Specified by:
registerPersistable
in interfaceILayer
- Parameters:
persistable
- The persistable that should be registered.
-
unregisterPersistable
Description copied from interface:ILayer
Unregister the givenIPersistable
.- Specified by:
unregisterPersistable
in interfaceILayer
- Parameters:
persistable
- The persistable to unregister.
-
configure
Description copied from interface:ILayer
Configure this layer, e.g. add any key/mouse bindings and other general configuration.This method is triggered by
NatTable.configure()
and executed down the layer stack.- Specified by:
configure
in interfaceILayer
- Parameters:
configRegistry
- TheIConfigRegistry
instance owned by theNatTable
this layer is attached to.uiBindingRegistry
- TheUiBindingRegistry
instance owned byNatTable
this layer is attached to.
-
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
- Parameters:
x
- the x pixel coordinatey
- the y pixel coordinate- Returns:
- LabelStack containing the region labels for the cell at the given pixel position.
-
doCommand
Description copied from interface:ILayer
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)
-
registerCommandHandler
Description copied from interface:ILayer
Register anILayerCommandHandler
to handle a command in this layer. Only oneILayerCommandHandler
perILayerCommand
can be registered per layer.- Specified by:
registerCommandHandler
in interfaceILayer
- Parameters:
commandHandler
- The command handler to register with this layer.
-
unregisterCommandHandler
Description copied from interface:ILayer
Unregister theILayerCommandHandler
that is registered for the givenILayerCommand
class.- Specified by:
unregisterCommandHandler
in interfaceILayer
- Parameters:
commandClass
- TheILayerCommand
class for which theILayerCommandHandler
should be unregistered.
-
fireLayerEvent
Description copied from interface:ILayer
Events can be fired to notify other components of the grid. Events travel up the layer stack and may cause a repaint.Example: When the contents of the grid change
IVisualChangeEvent
can be fired to notify other layers to refresh their caches etc.- Specified by:
fireLayerEvent
in interfaceILayer
- Parameters:
event
- the event to fire
-
addLayerListener
Description copied from interface:ILayer
Add a generalILayerListener
to handleILayerEvent
s on this layer.- Specified by:
addLayerListener
in interfaceILayer
- Parameters:
listener
- TheILayerListener
to add.
-
removeLayerListener
Description copied from interface:ILayer
Remove the givenILayerListener
from this layer.- Specified by:
removeLayerListener
in interfaceILayer
- Parameters:
listener
- TheILayerListener
to remove.
-
hasLayerListener
Description copied from interface:ILayer
Check if anILayerListener
of the given type is registered on this layer or not.- Specified by:
hasLayerListener
in interfaceILayer
- Parameters:
layerListenerClass
- The type ofILayerListener
to check for.- Returns:
true
if thisILayer
has aILayerListener
of the specified type registered,false
if there is no such listener registered.
-
getLayerPainter
- Specified by:
getLayerPainter
in interfaceILayer
- Returns:
- The
ILayerPainter
used to render this layer.
-
getClientAreaProvider
- Specified by:
getClientAreaProvider
in interfaceILayer
- Returns:
- The
IClientAreaProvider
that specifies the rectangular area available on this layer.
-
setClientAreaProvider
- Specified by:
setClientAreaProvider
in interfaceILayer
- Parameters:
clientAreaProvider
- TheIClientAreaProvider
that specifies the rectangular area available on this layer.
-
getColumnCount
public int getColumnCount()- Specified by:
getColumnCount
in interfaceILayer
- Returns:
- The number of columns in this layer.
-
getPreferredColumnCount
public int getPreferredColumnCount()- Specified by:
getPreferredColumnCount
in interfaceILayer
-
getColumnIndexByPosition
public int getColumnIndexByPosition(int columnPosition) Description copied from interface:ILayer
Gets the underlying non-transformed column index for the given column position on this layer.- Specified by:
getColumnIndexByPosition
in interfaceILayer
- Parameters:
columnPosition
- The column position relative to this layer.- Returns:
- An underlying non-transformed column index, or -1 if the given column position does not exist within this coordinate system.
-
localToUnderlyingColumnPosition
public int localToUnderlyingColumnPosition(int localColumnPosition) Description copied from interface:ILayer
Convert a column position to the coordinates of the underlying layer. This is possible since each layer is aware of its underlying layer.- Specified by:
localToUnderlyingColumnPosition
in interfaceILayer
- Parameters:
localColumnPosition
- column position in local (the layer's own) coordinates- Returns:
- column position in the underlying layer's coordinates
-
underlyingToLocalColumnPosition
public int underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer, int underlyingColumnPosition) Description copied from interface:ILayer
Transforms the column position relative to the given underlying layer to this layer coordinates.- Specified by:
underlyingToLocalColumnPosition
in interfaceILayer
- Parameters:
sourceUnderlyingLayer
- The underlying layer to which the given column position matches.underlyingColumnPosition
- The column position in the given underlying layer that should be converted to a local column position.- Returns:
- The given column position transformed to be local to this layer.
-
underlyingToLocalColumnPositions
public Collection<Range> underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer, Collection<Range> underlyingColumnPositionRanges) Description copied from interface:ILayer
Transforms the column position ranges relative to the given underlying layer to this layer coordinates.- Specified by:
underlyingToLocalColumnPositions
in interfaceILayer
- Parameters:
sourceUnderlyingLayer
- The underlying layer to which the given column positions match.underlyingColumnPositionRanges
- The column position ranges relative to the given underlying layer that should be converted to local column positions.- Returns:
- The given column position ranges transformed to this layer.
-
getWidth
public int getWidth()Description copied from interface:ILayer
Returns the total width in pixels of this layer. -
getPreferredWidth
public int getPreferredWidth()- Specified by:
getPreferredWidth
in interfaceILayer
-
getColumnWidthByPosition
public int getColumnWidthByPosition(int columnPosition) Description copied from interface:ILayer
Returns the width in pixels of the given column. The width of invisible and non-existing columns is 0.- Specified by:
getColumnWidthByPosition
in interfaceILayer
- Parameters:
columnPosition
- The column position in this layer.- Returns:
- The width of the column.
-
isColumnPositionResizable
public boolean isColumnPositionResizable(int columnPosition) Description copied from interface:ILayer
Check if the column at the given position is resizable.- Specified by:
isColumnPositionResizable
in interfaceILayer
- Parameters:
columnPosition
- The column position to check.- Returns:
true
if the column is resizable,false
if not.
-
getColumnPositionByX
public int getColumnPositionByX(int x) Description copied from interface:ILayer
Returns the column position that contains the given x coordinate.- Specified by:
getColumnPositionByX
in interfaceILayer
- Parameters:
x
- A horizontal pixel location relative to the pixel boundary of this layer.- Returns:
- A column position relative to the associated coordinate system, or -1 if there is no column that contains x.
-
getStartXOfColumnPosition
public int getStartXOfColumnPosition(int columnPosition) Description copied from interface:ILayer
Returns the x offset in pixels of the given column.- Specified by:
getStartXOfColumnPosition
in interfaceILayer
- Parameters:
columnPosition
- The column position in this layer.- Returns:
- The x offset of the column, or -1.
-
getUnderlyingLayersByColumnPosition
Description copied from interface:ILayer
Returns the layers that are directly below this layer for the given column position. For simple layers this collection will typically only have one entry. Layer compositions might return multiple values, e.g. in a default grid there will be 2 layers in the collection as there are two layers involved in a column.- Specified by:
getUnderlyingLayersByColumnPosition
in interfaceILayer
- Parameters:
columnPosition
- The column position for which the underlying layers are requested.- Returns:
- The layers that are directly below this layer for the given
column position or
null
if this layer has no underlying layers.
-
getColumnPositionByIndex
public int getColumnPositionByIndex(int columnIndex) - Specified by:
getColumnPositionByIndex
in interfaceIUniqueIndexLayer
-
getRowCount
public int getRowCount()- Specified by:
getRowCount
in interfaceILayer
- Returns:
- The number of rows in this layer.
-
getPreferredRowCount
public int getPreferredRowCount()- Specified by:
getPreferredRowCount
in interfaceILayer
-
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
- 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
- Parameters:
localRowPosition
- row position in local (the layer's own) coordinates- Returns:
- row position in the underlying layer's coordinates
-
underlyingToLocalRowPosition
Description copied from interface:ILayer
Transforms the row position relative to the given underlying layer to this layer coordinates.- Specified by:
underlyingToLocalRowPosition
in interfaceILayer
- Parameters:
sourceUnderlyingLayer
- The underlying layer to which the given row position matches.underlyingRowPosition
- The row position in the given underlying layer that should be converted to a local row position.- Returns:
- The given row position transformed to be local to this layer.
-
underlyingToLocalRowPositions
public Collection<Range> underlyingToLocalRowPositions(ILayer sourceUnderlyingLayer, Collection<Range> underlyingRowPositionRanges) Description copied from interface:ILayer
Transforms the row position ranges relative to the given underlying layer to this layer coordinates.- Specified by:
underlyingToLocalRowPositions
in interfaceILayer
- Parameters:
sourceUnderlyingLayer
- The underlying layer to which the given row positions match.underlyingRowPositionRanges
- The row position ranges relative to the given underlying layer that should be converted to local row positions.- Returns:
- The given row position ranges transformed to this layer.
-
getHeight
public int getHeight()Description copied from interface:ILayer
Returns the total height in pixels of this layer. -
getPreferredHeight
public int getPreferredHeight()- Specified by:
getPreferredHeight
in interfaceILayer
-
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
- Parameters:
rowPosition
- The row position in this layer.- Returns:
- The height of the row.
-
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
- 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
- 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
- Parameters:
rowPosition
- the row position in this layer- Returns:
- the y offset of the row, or -1
-
getUnderlyingLayersByRowPosition
Description copied from interface:ILayer
Returns the layers that are directly below this layer for the given row position. For simple layers this collection will typically only have one entry. Layer compositions might return multiple values, e.g. in a default grid there will be 2 layers in the collection as there are two layers involved in a row.- Specified by:
getUnderlyingLayersByRowPosition
in interfaceILayer
- Parameters:
rowPosition
- The row position for which the underlying layers are requested.- Returns:
- The layers that are directly below this layer for the given row
position or
null
if this layer has no underlying layers.
-
getRowPositionByIndex
public int getRowPositionByIndex(int rowIndex) - Specified by:
getRowPositionByIndex
in interfaceIUniqueIndexLayer
-
getCellByPosition
Description copied from interface:ILayer
Returns the cell for the given coordinates on this layer.- Specified by:
getCellByPosition
in interfaceILayer
- 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.
-
getBoundsByPosition
public org.eclipse.swt.graphics.Rectangle getBoundsByPosition(int columnPosition, int rowPosition) Description copied from interface:ILayer
Calculates the bounds in pixel for the given cell position.- Specified by:
getBoundsByPosition
in interfaceILayer
- Parameters:
columnPosition
- the column position of the cellrowPosition
- the row position of the cell- Returns:
- the bounds, or
null
if there are no valid bounds
-
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
- 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
- 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
- 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.
-
getUnderlyingLayerByPosition
Description copied from interface:ILayer
Returns the layer that is directly below this layer for the given cell coordinate.- Specified by:
getUnderlyingLayerByPosition
in interfaceILayer
- Parameters:
columnPosition
- The column position for which the underlying layer is requested.rowPosition
- The row position for which the underlying layer is requested.- Returns:
- The layer that is directly below this layer for the given cell
coordinates or
null
if this layer has no underlying layers.
-
getCellPainter
public ICellPainter getCellPainter(int columnPosition, int rowPosition, ILayerCell cell, IConfigRegistry configRegistry) Description copied from interface:ILayer
Return theICellPainter
for the givenILayerCell
at the given coordinates out of the givenIConfigRegistry
.- Specified by:
getCellPainter
in interfaceILayer
- Parameters:
columnPosition
- The column position of the cell.rowPosition
- The row position of the cell.cell
- TheILayerCell
for which theICellPainter
is requested.configRegistry
- TheIConfigRegistry
to retrieve the painter from.- Returns:
- The
ICellPainter
for the given cell at the given coordinates ornull
if no painter is configured.
-