1
package edu.ucsb.eucalyptus.admin.client;
3
import com.google.gwt.user.client.Timer;
4
import com.google.gwt.user.client.ui.HTML;
5
import com.google.gwt.user.client.ui.PopupPanel;
8
* A class showing the tooltip using a PopupPanel.
10
public class Tooltip extends PopupPanel {
12
public static final int TOOLTIP_DELAY_IN_MILLIS = 800;
14
private static final String MAIN_STYLE_NAME = "euca-Tooltip";
17
// A singleton tooltip object
18
private static Tooltip tooltip = null;
20
public static Tooltip getInstance() {
21
if (tooltip == null) {
22
tooltip = new Tooltip();
30
this.addStyleName(MAIN_STYLE_NAME);
31
this.timer = new Timer() {
39
* Show the tooltip after a delay.
40
* @param x The x coordinate of the tooltip
41
* @param y The y coordinate of the tooltip
42
* @param delayInMillis The delay in milliseconds
43
* @param html The tooltip contents
45
public void delayedShow(int x, int y, int delayInMillis, String html) {
48
this.setPopupPosition(x, y);
49
this.setWidget(new HTML(html));
50
if (delayInMillis > 0) {
51
timer.schedule(delayInMillis);
62
public void hide(boolean autoClosed) {
63
super.hide(autoClosed);