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.client.core;
009:
010: import com.gwtext.client.animation.Easing;
011: import com.gwtext.client.util.JavaScriptObjectHelper;
012:
013: /**
014: * {@link com.gwtext.client.core.Fx} configuration options.
015: */
016: public class FxConfig extends GenericConfig {
017:
018: /**
019: * Construct a new instance.
020: */
021: public FxConfig() {
022: }
023:
024: /**
025: * Construct a new instance.
026: *
027: * @param duration the length of time (in seconds) that the effect should last
028: */
029: public FxConfig(int duration) {
030: JavaScriptObjectHelper
031: .setAttribute(jsObj, "duration", duration);
032: }
033:
034: /**
035: * A css class to apply after the effect.
036: *
037: * @param afterCls the CSS class
038: */
039: public void setAfterCls(String afterCls) {
040: JavaScriptObjectHelper
041: .setAttribute(jsObj, "afterCls", afterCls);
042: }
043:
044: /**
045: * A style specification string, e.g. "width:100px" that will be applied to the Element after the effect finishes.
046: *
047: * @param afterStyle css style
048: */
049: public void setAfterStyle(String afterStyle) {
050: JavaScriptObjectHelper.setAttribute(jsObj, "afterStyle",
051: afterStyle);
052: }
053:
054: /**
055: * A style specification that will be applied to the Element after the effect finishes.
056: *
057: * @param afterStyle css styles
058: */
059: public void setAfterStyle(GenericConfig afterStyle) {
060: JavaScriptObjectHelper.setAttribute(jsObj, "afterStyle",
061: afterStyle.getJsObj());
062: }
063:
064: /**
065: * A style specification function which returns such a specification that will be applied to the
066: * Element after the effect finishes.
067: *
068: * @param fn the style specification function
069: */
070: public native void setAfterStyle(Function fn) /*-{
071: var config = this.@com.gwtext.client.core.JsObject::getJsObj()();
072: config['afterStyle'] = function() {
073: fn.@com.gwtext.client.core.Function::execute()();
074: };
075: }-*/;
076:
077: /**
078: * Whether to allow subsequently-queued effects to run at the same time as the current effect, or to ensure that they run in sequence.
079: *
080: * @param concurrent true for concurrent
081: */
082: public void setConcurrent(boolean concurrent) {
083: JavaScriptObjectHelper.setAttribute(jsObj, "concurrent",
084: concurrent);
085: }
086:
087: /**
088: * A function called when the effect is finished.
089: *
090: * @param callback the callback function
091: */
092: public native void setCallback(Function callback) /*-{
093: var config = this.@com.gwtext.client.core.JsObject::getJsObj()();
094: config['callback'] = function() {
095: callback.@com.gwtext.client.core.Function::execute()();
096: };
097: }-*/;
098:
099: /**
100: * The end opacity after the effect completed.
101: *
102: * @param endOpacity the end opacity (0 - 1)
103: */
104: public void setEndOpacity(float endOpacity) {
105: JavaScriptObjectHelper.setAttribute(jsObj, "endOpacity",
106: endOpacity);
107: }
108:
109: /**
110: * The length of time (in seconds) that the effect should last.
111: *
112: * @param duration the duration in seconds
113: */
114: public void setDuration(float duration) {
115: JavaScriptObjectHelper
116: .setAttribute(jsObj, "duration", duration);
117: }
118:
119: /**
120: * An Easing value for the effect.
121: *
122: * @param easing easing method
123: */
124: public void setEasing(Easing easing) {
125: JavaScriptObjectHelper.setAttribute(jsObj, "easing", easing
126: .getMethod());
127: }
128:
129: /**
130: * Whether the Element should be removed from the DOM and destroyed after the effect finishes.
131: *
132: * @param remove true to remove
133: */
134: public void setRemove(boolean remove) {
135: JavaScriptObjectHelper.setAttribute(jsObj, "remove", remove);
136: }
137:
138: /**
139: * Whether subsequent effects should be stopped and removed after the current effect finishes.
140: *
141: * @param stopFx true to stop subsequent effects
142: */
143: public void setStopFx(boolean stopFx) {
144: JavaScriptObjectHelper.setAttribute(jsObj, "stopFx", stopFx);
145: }
146:
147: /**
148: * Whether to use the display CSS property instead of visibility when hiding Elements
149: * (only applies to effects that end with the element being visually hidden, ignored otherwise)
150: *
151: * @param useDisplay true to use display
152: */
153: public void setUseDisplay(boolean useDisplay) {
154: JavaScriptObjectHelper.setAttribute(jsObj, "useDisplay",
155: useDisplay);
156: }
157: }
|