~davewalker/ubuntu/maverick/eucalyptus/lp611144

« back to all changes in this revision

Viewing changes to clc/modules/www/src/main/java/edu/ucsb/eucalyptus/admin/client/Tooltip.java

  • Committer: Dave Walker (Daviey)
  • Date: 2010-06-21 12:59:20 UTC
  • mfrom: (1048.1.14 ubuntu)
  • Revision ID: davewalker@ubuntu.com-20100621125920-60uhixwq174elnj1
* New major upstream version merge, 1.7 (r1200).
* debian/patches/:
  - 02-Makefile.patch: Updated to reflect new code layout.
  - 07-local_support_euca_conf-in.patch: Updated to reflect new code layout.
  - 08-ubuntu-default-networking.patch: Refreshed.
  - 09-small-128-192MB.patch: Updated to point to new location.
  - 10-disable-iscsi.patch: Refreshed.
  - 11-state-cleanup-memleakfix.patch: Refreshed.
  - 15-fix-default-ramdisk.patch: Updated to point to new location.
  - 16-kvm_libvirt_xml_default_use_kvm.patch: Updated to reflect changes.
  - 17-fix_walrus_OOM_errors.patch: Removed, fixed upstream.
  - 18-priv_security.patch: Updated to reflect upstream changes.
  - 20-brute-force-webui.patch: Updated to reflect upstream changes. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package edu.ucsb.eucalyptus.admin.client;
 
2
 
 
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;
 
6
 
 
7
/**
 
8
 * A class showing the tooltip using a PopupPanel.
 
9
 */
 
10
public class Tooltip extends PopupPanel {
 
11
        
 
12
        public static final int TOOLTIP_DELAY_IN_MILLIS = 800;
 
13
                
 
14
        private static final String MAIN_STYLE_NAME = "euca-Tooltip";
 
15
        
 
16
        private Timer timer;
 
17
        // A singleton tooltip object
 
18
        private static Tooltip tooltip = null;
 
19
        
 
20
        public static Tooltip getInstance() {
 
21
                if (tooltip == null) {
 
22
                        tooltip = new Tooltip();
 
23
                }
 
24
                return tooltip;
 
25
        }
 
26
        
 
27
        private Tooltip() {
 
28
                super();
 
29
                
 
30
                this.addStyleName(MAIN_STYLE_NAME);
 
31
                this.timer = new Timer() {
 
32
                        public void run() {
 
33
                                Tooltip.this.show();
 
34
                        }
 
35
                };
 
36
        }
 
37
        
 
38
        /**
 
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
 
44
         */
 
45
        public void delayedShow(int x, int y, int delayInMillis, String html) {
 
46
                this.hide();
 
47
                this.timer.cancel();
 
48
                this.setPopupPosition(x, y);
 
49
                this.setWidget(new HTML(html));
 
50
                if (delayInMillis > 0) {
 
51
                        timer.schedule(delayInMillis);
 
52
                } else {
 
53
                        Tooltip.this.show();
 
54
                }
 
55
        }
 
56
        
 
57
        public void hide() {
 
58
                super.hide();
 
59
                this.timer.cancel();
 
60
        }
 
61
        
 
62
        public void hide(boolean autoClosed) {
 
63
                super.hide(autoClosed);
 
64
                this.timer.cancel();
 
65
        }
 
66
}