Class Tooltip

java.lang.Object
com.vaadin.flow.component.shared.Tooltip
All Implemented Interfaces:
Serializable

@NpmPackage(value="@vaadin/tooltip", version="24.3.11") @JsModule("@vaadin/tooltip/src/vaadin-tooltip.js") public class Tooltip extends Object implements Serializable
A handle that can be used to configure and control tooltips.
Author:
Vaadin Ltd
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Tooltip position in relation to the target element.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Tooltip
    Creates a tooltip to the given Component if one hasn't already been created.
    int
    The delay in milliseconds before the tooltip is opened on keyboard focus, when not in manual mode.
    int
    The delay in milliseconds before the tooltip is closed on losing hover, when not in manual mode.
    int
    The delay in milliseconds before the tooltip is opened on hover, when not in manual mode.
    Position of the tooltip with respect to its target.
    String used as a tooltip content.
    boolean
    When true, the tooltip is controlled programmatically instead of reacting to focus and mouse events.
    boolean
    When true, the tooltip is opened programmatically.
    void
    setFocusDelay(int focusDelay)
    The delay in milliseconds before the tooltip is opened on keyboard focus, when not in manual mode.
    void
    setHideDelay(int hideDelay)
    The delay in milliseconds before the tooltip is closed on losing hover, when not in manual mode.
    void
    setHoverDelay(int hoverDelay)
    The delay in milliseconds before the tooltip is opened on hover, when not in manual mode.
    void
    setManual(boolean manual)
    When true, the tooltip is controlled programmatically instead of reacting to focus and mouse events.
    void
    setOpened(boolean opened)
    When true, the tooltip is opened programmatically.
    void
    Position of the tooltip with respect to its target.
    void
    String used as a tooltip content.
    withFocusDelay(int focusDelay)
    The delay in milliseconds before the tooltip is opened on keyboard focus, when not in manual mode.
    withHideDelay(int hideDelay)
    The delay in milliseconds before the tooltip is closed on losing hover, when not in manual mode.
    withHoverDelay(int hoverDelay)
    The delay in milliseconds before the tooltip is opened on hover, when not in manual mode.
    withManual(boolean manual)
    When true, the tooltip is controlled programmatically instead of reacting to focus and mouse events.
    Position of the tooltip with respect to its target.
    String used as a tooltip content.

    Methods inherited from class java.lang.Object

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

    • forComponent

      public static Tooltip forComponent(Component component)
      Creates a tooltip to the given Component if one hasn't already been created.
      Parameters:
      component - the component to attach the tooltip to
      Returns:
      the tooltip handle
    • setText

      public void setText(String text)
      String used as a tooltip content.
      Parameters:
      text - the text to set
    • getText

      public String getText()
      String used as a tooltip content.
      Returns:
      the text
    • withText

      public Tooltip withText(String text)
      String used as a tooltip content.
      Parameters:
      text - the text to set
    • setFocusDelay

      public void setFocusDelay(int focusDelay)
      The delay in milliseconds before the tooltip is opened on keyboard focus, when not in manual mode.
      Parameters:
      focusDelay - the delay in milliseconds
    • getFocusDelay

      public int getFocusDelay()
      The delay in milliseconds before the tooltip is opened on keyboard focus, when not in manual mode.
      Returns:
      the delay in milliseconds
    • withFocusDelay

      public Tooltip withFocusDelay(int focusDelay)
      The delay in milliseconds before the tooltip is opened on keyboard focus, when not in manual mode.
      Parameters:
      focusDelay - the delay in milliseconds
    • setHideDelay

      public void setHideDelay(int hideDelay)
      The delay in milliseconds before the tooltip is closed on losing hover, when not in manual mode. On blur, the tooltip is closed immediately.
      Parameters:
      hideDelay - the delay in milliseconds
    • getHideDelay

      public int getHideDelay()
      The delay in milliseconds before the tooltip is closed on losing hover, when not in manual mode. On blur, the tooltip is closed immediately.
      Returns:
      the delay in milliseconds
    • withHideDelay

      public Tooltip withHideDelay(int hideDelay)
      The delay in milliseconds before the tooltip is closed on losing hover, when not in manual mode. On blur, the tooltip is closed immediately.
      Parameters:
      hideDelay - the delay in milliseconds
    • setHoverDelay

      public void setHoverDelay(int hoverDelay)
      The delay in milliseconds before the tooltip is opened on hover, when not in manual mode.
      Parameters:
      hoverDelay - the delay in milliseconds
    • getHoverDelay

      public int getHoverDelay()
      The delay in milliseconds before the tooltip is opened on hover, when not in manual mode.
      Returns:
      the delay in milliseconds
    • withHoverDelay

      public Tooltip withHoverDelay(int hoverDelay)
      The delay in milliseconds before the tooltip is opened on hover, when not in manual mode.
      Parameters:
      hoverDelay - the delay in milliseconds
    • setPosition

      public void setPosition(Tooltip.TooltipPosition position)
      Position of the tooltip with respect to its target.
      Parameters:
      position - the position to set
    • getPosition

      public Tooltip.TooltipPosition getPosition()
      Position of the tooltip with respect to its target.
      Returns:
      the position
    • withPosition

      public Tooltip withPosition(Tooltip.TooltipPosition position)
      Position of the tooltip with respect to its target.
      Parameters:
      position - the position to set
    • setManual

      public void setManual(boolean manual)
      When true, the tooltip is controlled programmatically instead of reacting to focus and mouse events.
      Parameters:
      manual - true to enable manual mode
    • isManual

      public boolean isManual()
      When true, the tooltip is controlled programmatically instead of reacting to focus and mouse events.
      Returns:
      true if manual mode is enabled
    • withManual

      public Tooltip withManual(boolean manual)
      When true, the tooltip is controlled programmatically instead of reacting to focus and mouse events.
      Parameters:
      manual - true to enable manual mode
    • setOpened

      public void setOpened(boolean opened)
      When true, the tooltip is opened programmatically. Only works if `manual` is set to `true`.
      Parameters:
      opened - true to open the tooltip
    • isOpened

      public boolean isOpened()
      When true, the tooltip is opened programmatically. Only works if `manual` is set to `true`.
      Returns:
      true if the tooltip is opened