001: /*
002: * GWT-Ext Widget Library
003: * Copyright(c) 2007-2008, GWT-Ext.
004: * licensing@gwt-ext.com
005: *
006: * http://www.gwt-ext.com/license
007: */
008: package com.gwtext.sample.showcase2.client.tooltip;
009:
010: import com.gwtext.client.widgets.Panel;
011: import com.gwtext.client.widgets.ToolTip;
012: import com.gwtext.client.widgets.layout.HorizontalLayout;
013: import com.gwtext.sample.showcase2.client.ShowcasePanel;
014:
015: public class ToolTipTypesSample extends ShowcasePanel {
016:
017: public String getSourceUrl() {
018: return "source/tooltip/ToolTipTypesSample.java.html";
019: }
020:
021: public Panel getViewPanel() {
022: if (panel == null) {
023: panel = new Panel();
024:
025: String bodyStyle = "text-align:center;padding:5px 0;"
026: + "border:1px dotted #99bbe8;background:#dfe8f6;"
027: + "color:#15428b;cursor:default;margin:10px;"
028: + "font:bold 11px tahoma,arial,sans-serif;";
029:
030: Panel panel1 = new Panel();
031: panel1.setBorder(false);
032: panel1.setWidth(100);
033: panel1.setBodyStyle(bodyStyle);
034: panel1.setHtml("Basic Tooltip");
035:
036: ToolTip tip1 = new ToolTip();
037: tip1.setHtml("A very simple tooltip");
038: tip1.applyTo(panel1);
039:
040: Panel panel2 = new Panel();
041: panel2.setBodyStyle(bodyStyle);
042: panel2.setBorder(false);
043: panel2.setWidth(100);
044: panel2.setHtml("AutoHide Disabled");
045:
046: ToolTip tip2 = new ToolTip();
047: tip2.setTitle("My Tip Title");
048: tip2.setHtml("Click the X to close me");
049: tip2.setClosable(true);
050: tip2.setAutoHide(false);
051: tip2.applyTo(panel2);
052: tip2.setDraggable(true);
053:
054: Panel panel3 = new Panel();
055: panel3.setBodyStyle(bodyStyle);
056: panel3.setBorder(false);
057: panel3.setWidth(100);
058: panel3.setHtml("Ajax Tooltip");
059:
060: ToolTip tip3 = new ToolTip();
061: tip3.setAutoLoad("data/ajax-tip.html");
062: tip3.setWidth(200);
063: tip3.setDismissDelay(15000);
064: tip3.applyTo(panel3);
065:
066: Panel panel4 = new Panel();
067: panel4.setBodyStyle(bodyStyle);
068: panel4.setBorder(false);
069: panel4.setWidth(100);
070: panel4.setHtml("Mouse Track");
071:
072: ToolTip tip4 = new ToolTip();
073: tip4.setTitle("Mouse Track");
074: tip4
075: .setHtml("This tip will follow the mouse while it is over the element");
076: tip4.setDismissDelay(15000);
077: tip4.setWidth(200);
078: tip4.setTrackMouse(true);
079: tip4.applyTo(panel4);
080:
081: Panel horizontalPanel = new Panel();
082: //layout buttons horizontally with 10 pixels between them
083: horizontalPanel.setLayout(new HorizontalLayout(20));
084:
085: horizontalPanel.add(panel1);
086: horizontalPanel.add(panel2);
087: horizontalPanel.add(panel3);
088: horizontalPanel.add(panel4);
089:
090: panel.add(horizontalPanel);
091: }
092: return panel;
093: }
094:
095: protected boolean showEvents() {
096: return true;
097: }
098:
099: public String getIntro() {
100: return "<p>This Tooltip sample demonstrates:</p>"
101: + " <p>"
102: + " - Simple static tooltips<br>"
103: + " - Tooltips with titles<br>"
104: + " - Closable Tooltips<br>"
105: + " - Tooltips with Ajax content<br>"
106: + " - Other config options like autoHide and trackMouse<br>"
107: + " </p><p>It is important to note that tooltips can be applied to any element such as Form fields, Images and Buttons.</p>";
108: }
109: }
|