Spiffy UI Framework

org.spiffyui.client.widgets
Class Tooltip

java.lang.Object
  extended by PopupPanel
      extended by org.spiffyui.client.widgets.Tooltip

public class Tooltip
extends PopupPanel

Tooltip is a PopupPanel that auto-hides when you click outside of it, click the X, or when you let the auto-close time elapse (default auto close time is 1.5 seconds).


Constructor Summary
Tooltip()
          Create a tooltip
 
Method Summary
 void cancelAutoCloseTimer()
          Cancels the auto close timer
 int getAutoCloseTime()
          The time in milliseconds that the tooltip will automatically close if the mouse moves out of it.
 FocusPanel getBodyPanel()
          Get the FocusPanel that holds the body contents
 void onMouseOut(MouseOutEvent event)
          When the mouse is moved out of the focus panel, start the auto close timer.
 void onMouseOver(MouseOverEvent event)
          If the mouse is over the focus panel, cancel the auto close timer.
protected  void onPreviewNativeEvent(Event.NativePreviewEvent event)
          Overriding to close on pressing Esc key or clicking the close anchor.
 void setAutoCloseTime(int autoCloseTime)
          The time in milliseconds that the tooltip will automatically close if the mouse moves out of it.
 void setBody(Widget w)
          Sets the body of the tooltip with any Widget.
 void show()
          We are overriding the show method so that we can cancel the auto close timer.
 void startAutoCloseTimer()
          Call this if you want to start the auto close timer based on some other event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tooltip

public Tooltip()
Create a tooltip

Method Detail

getBodyPanel

public FocusPanel getBodyPanel()
Get the FocusPanel that holds the body contents

Returns:
the panel containing the tooltip contents

getAutoCloseTime

public int getAutoCloseTime()
The time in milliseconds that the tooltip will automatically close if the mouse moves out of it.

Returns:
Returns the autoCloseTime.

setAutoCloseTime

public void setAutoCloseTime(int autoCloseTime)
The time in milliseconds that the tooltip will automatically close if the mouse moves out of it.

Parameters:
autoCloseTime - The autoCloseTime to set.

setBody

public void setBody(Widget w)
Sets the body of the tooltip with any Widget. This will replace any widget previously set at the body.

Parameters:
w - any Widget

onPreviewNativeEvent

protected void onPreviewNativeEvent(Event.NativePreviewEvent event)
Overriding to close on pressing Esc key or clicking the close anchor. Also to auto-close if the mouse is not over the showing popup for designated milliseconds

Parameters:
event - - the Event.NativePreviewEvent

show

public void show()
We are overriding the show method so that we can cancel the auto close timer. The auto close timer should be started externally (like moving away from the anchor that originally shows the tooltip) or when the mouse moves out of the body of the focus panel.


cancelAutoCloseTimer

public void cancelAutoCloseTimer()
Cancels the auto close timer


startAutoCloseTimer

public void startAutoCloseTimer()
Call this if you want to start the auto close timer based on some other event.


onMouseOut

public void onMouseOut(MouseOutEvent event)
When the mouse is moved out of the focus panel, start the auto close timer.

Parameters:
event - - the MouseOutEvent

onMouseOver

public void onMouseOver(MouseOverEvent event)
If the mouse is over the focus panel, cancel the auto close timer.

Parameters:
event - - the MouseOverEvent

Spiffy UI Framework