Class HoverLayer
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
-
- org.eclipse.nebula.widgets.nattable.layer.AbstractIndexLayerTransform
-
- org.eclipse.nebula.widgets.nattable.hover.HoverLayer
-
- All Implemented Interfaces:
ILayer
,ILayerListener
,IUniqueIndexLayer
,IPersistable
public class HoverLayer extends AbstractIndexLayerTransform
This layer simply adds the possibility to render cells differently if the mouse cursor is moved over them. This is also called "hover styling".It knows over which cell the mouse cursor is currently set as it is informed about that via IMouseActions that react on mouse move events.
The place where this layer is added to the layer stack has impact on the result. If you for example add the SelectionLayer on top of the HoverLayer, selected cells will not change their style while moving the mouse cursor over them. Adding the HoverLayer on top of the SelectionLayer will also change the style of the selected cells.
Note: If the HoverLayer should be added to the row or column header region, the corresponding configurations need to be set instead of the default configuration. This is because the row and column headers by default have mouse move listeners registered that collide with the mouse move listener for managing hover behaviour.
-
-
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 Constructor Description HoverLayer(IUniqueIndexLayer underlyingLayer)
Create a new HoverLayer that uses the default configuration.HoverLayer(IUniqueIndexLayer underlyingLayer, boolean useDefaultConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearCurrentHoveredCellPosition()
Removes the local stored information about the cell position that is currently hovered and fires an event to update the cell so the hover styling is removed.org.eclipse.swt.graphics.Point
getCurrentHoveredCellPosition()
DisplayMode
getDisplayModeByPosition(int columnPosition, int rowPosition)
Returns the activeDisplayMode
for the cell at the given coordinates.boolean
isCellPositionHovered(int columnPosition, int rowPosition)
Check if this HoverLayer knows the current hovered cell and if that cell is located at the given position coordinates.boolean
isCellPositionHovered(org.eclipse.swt.graphics.Point cellPosition)
Check if this HoverLayer knows the current hovered cell and if that cell is located at the given position coordinates.void
setCurrentHoveredCellPosition(int columnPosition, int rowPosition)
Set the information about the cell position that is currently hovered and fire an event to update a possible previous hovered cell to remove the hover styling and an event to update the newly hovered cell to apply the hover styling.void
setCurrentHoveredCellPosition(org.eclipse.swt.graphics.Point cellPosition)
Set the information about the cell position that is currently hovered and fire an event to update a possible previous hovered cell to remove the hover styling and an event to update the newly hovered cell to apply the hover styling.-
Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractIndexLayerTransform
configure, dispose, doCommand, getCellByPosition, getCellPainter, getColumnCount, getColumnIndexByPosition, getColumnPositionByIndex, getColumnPositionByX, getColumnWidthByPosition, getConfigLabelsByPosition, getDataValueByPosition, getHeight, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRegionLabelsByXY, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByIndex, getRowPositionByY, getStartXOfColumnPosition, getStartYOfRowPosition, getUnderlyingLayer, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, isColumnPositionResizable, isDynamicSizeLayer, isRowPositionResizable, 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, getProvidedLabels, 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
-
Methods inherited from interface org.eclipse.nebula.widgets.nattable.layer.ILayer
addLayerListener, fireLayerEvent, getBoundsByPosition, getClientAreaProvider, getProvidedLabels, hasLayerListener, registerCommandHandler, registerPersistable, removeLayerListener, unregisterCommandHandler, unregisterPersistable
-
Methods inherited from interface org.eclipse.nebula.widgets.nattable.layer.ILayerListener
handleLayerEvent
-
-
-
-
Constructor Detail
-
HoverLayer
public HoverLayer(IUniqueIndexLayer underlyingLayer)
Create a new HoverLayer that uses the default configuration.- Parameters:
underlyingLayer
- The layer on which the HoverLayer should be positioned.
-
HoverLayer
public HoverLayer(IUniqueIndexLayer underlyingLayer, boolean useDefaultConfiguration)
- Parameters:
underlyingLayer
- The layer on which the HoverLayer should be positioned.useDefaultConfiguration
-true
if the default configuration should be used,false
if a different configuration will be set after creation time.
-
-
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 classAbstractIndexLayerTransform
- Parameters:
columnPosition
- The column position of the cell.rowPosition
- The row position of the cell.- Returns:
DisplayMode
for the cell at the given coordinates.
-
isCellPositionHovered
public boolean isCellPositionHovered(org.eclipse.swt.graphics.Point cellPosition)
Check if this HoverLayer knows the current hovered cell and if that cell is located at the given position coordinates.- Parameters:
cellPosition
- The position of the cell that should be checked.- Returns:
true
if the mouse cursor is currently located over the cell at the given position,false
if not.
-
isCellPositionHovered
public boolean isCellPositionHovered(int columnPosition, int rowPosition)
Check if this HoverLayer knows the current hovered cell and if that cell is located at the given position coordinates.- Parameters:
columnPosition
- The column position of the cell that should be checked.rowPosition
- The row position of the cell that should be checked.- Returns:
true
if the mouse cursor is currently located over the cell at the given position,false
if not.
-
getCurrentHoveredCellPosition
public org.eclipse.swt.graphics.Point getCurrentHoveredCellPosition()
- Returns:
- The position of the cell that is currently hovered.
-
setCurrentHoveredCellPosition
public void setCurrentHoveredCellPosition(int columnPosition, int rowPosition)
Set the information about the cell position that is currently hovered and fire an event to update a possible previous hovered cell to remove the hover styling and an event to update the newly hovered cell to apply the hover styling.- Parameters:
columnPosition
- The column position of the cell that is currently hovered.rowPosition
- The row position of the cell that is currently hovered.
-
setCurrentHoveredCellPosition
public void setCurrentHoveredCellPosition(org.eclipse.swt.graphics.Point cellPosition)
Set the information about the cell position that is currently hovered and fire an event to update a possible previous hovered cell to remove the hover styling and an event to update the newly hovered cell to apply the hover styling.- Parameters:
cellPosition
- The position of the cell that is currently hovered.
-
clearCurrentHoveredCellPosition
public void clearCurrentHoveredCellPosition()
Removes the local stored information about the cell position that is currently hovered and fires an event to update the cell so the hover styling is removed.
-
-