Class NatTableContentTooltip

java.lang.Object
org.eclipse.jface.window.ToolTip
org.eclipse.jface.window.DefaultToolTip
org.eclipse.nebula.widgets.nattable.tooltip.NatTableContentTooltip
Direct Known Subclasses:
FormulaTooltipErrorReporter

public class NatTableContentTooltip extends org.eclipse.jface.window.DefaultToolTip
ToolTip implementation for the NatTable which will show the display value of the cell of which the tooltip is requested.

It is possible to configure for which regions the tooltips should be activated. If none are configured, the tooltips are active for every region of the NatTable.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected NatTable
    The NatTable instance for which this ToolTip is used.
    protected String[]
    The regions of the NatTable for which this ToolTip is active.

    Fields inherited from class org.eclipse.jface.window.ToolTip

    NO_RECREATE, RECREATE
  • Constructor Summary

    Constructors
    Constructor
    Description
    NatTableContentTooltip(NatTable natTable, int style, boolean manualActivation, String... tooltipRegions)
    Creates a new ToolTip object, attached to the given NatTable instance.
    NatTableContentTooltip(NatTable natTable, String... tooltipRegions)
    Creates a new ToolTip object, attaches it to the given NatTable instance and configures and activates it.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected String
    getText(org.eclipse.swt.widgets.Event event)
    protected Object
    getToolTipArea(org.eclipse.swt.widgets.Event event)
    protected boolean
    Checks if the given ICellPainter is showing the content directly or if it is anonymized by using the PasswordTextPainter
    protected boolean
    shouldCreateToolTip(org.eclipse.swt.widgets.Event event)

    Methods inherited from class org.eclipse.jface.window.DefaultToolTip

    createToolTipContentArea, getBackgroundColor, getBackgroundImage, getFont, getForegroundColor, getImage, getStyle, setBackgroundColor, setBackgroundImage, setFont, setForegroundColor, setImage, setStyle, setText

    Methods inherited from class org.eclipse.jface.window.ToolTip

    activate, afterHideToolTip, deactivate, getData, getLocation, hide, isHideOnMouseDown, isRespectDisplayBounds, isRespectMonitorBounds, setData, setHideDelay, setHideOnMouseDown, setPopupDelay, setRespectDisplayBounds, setRespectMonitorBounds, setShift, show

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • natTable

      protected NatTable natTable
      The NatTable instance for which this ToolTip is used.
    • tooltipRegions

      protected String[] tooltipRegions
      The regions of the NatTable for which this ToolTip is active.
  • Constructor Details

    • NatTableContentTooltip

      public NatTableContentTooltip(NatTable natTable, String... tooltipRegions)
      Creates a new ToolTip object, attaches it to the given NatTable instance and configures and activates it. Uses ToolTip.NO_RECREATE as style option and manualActivation == false.
      Parameters:
      natTable - The NatTable instance for which this ToolTip is used.
      tooltipRegions - The regions of the NatTable for which this ToolTip is active. If none are given, the tooltip will be active for all regions.
    • NatTableContentTooltip

      public NatTableContentTooltip(NatTable natTable, int style, boolean manualActivation, String... tooltipRegions)
      Creates a new ToolTip object, attached to the given NatTable instance.
      Parameters:
      natTable - The NatTable instance for which this ToolTip is used.
      style - The style passed to control tooltip behaviour.
      manualActivation - true if the activation is done manually using ToolTip.show(Point).
      tooltipRegions - The regions of the NatTable for which this ToolTip is active. If none are given, the tooltip will be active for all regions.
      Since:
      1.6
      See Also:
      • ToolTip.RECREATE
      • ToolTip.NO_RECREATE
  • Method Details

    • getToolTipArea

      protected Object getToolTipArea(org.eclipse.swt.widgets.Event event)

      Implementation here means the tooltip is not redrawn unless mouse hover moves outside of the current cell (the combination of ToolTip.NO_RECREATE style and override of this method).

      Overrides:
      getToolTipArea in class org.eclipse.jface.window.ToolTip
    • getText

      protected String getText(org.eclipse.swt.widgets.Event event)

      Evaluates the cell for which the tooltip should be rendered and checks the display value. If the display value is empty null will be returned which will result in not showing a tooltip.

      Overrides:
      getText in class org.eclipse.jface.window.DefaultToolTip
    • isVisibleContentPainter

      protected boolean isVisibleContentPainter(ICellPainter painter)
      Checks if the given ICellPainter is showing the content directly or if it is anonymized by using the PasswordTextPainter
      Parameters:
      painter - The ICellPainter to check.
      Returns:
      true if the painter is not a PasswordTextPainter
    • shouldCreateToolTip

      protected boolean shouldCreateToolTip(org.eclipse.swt.widgets.Event event)

      Will only display a tooltip if the value of the cell for which the tooltip should be rendered is not empty.

      If there are regions configured for which the tooltip should be visible, it is also checked if the the region for which the tooltip should be rendered is in one of the configured tooltip regions.

      Overrides:
      shouldCreateToolTip in class org.eclipse.jface.window.ToolTip