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:
009: package com.gwtext.client.widgets;
010:
011: import com.gwtext.client.core.BaseConfig;
012: import com.gwtext.client.util.JavaScriptObjectHelper;
013: import com.google.gwt.user.client.Element;
014:
015: /**
016: * Configuration class for {@link com.gwtext.client.widgets.QuickTips}.
017: */
018: public class QuickTipsConfig extends BaseConfig {
019:
020: /**
021: * True to automatically hide the quick tip after the mouse exits the target element (defaults to true).
022: * Used in conjunction with hideDelay.
023: *
024: * @param autoHide true to auto hide
025: */
026: public void setAutoHide(boolean autoHide) {
027: JavaScriptObjectHelper
028: .setAttribute(jsObj, "autoHide", autoHide);
029: }
030:
031: public void setCls(String cls) {
032: JavaScriptObjectHelper.setAttribute(jsObj, "cls", cls);
033: }
034:
035: public void setDismissDelay(int dismissDelay) {
036: JavaScriptObjectHelper.setAttribute(jsObj, "dismissDelay",
037: dismissDelay);
038: }
039:
040: public void setTraget(Element traget) {
041: JavaScriptObjectHelper.setAttribute(jsObj, "traget", traget);
042: }
043:
044: public void setTarget(String target) {
045: JavaScriptObjectHelper.setAttribute(jsObj, "target", target);
046: }
047:
048: public void setTarget(Component target) {
049: if (target.isRendered()) {
050: JavaScriptObjectHelper.setAttribute(jsObj, "target", target
051: .getElement());
052: } else {
053: JavaScriptObjectHelper.setAttribute(jsObj, "target", target
054: .getId());
055: }
056: }
057:
058: /**
059: * Body text to display (defaults to ''). This can be any valid HTML markup.
060: *
061: * @param text the text
062: */
063: public void setText(String text) {
064: JavaScriptObjectHelper.setAttribute(jsObj, "text", text);
065: }
066:
067: /**
068: * Title text to display (defaults to ''). This can be any valid HTML markup.
069: *
070: * @param title the title
071: */
072: public void setTitle(String title) {
073: JavaScriptObjectHelper.setAttribute(jsObj, "title", title);
074: }
075:
076: public void setWidth(int width) {
077: JavaScriptObjectHelper.setAttribute(jsObj, "width", width);
078: }
079:
080: //TODO2 arethese used? V
081: /**
082: * Delay in milliseconds before the quick tip hides when autoHide = true (defaults to 200).
083: *
084: * @param hideDelay hide delay in milliseconds
085: */
086: public void setHideDelay(int hideDelay) {
087: JavaScriptObjectHelper.setAttribute(jsObj, "hideDelay",
088: hideDelay);
089: }
090:
091: /**
092: * True to hide the quick tip if the user clicks anywhere in the document (defaults to true).
093: *
094: * @param hideOnClick true to hide on click
095: */
096: public void setHideOnClick(boolean hideOnClick) {
097: JavaScriptObjectHelper.setAttribute(jsObj, "hideOnClick",
098: hideOnClick);
099: }
100:
101: /**
102: * True to automatically use the element's DOM title value if available (defaults to false).
103: *
104: * @param interceptTitles true to automatically use the element's DOM title value if available
105: */
106: public void setInterceptTitles(boolean interceptTitles) {
107: JavaScriptObjectHelper.setAttribute(jsObj, "interceptTitles",
108: interceptTitles);
109: }
110:
111: /**
112: * The maximum width of the quick tip (defaults to 300).
113: *
114: * @param maxWidth the max width
115: */
116: public void setMaxWidth(int maxWidth) {
117: JavaScriptObjectHelper
118: .setAttribute(jsObj, "maxWidth", maxWidth);
119: }
120:
121: /**
122: * The minimum width of the quick tip (defaults to 40).
123: *
124: * @param minWidth the min width
125: */
126: public void setMinWidth(int minWidth) {
127: JavaScriptObjectHelper
128: .setAttribute(jsObj, "minWidth", minWidth);
129: }
130:
131: /**
132: * Delay in milliseconds before the quick tip displays after the mouse enters the target element (defaults to 500).
133: *
134: * @param showDelay the show delay
135: */
136: public void setShowDelay(int showDelay) {
137: JavaScriptObjectHelper.setAttribute(jsObj, "showDelay",
138: showDelay);
139: }
140:
141: /**
142: * True to have the quick tip follow the mouse as it moves over the target element (defaults to false).
143: *
144: * @param trackMouse true to track mouse
145: */
146: public void setTrackMouse(boolean trackMouse) {
147: JavaScriptObjectHelper.setAttribute(jsObj, "trackMouse",
148: trackMouse);
149: }
150: }
|