Package com.vaadin.flow.component.shared
Class Tooltip
- java.lang.Object
-
- com.vaadin.flow.component.shared.Tooltip
-
- All Implemented Interfaces:
Serializable
@NpmPackage(value="@vaadin/tooltip", version="23.6.3") @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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTooltip.TooltipPositionTooltip position in relation to the target element.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TooltipforComponent(Component component)Creates a tooltip to the givenComponentif one hasn't already been created.intgetFocusDelay()The delay in milliseconds before the tooltip is opened on keyboard focus, when not in manual mode.intgetHideDelay()The delay in milliseconds before the tooltip is closed on losing hover, when not in manual mode.intgetHoverDelay()The delay in milliseconds before the tooltip is opened on hover, when not in manual mode.Tooltip.TooltipPositiongetPosition()Position of the tooltip with respect to its target.StringgetText()String used as a tooltip content.booleanisManual()When true, the tooltip is controlled programmatically instead of reacting to focus and mouse events.booleanisOpened()When true, the tooltip is opened programmatically.voidsetFocusDelay(int focusDelay)The delay in milliseconds before the tooltip is opened on keyboard focus, when not in manual mode.voidsetHideDelay(int hideDelay)The delay in milliseconds before the tooltip is closed on losing hover, when not in manual mode.voidsetHoverDelay(int hoverDelay)The delay in milliseconds before the tooltip is opened on hover, when not in manual mode.voidsetManual(boolean manual)When true, the tooltip is controlled programmatically instead of reacting to focus and mouse events.voidsetOpened(boolean opened)When true, the tooltip is opened programmatically.voidsetPosition(Tooltip.TooltipPosition position)Position of the tooltip with respect to its target.voidsetText(String text)String used as a tooltip content.TooltipwithFocusDelay(int focusDelay)The delay in milliseconds before the tooltip is opened on keyboard focus, when not in manual mode.TooltipwithHideDelay(int hideDelay)The delay in milliseconds before the tooltip is closed on losing hover, when not in manual mode.TooltipwithHoverDelay(int hoverDelay)The delay in milliseconds before the tooltip is opened on hover, when not in manual mode.TooltipwithManual(boolean manual)When true, the tooltip is controlled programmatically instead of reacting to focus and mouse events.TooltipwithPosition(Tooltip.TooltipPosition position)Position of the tooltip with respect to its target.TooltipwithText(String text)String used as a tooltip content.
-
-
-
Method Detail
-
forComponent
public static Tooltip forComponent(Component component)
Creates a tooltip to the givenComponentif 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
-
-