Class HoverLayer
- All Implemented Interfaces:
ILayer
,ILayerListener
,IUniqueIndexLayer
,IPersistable
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
ConstructorDescriptionHoverLayer
(IUniqueIndexLayer underlyingLayer) Create a new HoverLayer that uses the default configuration.HoverLayer
(IUniqueIndexLayer underlyingLayer, boolean useDefaultConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
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
setCurrentHoveredCellByIndex
(int columnIndex, int rowIndex) Set the information about the cell identified by index 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
(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 Details
-
HoverLayer
Create a new HoverLayer that uses the default configuration.- Parameters:
underlyingLayer
- The layer on which the HoverLayer should be positioned.
-
HoverLayer
- 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 Details
-
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
- 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.
-
setCurrentHoveredCellByIndex
public void setCurrentHoveredCellByIndex(int columnIndex, int rowIndex) Set the information about the cell identified by index 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:
columnIndex
- The column index of the cell that is currently hovered.rowIndex
- The row index of the cell that is currently hovered.- Since:
- 2.1
-
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.
-