org.gwtbootstrap3.client.ui
Class Tooltip

java.lang.Object
  extended by org.gwtbootstrap3.client.ui.Tooltip
All Implemented Interfaces:
AcceptsOneWidget, HasOneWidget, HasWidgets, IsWidget, Iterable<Widget>, HasHover, HasId

public class Tooltip
extends Object
implements IsWidget, HasWidgets, HasOneWidget, HasId, HasHover

Basic implementation for the Bootstrap tooltip

Bootstrap Documentation

UiBinder example

 <b:Tooltip text="...">
    ...
 </b:Tooltip>
 
 

** Must call reconfigure() after altering any/all Tooltips!

Author:
Joshua Godi, Pontus Enmark

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidget
 
Constructor Summary
Tooltip()
          Creates the empty Tooltip
Tooltip(Widget w)
          Creates the tooltip around this widget
 
Method Summary
 void add(Widget child)
          
 HandlerRegistration addHiddenHandler(HiddenHandler hiddenHandler)
          Adds a hidden handler to the Tooltip that will be fired when the Tooltip's hidden event is fired
 HandlerRegistration addHideHandler(HideHandler hideHandler)
          Adds a hide handler to the Tooltip that will be fired when the Tooltip's hide event is fired
 HandlerRegistration addShowHandler(ShowHandler showHandler)
          Adds a show handler to the Tooltip that will be fired when the Tooltip's show event is fired
 HandlerRegistration addShownHandler(ShownHandler shownHandler)
          Adds a shown handler to the Tooltip that will be fired when the Tooltip's shown event is fired
 Widget asWidget()
          
 void clear()
          
 void destroy()
          Force the Tooltip to be destroyed
 String getContainer()
          Get where the hover will render it's HTML code
 int getHideDelayMs()
          Get the delay in MS to hide the hover component
 String getId()
          Gets the ID of the widget
 Placement getPlacement()
          Get the Placement of the hover component
 int getShowDelayMs()
          Get the delay in MS to show the hover component
 String getTitle()
          Gets the tooltip's display string
 Trigger getTrigger()
          Get the hover component's trigger
 Widget getWidget()
          
 void hide()
          Force hide the Tooltip
 boolean isAnimated()
          Get whether or not the hover widget will be animated
 boolean isHtml()
          Get whether or not the hover widget will render HTML
 Iterator<Widget> iterator()
          
protected  void onHidden(Event evt)
          Can be override by subclasses to handle Tooltip's "hidden" event however it's recommended to add an event handler to the tooltip.
protected  void onHide(Event evt)
          Can be override by subclasses to handle Tooltip's "hide" event however it's recommended to add an event handler to the tooltip.
protected  void onShow(Event evt)
          Can be override by subclasses to handle Tooltip's "show" event however it's recommended to add an event handler to the tooltip.
protected  void onShown(Event evt)
          Can be override by subclasses to handle Tooltip's "shown" event however it's recommended to add an event handler to the tooltip.
 void reconfigure()
          Reconfigures the tooltip, must be called when altering any tooltip after it has already been shown
 boolean remove(Widget w)
          
 void setContainer(String container)
          Sets the custom container that the hover's HTML will render in
 void setHideDelayMs(int hideDelayMs)
          Set the delay in MS that the hover component takes to hide
 void setId(String id)
          Sets the ID on the widget
 void setIsAnimated(boolean isAnimated)
          Set whether or not to animate the displaying of the hover widget
 void setIsHtml(boolean isHTML)
          Set to make the hover widget display HTML code
 void setPlacement(Placement placement)
          Sets the placement of the hover component
 void setShowDelayMs(int showDelayMs)
          Set the delay in MS that the hover component takes to display
 void setTitle(String title)
          Sets the tooltip's display string
 void setTrigger(Trigger trigger)
          Set what will trigger the showing of the hover component
 void setWidget(IsWidget w)
          
 void setWidget(Widget w)
          
 void show()
          Force show the Tooltip
 void toggle()
          Toggle the Tooltip to either show/hide
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Tooltip

public Tooltip()
Creates the empty Tooltip


Tooltip

public Tooltip(Widget w)
Creates the tooltip around this widget

Parameters:
w - widget for the tooltip
Method Detail

setWidget

public void setWidget(Widget w)

Specified by:
setWidget in interface HasOneWidget

add

public void add(Widget child)

Specified by:
add in interface HasWidgets

setWidget

public void setWidget(IsWidget w)

Specified by:
setWidget in interface AcceptsOneWidget

getWidget

public Widget getWidget()

Specified by:
getWidget in interface HasOneWidget

setId

public void setId(String id)
Sets the ID on the widget

Specified by:
setId in interface HasId
Parameters:
id - String desired ID

getId

public String getId()
Gets the ID of the widget

Specified by:
getId in interface HasId
Returns:
String widget ID

setIsAnimated

public void setIsAnimated(boolean isAnimated)
Description copied from interface: HasHover
Set whether or not to animate the displaying of the hover widget

Specified by:
setIsAnimated in interface HasHover
Parameters:
isAnimated - boolean to animate or not

isAnimated

public boolean isAnimated()
Get whether or not the hover widget will be animated

Specified by:
isAnimated in interface HasHover
Returns:
boolean true = animated, false = not animated

setIsHtml

public void setIsHtml(boolean isHTML)
Set to make the hover widget display HTML code

Specified by:
setIsHtml in interface HasHover
Parameters:
isHTML - boolean to render HTML code or not

isHtml

public boolean isHtml()
Get whether or not the hover widget will render HTML

Specified by:
isHtml in interface HasHover
Returns:
boolean true = render HTML, false = don't render HTML

setPlacement

public void setPlacement(Placement placement)
Sets the placement of the hover component

Specified by:
setPlacement in interface HasHover
Parameters:
placement - Placement of the hover component

getPlacement

public Placement getPlacement()
Get the Placement of the hover component

Specified by:
getPlacement in interface HasHover
Returns:
Placement of the hover component

setTrigger

public void setTrigger(Trigger trigger)
Set what will trigger the showing of the hover component

Specified by:
setTrigger in interface HasHover
Parameters:
trigger - Trigger how the hover component will show

getTrigger

public Trigger getTrigger()
Get the hover component's trigger

Specified by:
getTrigger in interface HasHover
Returns:
Trigger how the hover component will show

setShowDelayMs

public void setShowDelayMs(int showDelayMs)
Description copied from interface: HasHover
Set the delay in MS that the hover component takes to display

Specified by:
setShowDelayMs in interface HasHover
Parameters:
showDelayMs - int number of MS to delay the display

getShowDelayMs

public int getShowDelayMs()
Get the delay in MS to show the hover component

Specified by:
getShowDelayMs in interface HasHover
Returns:
int delay in MS

setHideDelayMs

public void setHideDelayMs(int hideDelayMs)
Set the delay in MS that the hover component takes to hide

Specified by:
setHideDelayMs in interface HasHover
Parameters:
hideDelayMs - int number of MS to delay the hide

getHideDelayMs

public int getHideDelayMs()
Get the delay in MS to hide the hover component

Specified by:
getHideDelayMs in interface HasHover
Returns:
int delay in MS

setContainer

public void setContainer(String container)
Sets the custom container that the hover's HTML will render in

Specified by:
setContainer in interface HasHover
Parameters:
container - String selector of where to render the hover's HTML code

getContainer

public String getContainer()
Get where the hover will render it's HTML code

Specified by:
getContainer in interface HasHover
Returns:
String selector where the hover renders to

getTitle

public String getTitle()
Gets the tooltip's display string

Returns:
String tooltip display string

setTitle

public void setTitle(String title)
Sets the tooltip's display string

Parameters:
title - String display string

reconfigure

public void reconfigure()
Reconfigures the tooltip, must be called when altering any tooltip after it has already been shown


toggle

public void toggle()
Toggle the Tooltip to either show/hide


show

public void show()
Force show the Tooltip


hide

public void hide()
Force hide the Tooltip


destroy

public void destroy()
Force the Tooltip to be destroyed


onShow

protected void onShow(Event evt)
Can be override by subclasses to handle Tooltip's "show" event however it's recommended to add an event handler to the tooltip.

Parameters:
evt - Event
See Also:
ShowEvent

onShown

protected void onShown(Event evt)
Can be override by subclasses to handle Tooltip's "shown" event however it's recommended to add an event handler to the tooltip.

Parameters:
evt - Event
See Also:
ShownEvent

onHide

protected void onHide(Event evt)
Can be override by subclasses to handle Tooltip's "hide" event however it's recommended to add an event handler to the tooltip.

Parameters:
evt - Event
See Also:
HideEvent

onHidden

protected void onHidden(Event evt)
Can be override by subclasses to handle Tooltip's "hidden" event however it's recommended to add an event handler to the tooltip.

Parameters:
evt - Event
See Also:
HiddenEvent

addShowHandler

public HandlerRegistration addShowHandler(ShowHandler showHandler)
Adds a show handler to the Tooltip that will be fired when the Tooltip's show event is fired

Parameters:
showHandler - ShowHandler to handle the show event
Returns:
HandlerRegistration of the handler

addShownHandler

public HandlerRegistration addShownHandler(ShownHandler shownHandler)
Adds a shown handler to the Tooltip that will be fired when the Tooltip's shown event is fired

Parameters:
shownHandler - ShownHandler to handle the shown event
Returns:
HandlerRegistration of the handler

addHideHandler

public HandlerRegistration addHideHandler(HideHandler hideHandler)
Adds a hide handler to the Tooltip that will be fired when the Tooltip's hide event is fired

Parameters:
hideHandler - HideHandler to handle the hide event
Returns:
HandlerRegistration of the handler

addHiddenHandler

public HandlerRegistration addHiddenHandler(HiddenHandler hiddenHandler)
Adds a hidden handler to the Tooltip that will be fired when the Tooltip's hidden event is fired

Parameters:
hiddenHandler - HiddenHandler to handle the hidden event
Returns:
HandlerRegistration of the handler

clear

public void clear()

Specified by:
clear in interface HasWidgets

iterator

public Iterator<Widget> iterator()

Specified by:
iterator in interface HasWidgets
Specified by:
iterator in interface Iterable<Widget>

remove

public boolean remove(Widget w)

Specified by:
remove in interface HasWidgets

asWidget

public Widget asWidget()

Specified by:
asWidget in interface IsWidget

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2015. All rights reserved.