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, layerPainterFields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
DOT, VALUE_SEPARATOR -
Constructor Summary
ConstructorsConstructorDescriptionHoverLayer(IUniqueIndexLayer underlyingLayer) Create a new HoverLayer that uses the default configuration.HoverLayer(IUniqueIndexLayer underlyingLayer, boolean useDefaultConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves 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.PointgetDisplayModeByPosition(int columnPosition, int rowPosition) Returns the activeDisplayModefor the cell at the given coordinates.booleanisCellPositionHovered(int columnPosition, int rowPosition) Check if this HoverLayer knows the current hovered cell and if that cell is located at the given position coordinates.booleanisCellPositionHovered(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.voidsetCurrentHoveredCellByIndex(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.voidsetCurrentHoveredCellPosition(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.voidsetCurrentHoveredCellPosition(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, underlyingToLocalRowPositionsMethods 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, unregisterPersistableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.nebula.widgets.nattable.layer.ILayer
addLayerListener, fireLayerEvent, getBoundsByPosition, getClientAreaProvider, getProvidedLabels, hasLayerListener, registerCommandHandler, registerPersistable, removeLayerListener, unregisterCommandHandler, unregisterPersistableMethods 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-trueif the default configuration should be used,falseif a different configuration will be set after creation time.
-
-
Method Details
-
getDisplayModeByPosition
Description copied from interface:ILayerReturns the activeDisplayModefor 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.SELECTfor cells that are currently selected.- Specified by:
getDisplayModeByPositionin interfaceILayer- Overrides:
getDisplayModeByPositionin classAbstractIndexLayerTransform- Parameters:
columnPosition- The column position of the cell.rowPosition- The row position of the cell.- Returns:
DisplayModefor 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:
trueif the mouse cursor is currently located over the cell at the given position,falseif 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:
trueif the mouse cursor is currently located over the cell at the given position,falseif 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.
-