0001: /*
0002: * GWT-Ext Widget Library
0003: * Copyright(c) 2007-2008, GWT-Ext.
0004: * licensing@gwt-ext.com
0005: *
0006: * http://www.gwt-ext.com/license
0007: */
0008: package com.gwtext.client.core;
0009:
0010: import com.google.gwt.core.client.JavaScriptObject;
0011: import com.google.gwt.user.client.Command;
0012: import com.google.gwt.user.client.DeferredCommand;
0013: import com.google.gwt.user.client.Element;
0014: import com.gwtext.client.animation.Easing;
0015: import com.gwtext.client.util.KeyMap;
0016: import com.gwtext.client.util.KeyMapConfig;
0017: import com.gwtext.client.widgets.event.KeyListener;
0018:
0019: /**
0020: * Represents a base Element in the DOM.
0021: */
0022: public class BaseElement extends JsObject implements Fx {
0023:
0024: protected BaseElement() {
0025: }
0026:
0027: public BaseElement(JavaScriptObject jsObj) {
0028: super (jsObj);
0029: }
0030:
0031: /**
0032: * Adds a CSS class to the element. Duplicate classes are automatically filtered out.
0033: *
0034: * @param className the CSS class to add
0035: * @return this
0036: */
0037: public native BaseElement addClass(String className)/*-{
0038: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0039: elem.addClass(className);
0040: return this;
0041: }-*/;
0042:
0043: /**
0044: * Adds CSS classes to the element. Duplicate classes are automatically filtered out.
0045: *
0046: * @param classNames an array of CSS classes
0047: * @return this
0048: */
0049: public native BaseElement addClass(String[] classNames)/*-{
0050: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0051: elem.addClass(@com.gwtext.client.util.JavaScriptObjectHelper::convertToJavaScriptArray([Ljava/lang/Object;)(classNames));
0052: return this;
0053: }-*/;
0054:
0055: /**
0056: * Sets up event handlers to add and remove a css class when the mouse is down and then up on this element (a click effect).
0057: *
0058: * @param className the CSS class to add
0059: * @return this
0060: */
0061: public native BaseElement addClassOnClick(String className)/*-{
0062: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0063: elem.addClassOnClick(className);
0064: return this;
0065: }-*/;
0066:
0067: /**
0068: * Sets up event handlers to add and remove a css class when this element has the focus
0069: *
0070: * @param className the CSS class to add
0071: * @return this
0072: */
0073: public native BaseElement addClassOnFocus(String className)/*-{
0074: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0075: elem.addClassOnFocus(className);
0076: return this;
0077: }-*/;
0078:
0079: public native BaseElement addClassOnOver(String className)/*-{
0080: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0081: elem.addClassOnOver(className);
0082: return this;
0083: }-*/;
0084:
0085: /**
0086: * Sets up event handlers to add and remove a css class when the mouse is over this element.
0087: *
0088: * @param className the CSS class to add
0089: * @param preventFlicker if set to true, it prevents flickering by filtering mouseout events for children elements
0090: * @return this
0091: */
0092: public native BaseElement addClassOnOver(String className,
0093: boolean preventFlicker)/*-{
0094: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0095: elem.addClassOnOver(className, preventFlicker);
0096: return this;
0097: }-*/;
0098:
0099: /**
0100: * Convenience method for constructing a KeyMap.
0101: *
0102: * @param keyCode the numeric key code
0103: * @param listener the key listener
0104: * @return the KeyMap created
0105: */
0106: public native KeyMap addKeyListener(int keyCode,
0107: KeyListener listener)/*-{
0108: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0109: var km = elem.addKeyListener(keyCode, function(key, event) {
0110: var e = @com.gwtext.client.core.EventObject::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(event);
0111: listener.@com.gwtext.client.widgets.event.KeyListener::onKey(ILcom/gwtext/client/core/EventObject;)(key, e);
0112: });
0113: return @com.gwtext.client.util.KeyMap::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(km);
0114: }-*/;
0115:
0116: /**
0117: * Convenience method for constructing a KeyMap.
0118: *
0119: * @param keyCodes array of key codes
0120: * @param listener the key listener
0121: * @return the KeyMap created
0122: */
0123: public native KeyMap addKeyListener(int[] keyCodes,
0124: KeyListener listener)/*-{
0125: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0126: var keyCodesJS = @com.gwtext.client.util.JavaScriptObjectHelper::convertToJavaScriptArray([I)(keyCodes);
0127: var km = elem.addKeyListener(keyCodesJS, function(key, event) {
0128: var e = @com.gwtext.client.core.EventObject::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(event);
0129: listener.@com.gwtext.client.widgets.event.KeyListener::onKey(ILcom/gwtext/client/core/EventObject;)(key, e);
0130: });
0131: return @com.gwtext.client.util.KeyMap::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(km);
0132: }-*/;
0133:
0134: /**
0135: * Convenience method for constructing a KeyMap.
0136: *
0137: * @param keys a string with the keys to listen for
0138: * @param listener the key listener
0139: * @return the KeyMap created
0140: */
0141: public native KeyMap addKeyListener(String keys,
0142: KeyListener listener)/*-{
0143: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0144: var km = elem.addKeyListener(keys, function(key, event) {
0145: var e = @com.gwtext.client.core.EventObject::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(event);
0146: listener.@com.gwtext.client.widgets.event.KeyListener::onKey(ILcom/gwtext/client/core/EventObject;)(key, e);
0147: });
0148: return @com.gwtext.client.util.KeyMap::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(km);
0149: }-*/;
0150:
0151: /**
0152: * Convenience method for constructing a KeyMap.
0153: *
0154: * @param config the key map config
0155: * @return the KeyMap created
0156: */
0157: public native KeyMap addKeyMap(KeyMapConfig config)/*-{
0158: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0159: var configJS = config.@com.gwtext.client.core.JsObject::getJsObj()();
0160: var km = elem.addKeyMap(configJS);
0161: return @com.gwtext.client.util.KeyMap::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(km);
0162: }-*/;
0163:
0164: /**
0165: * Appends an event handler.
0166: *
0167: * @param eventName the type of event to append
0168: * @param cb the event callback
0169: */
0170: public native void addListener(String eventName, EventCallback cb) /*-{
0171: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
0172: el.addListener(eventName, function(event) {
0173: var e = (event === undefined || event == null) ? null : @com.gwtext.client.core.EventObject::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(event);
0174: cb.@com.gwtext.client.core.EventCallback::execute(Lcom/gwtext/client/core/EventObject;)(e);
0175: }
0176: );
0177: }-*/;
0178:
0179: /**
0180: * Appends an event handler.
0181: *
0182: * @param eventName the type of event to append
0183: * @param cb the event callback
0184: * @param config the listener config
0185: */
0186: public native void addListener(String eventName, EventCallback cb,
0187: ListenerConfig config) /*-{
0188: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
0189: el.addListener(eventName, function(event) {
0190: var e = (event === undefined || event == null) ? null : @com.gwtext.client.core.EventObject::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(event);
0191: cb.@com.gwtext.client.core.EventCallback::execute(Lcom/gwtext/client/core/EventObject;)(e);
0192: },
0193: null,
0194: config.@com.gwtext.client.core.JsObject::jsObj
0195: );
0196: }-*/;
0197:
0198: /**
0199: * Aligns this element with another element relative to the specified anchor points. If the other element is the document it aligns it to the viewport.
0200: *
0201: * The anchorPosition value is separated by a dash, the first value is used as the element's anchor point, and the second value is used as the target's anchor point.
0202: * In addition to the anchor points, the position parameter also supports the "?" character. If "?" is passed at the end of the position string, the element will
0203: * attempt to align as specified, but the position will be adjusted to constrain to the viewport if necessary. Note that the element being aligned might be swapped
0204: * to align to a different position than that specified in order to enforce the viewport constraints.
0205: * Following are all of the supported anchor positions:
0206: *
0207: * <pre >Value Description
0208: * ----- -----------------------------
0209: * tl The top left corner (default)
0210: * t The center of the top edge
0211: * tr The top right corner
0212: * l The center of the left edge
0213: * c In the center of the element
0214: * r The center of the right edge
0215: * bl The bottom left corner
0216: * b The center of the bottom edge
0217: * br The bottom right corner</pre>
0218: *
0219: * Example Usage:
0220: * <pre ><code ><i>
0221: * // align el to other-el using the <b>default</b> positioning (<em >"tl-bl"</em>, non-constrained)</i>
0222: * el.alignTo(<em id="ext-gen1086">"other-el"</em>);
0223: * <i id="ext-gen1079">// align the top left corner of el <b>with</b> the top right corner of other-el (constrained to viewport)</i>
0224: * el.alignTo(<em id="ext-gen1085">"other-el"</em>, <em id="ext-gen1097">"tr?"</em>);
0225: *
0226: * <i id="ext-gen1080">// align the bottom right corner of el <b>with</b> the center left edge of other-el</i>
0227: * el.alignTo(<em id="ext-gen1084">"other-el"</em>, <em id="ext-gen1098">"br-l?"</em>);
0228: * <i id="ext-gen1083">// align the center of el <b>with</b> the bottom left corner of other-el and</i>
0229: * <i id="ext-gen1082">// adjust the x position by -6 pixels (and the y position by 0)</i>
0230: * el.alignTo(<em>"other-el"</em>, <em id="ext-gen1099">"c-bl"</em>, new int[]{-6, 0});</code></pre>
0231: *
0232: * @param id the element to align to
0233: * @param anchorPosition the element's anchor point
0234: * @return this
0235: */
0236: public BaseElement alignTo(final String id,
0237: final String anchorPosition) {
0238: DeferredCommand.addCommand(new Command() {
0239: public void execute() {
0240: doAlignTo(id, anchorPosition);
0241: }
0242: });
0243: return this ;
0244: }
0245:
0246: private native BaseElement doAlignTo(String id,
0247: String anchorPosition)/*-{
0248: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0249: elem.alignTo(id, anchorPosition);
0250: return this;
0251: }-*/;
0252:
0253: /**
0254: * Aligns this element with another element relative to the specified anchor points. If the other element is the document it aligns it to the viewport.
0255: *
0256: * The anchorPosition value is separated by a dash, the first value is used as the element's anchor point, and the second value is used as the target's anchor point.
0257: * In addition to the anchor points, the position parameter also supports the "?" character. If "?" is passed at the end of the position string, the element will
0258: * attempt to align as specified, but the position will be adjusted to constrain to the viewport if necessary. Note that the element being aligned might be swapped
0259: * to align to a different position than that specified in order to enforce the viewport constraints.
0260: * Following are all of the supported anchor positions:
0261: *
0262: * <pre >Value Description
0263: * ----- -----------------------------
0264: * tl The top left corner (default)
0265: * t The center of the top edge
0266: * tr The top right corner
0267: * l The center of the left edge
0268: * c In the center of the element
0269: * r The center of the right edge
0270: * bl The bottom left corner
0271: * b The center of the bottom edge
0272: * br The bottom right corner</pre>
0273: *
0274: * Example Usage:
0275: * <pre ><code ><i>
0276: * // align el to other-el using the <b>default</b> positioning (<em >"tl-bl"</em>, non-constrained)</i>
0277: * el.alignTo(<em id="ext-gen1086">"other-el"</em>);
0278: * <i id="ext-gen1079">// align the top left corner of el <b>with</b> the top right corner of other-el (constrained to viewport)</i>
0279: * el.alignTo(<em id="ext-gen1085">"other-el"</em>, <em id="ext-gen1097">"tr?"</em>);
0280: *
0281: * <i id="ext-gen1080">// align the bottom right corner of el <b>with</b> the center left edge of other-el</i>
0282: * el.alignTo(<em id="ext-gen1084">"other-el"</em>, <em id="ext-gen1098">"br-l?"</em>);
0283: * <i id="ext-gen1083">// align the center of el <b>with</b> the bottom left corner of other-el and</i>
0284: * <i id="ext-gen1082">// adjust the x position by -6 pixels (and the y position by 0)</i>
0285: * el.alignTo(<em>"other-el"</em>, <em id="ext-gen1099">"c-bl"</em>, new int[]{-6, 0});</code></pre>
0286: *
0287: * @param id the element to align to
0288: * @param anchorPosition the element's anchor point
0289: * @param offsetXY offset the positioning by [x, y]
0290: * @param animate true for the default animation
0291: * @return this
0292: */
0293: public native BaseElement alignTo(String id, String anchorPosition,
0294: int[] offsetXY, boolean animate)/*-{
0295: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0296: var offsetJS = @com.gwtext.client.util.JavaScriptObjectHelper::convertToJavaScriptArray([I)(offsetXY);
0297: elem.alignTo(id, anchorPosition, offsetJS, animate);
0298: return this;
0299: }-*/;
0300:
0301: /**
0302: * Aligns this element with another element relative to the specified anchor points. If the other element is the document it aligns it to the viewport.
0303: *
0304: * @param id the element to align to
0305: * @param anchorPosition the element's anchor point
0306: * @return this
0307: */
0308: public native BaseElement anchorTo(String id, String anchorPosition)/*-{
0309: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0310: elem.anchorTo(id, anchorPosition);
0311: return this;
0312: }-*/;
0313:
0314: //todo fix ext inconsistency
0315: /**
0316: * Aligns this element with another element relative to the specified anchor points. If the other element is the document it aligns it to the viewport.
0317: *
0318: * @param id the element to align to
0319: * @param anchorPosition the element's anchor point
0320: * @param offsetXY offset the positioning by [x, y]
0321: * @param animate true for the default animation
0322: * @param bufferDelay buffer delay
0323: * @return this
0324: */
0325: public native BaseElement anchorTo(String id,
0326: String anchorPosition, int[] offsetXY, boolean animate,
0327: int bufferDelay)/*-{
0328: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0329: var offsetJS = @com.gwtext.client.util.JavaScriptObjectHelper::convertToJavaScriptArray([I)(offsetXY);
0330: elem.anchorTo(id, anchorPosition, offsetJS, animate, bufferDelay);
0331: return this;
0332: }-*/;
0333:
0334: /**
0335: * Perform animation on this element. For example :
0336: * <code><pre>
0337: * GenericConfig animArgs = new GenericConfig();
0338: * GenericConfig widthArgs = new GenericConfig();
0339: * widthArgs.setProperty("from", 600);
0340: * widthArgs.setProperty("to", 0);
0341: * animArgs.setProperty("width", widthArgs);
0342: * el.animate(animArgs);
0343: * </pre></code>
0344: *
0345: * @param args animation control args
0346: * @return this
0347: */
0348: public native BaseElement animate(GenericConfig args)/*-{
0349: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0350: var argsJS = args == null ? null : args.@com.gwtext.client.core.JsObject::getJsObj()();
0351: elem.animate(argsJS);
0352: return this;
0353: }-*/;
0354:
0355: /**
0356: * Perform animation on this element.
0357: *
0358: * @param args animation control args
0359: * @param duration how long the animation lasts in seconds (defaults to .35)
0360: * @param onComplete function to call when animation completes
0361: * @param easing Easing method to use (defaults to easeOut) easeOut. See http://developer.yahoo.com/yui/docs/YAHOO.util.Easing.html
0362: * @param animType 'run' is the default. Can also be 'color', 'motion', or 'scroll'
0363: * @return this
0364: */
0365: public native BaseElement animate(GenericConfig args,
0366: float duration, Function onComplete, Easing easing,
0367: String animType)/*-{
0368: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0369: var argsJS = args == null ? null : args.@com.gwtext.client.core.JsObject::getJsObj()();
0370: var easingJS = easing.@com.gwtext.client.animation.Easing::getMethod();
0371: elem.animate(argsJS, duration, onComplete == null ? null : function() {
0372: onComplete.@com.gwtext.client.core.Function::execute()();
0373: }, easingJS, animType);
0374: return this;
0375: }-*/;
0376:
0377: /**
0378: * More flexible version of {@link #setStyle} for setting style properties.
0379: *
0380: * @param style a style specification string, e.g. "width:100px"
0381: * @return this
0382: */
0383: public native BaseElement applyStyles(String style) /*-{
0384: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0385: elem.applyStyles(style);
0386: return this;
0387: }-*/;
0388:
0389: /**
0390: * Measures the element's content height and updates height to match. Note: this function uses setTimeout so the new height may not be available immediately.
0391: *
0392: * @return this
0393: */
0394: public native BaseElement autoHeight() /*-{
0395: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0396: elem.autoHeight();
0397: return this;
0398: }-*/;
0399:
0400: //todo fix ext inconsisteny
0401: /**
0402: * Measures the element's content height and updates height to match. Note: this function uses setTimeout so the new height may not be available immediately.
0403: *
0404: * @param animate animate the transition (defaults to false)
0405: * @param duration length of the animation in seconds (defaults to .35)
0406: * @param onComplete Function to call when animation completes
0407: * @param easing Easing method to use (defaults to easeOut)
0408: * @return this
0409: */
0410: public native BaseElement autoHeight(boolean animate,
0411: float duration, Function onComplete, Easing easing)/*-{
0412: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0413: var easingJS = easing.@com.gwtext.client.animation.Easing::getMethod();
0414: elem.autoHeight(animate, duration, function() {
0415: onComplete.@com.gwtext.client.core.Function::execute()();
0416: }, easingJS);
0417: return this;
0418: }-*/;
0419:
0420: /**
0421: * Removes worthless text nodes.
0422: */
0423: public native void clean() /*-{
0424: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0425: elem.clean();
0426: }-*/;
0427:
0428: /**
0429: * Removes worthless text nodes.
0430: *
0431: * @param forceClean by default the element keeps track if it has been cleaned already so you can call this over and over. However, if you update the element and need to force a reclean, you can pass true.
0432: */
0433: public native void clean(boolean forceClean) /*-{
0434: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0435: elem.clean(forceClean);
0436: }-*/;
0437:
0438: /**
0439: * Clears any opacity settings from this element. Required in some cases for IE.
0440: *
0441: * @return this
0442: */
0443: public native BaseElement clearOpacity() /*-{
0444: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0445: elem.clearOpacity();
0446: return this;
0447: }-*/;
0448:
0449: /**
0450: * Store the current overflow setting and clip overflow on the element - use unclip to remove.
0451: *
0452: * @return this
0453: */
0454: public native BaseElement clip() /*-{
0455: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0456: elem.clip();
0457: return this;
0458: }-*/;
0459:
0460: /**
0461: * Creates an iframe shim for this element to keep selects and other windowed objects from showing through.
0462: *
0463: * @return the new shim element
0464: */
0465: public native ExtElement createShim() /*-{
0466: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0467: var el = elem.shim();
0468: return @com.gwtext.client.core.ExtElement::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(el);
0469: }-*/;
0470:
0471: /**
0472: * Convenience method for setVisibilityMode(Element.DISPLAY)
0473: *
0474: * @return this
0475: */
0476: public native BaseElement enableDisplayMode() /*-{
0477: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0478: elem.enableDisplayMode();
0479: return this;
0480: }-*/;
0481:
0482: /**
0483: * Convenience method for setVisibilityMode(Element.DISPLAY)
0484: *
0485: * @param display what to set display to when visible
0486: * @return this
0487: */
0488: public native BaseElement enableDisplayMode(String display) /*-{
0489: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0490: elem.enableDisplayMode(display);
0491: return this;
0492: }-*/;
0493:
0494: /**
0495: * Hide this element - Uses display mode to determine whether to use "display" or "visibility". See {@link #setVisible}.
0496: *
0497: * @return this
0498: */
0499: public native BaseElement hide()/*-{
0500: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0501: elem.hide();
0502: return this;
0503: }-*/;
0504:
0505: /**
0506: * Hide this element - Uses display mode to determine whether to use "display" or "visibility". See {@link #setVisible}.
0507: *
0508: * @param animate true for the default animation
0509: * @return this
0510: */
0511: public native BaseElement hide(boolean animate)/*-{
0512: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0513: elem.hide(animate);
0514: return this;
0515: }-*/;
0516:
0517: /**
0518: * Hide this element - Uses display mode to determine whether to use "display" or "visibility". See {@link #setVisible}.
0519: *
0520: * @param animateConfig the animation config
0521: * @return this
0522: */
0523: public native BaseElement hide(AnimationConfig animateConfig)/*-{
0524: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0525: var animateConfigJS = animateConfig.@com.gwtext.client.core.JsObject::getJsObj()();
0526: elem.hide(animateConfigJS);
0527: return this;
0528: }-*/;
0529:
0530: /**
0531: * Move this element relative to its current position.
0532: *
0533: * @param direction the direction
0534: * @param distance how far to move the element in pixels
0535: * @return this
0536: */
0537: public native BaseElement move(Direction direction, int distance)/*-{
0538: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0539: var directionJS = direction.@com.gwtext.client.core.Direction::getDirection()();
0540: elem.move(directionJS, distance);
0541: return this;
0542: }-*/;
0543:
0544: /**
0545: * Move this element relative to its current position.
0546: *
0547: * @param direction the direction
0548: * @param distance how far to move the element in pixels
0549: * @param animate true for the default animation
0550: * @return this
0551: */
0552: public native BaseElement move(Direction direction, int distance,
0553: boolean animate)/*-{
0554: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0555: var directionJS = direction.@com.gwtext.client.core.Direction::getDirection()();
0556: elem.move(directionJS, distance, animate);
0557: return this;
0558: }-*/;
0559:
0560: /**
0561: * Move this element relative to its current position.
0562: *
0563: * @param direction the direction
0564: * @param distance how far to move the element in pixels
0565: * @param animateConfig the animation config
0566: * @return this
0567: */
0568: public native BaseElement move(Direction direction, int distance,
0569: AnimationConfig animateConfig)/*-{
0570: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0571: var animateConfigJS = animateConfig.@com.gwtext.client.core.JsObject::getJsObj()();
0572: var directionJS = direction.@com.gwtext.client.core.Direction::getDirection()();
0573: elem.move(directionJS, distance, animateConfigJS);
0574: return this;
0575: }-*/;
0576:
0577: /**
0578: * Sets the position of the element in page coordinates, regardless of how the element is positioned. the element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
0579: *
0580: * @param x X value for new position (coordinates are page-based)
0581: * @param y Y value for new position (coordinates are page-based)
0582: * @return this
0583: */
0584: public native BaseElement moveTo(int x, int y)/*-{
0585: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0586: elem.moveTo(x, y);
0587: return this;
0588: }-*/;
0589:
0590: /**
0591: * Sets the position of the element in page coordinates, regardless of how the element is positioned. the element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
0592: *
0593: * @param x X value for new position (coordinates are page-based)
0594: * @param y Y value for new position (coordinates are page-based)
0595: * @param animate true to animate
0596: * @return this
0597: */
0598: public native BaseElement moveTo(int x, int y, boolean animate)/*-{
0599: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0600: elem.moveTo(x, y, animate);
0601: return this;
0602: }-*/;
0603:
0604: /**
0605: * Sets the position of the element in page coordinates, regardless of how the element is positioned. the element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
0606: *
0607: * @param x X value for new position (coordinates are page-based)
0608: * @param y Y value for new position (coordinates are page-based)
0609: * @param animateConfig the animcation config
0610: * @return this
0611: */
0612: public native BaseElement moveTo(int x, int y,
0613: AnimationConfig animateConfig)/*-{
0614: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0615: var animateConfigJS = animateConfig.@com.gwtext.client.core.JsObject::getJsObj()();
0616: elem.moveTo(x, y, animateConfigJS);
0617: return this;
0618: }-*/;
0619:
0620: /**
0621: * Adds a CSS class to this element and removes the same class(es) from all siblings.
0622: *
0623: * @param className the CSS class to add
0624: * @return this
0625: */
0626: public native BaseElement radioClass(String className)/*-{
0627: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0628: elem.radioClass(className);
0629: return this;
0630: }-*/;
0631:
0632: /**
0633: * Adds one or more CSS classes to this element and removes the same class(es) from all siblings.
0634: *
0635: * @param classNames the CSS classes to add
0636: * @return this
0637: */
0638: public native BaseElement radioClass(String[] classNames)/*-{
0639: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0640: var classNamesJS = @com.gwtext.client.util.JavaScriptObjectHelper::convertToJavaScriptArray([Ljava/lang/Object;)(classNames);
0641: elem.radioClass(classNamesJS);
0642: return this;
0643: }-*/;
0644:
0645: /**
0646: * Removes this element from the DOM and deletes it from the cache.
0647: */
0648: public native void remove()/*-{
0649: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0650: elem.remove();
0651: }-*/;
0652:
0653: /**
0654: * Removes all previous added listeners from this element.
0655: */
0656: public native void removeAllListeners()/*-{
0657: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0658: elem.removeAllListeners();
0659: }-*/;
0660:
0661: /**
0662: * Removes the CSS classes from the element.
0663: *
0664: * @param className the CSS class to remove
0665: * @return this
0666: */
0667: public native BaseElement removeClass(String className)/*-{
0668: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0669: elem.removeClass(className);
0670: return this;
0671: }-*/;
0672:
0673: /**
0674: * Removes the CSS classes from the element.
0675: *
0676: * @param classNames the CSS classes to remove
0677: * @return this
0678: */
0679: public native BaseElement removeClass(String[] classNames)/*-{
0680: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0681: var classNamesJS = @com.gwtext.client.util.JavaScriptObjectHelper::convertToJavaScriptArray([Ljava/lang/Object;)(classNames);
0682: elem.removeClass(classNamesJS);
0683: return this;
0684: }-*/;
0685:
0686: /**
0687: * Forces the browser to repaint this element.
0688: *
0689: * @return this
0690: */
0691: public native BaseElement repaint()/*-{
0692: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0693: elem.repaint();
0694: return this;
0695: }-*/;
0696:
0697: /**
0698: * Replaces a CSS class on the element with another. If the old name does not exist, the new name will simply be added.
0699: *
0700: * @param oldClassName the CSS class to replace
0701: * @param newClassName the replacement CSS class
0702: * @return this
0703: */
0704: public native BaseElement replaceClass(String oldClassName,
0705: String newClassName)/*-{
0706: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0707: elem.replaceClass(oldClassName, newClassName);
0708: return this;
0709: }-*/;
0710:
0711: /**
0712: * Scrolls this element the specified direction. Does bounds checking to make sure the scroll is within this element's scrollable range.
0713: *
0714: * @param direction the direction
0715: * @param distance how far to scroll the element in pixels
0716: * @param animate true to animate
0717: * @return this
0718: */
0719: public native boolean scroll(Direction direction, int distance,
0720: boolean animate)/*-{
0721: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0722: var directionJS = direction.@com.gwtext.client.core.Direction::getDirection()();
0723: return elem.scroll(directionJS, distance, animate);
0724: }-*/;
0725:
0726: /**
0727: * Scrolls this element the specified direction. Does bounds checking to make sure the scroll is within this element's scrollable range.
0728: *
0729: * @param direction the direction
0730: * @param distance how far to scroll the element in pixels
0731: * @param animateConfig the animation config
0732: * @return this
0733: */
0734: public native boolean scroll(Direction direction, int distance,
0735: AnimationConfig animateConfig)/*-{
0736: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0737: var animateConfigJS = animateConfig.@com.gwtext.client.core.JsObject::getJsObj()();
0738: var directionJS = direction.@com.gwtext.client.core.Direction::getDirection()();
0739: return elem.scroll(directionJS, distance, animateConfigJS);
0740: }-*/;
0741:
0742: /**
0743: * Scrolls this element the specified scroll point. It does NOT do bounds checking so if you scroll to a weird value it will try to do it. For auto bounds checking, use scroll().
0744: *
0745: * @param side Either "left" for scrollLeft values or "top" for scrollTop values.
0746: * @param value the new scroll value
0747: * @param animate true for the default animation
0748: * @return this
0749: */
0750: public native BaseElement scrollTo(String side, int value,
0751: boolean animate)/*-{
0752: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0753: elem.scrollTo(side, value, animate);
0754: return this;
0755: }-*/;
0756:
0757: /**
0758: * Scrolls this element the specified scroll point. It does NOT do bounds checking so if you scroll to a weird value it will try to do it. For auto bounds checking, use scroll().
0759: *
0760: * @param side Either "left" for scrollLeft values or "top" for scrollTop values.
0761: * @param value the new scroll value
0762: * @param animateConfig the animation config
0763: * @return this
0764: */
0765: public native BaseElement scrollTo(String side, int value,
0766: AnimationConfig animateConfig)/*-{
0767: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0768: var animateConfigJS = animateConfig.@com.gwtext.client.core.JsObject::getJsObj()();
0769: elem.scrollTo(side, value, animateConfigJS);
0770: return this;
0771: }-*/;
0772:
0773: /**
0774: * Sets the element's CSS bottom style.
0775: *
0776: * @param bottom the bottom CSS property value
0777: * @return this
0778: */
0779: public native BaseElement setBottom(String bottom)/*-{
0780: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0781: elem.setBottom(bottom);
0782: return this;
0783: }-*/;
0784:
0785: /**
0786: * Sets the element's position and size in one shot.
0787: *
0788: * @param x X value for new position (coordinates are page-based)
0789: * @param y Y value for new position (coordinates are page-based)
0790: * @param width the new width
0791: * @param height the new height
0792: * @return this
0793: */
0794: public native BaseElement setBounds(int x, int y, int width,
0795: int height)/*-{
0796: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0797: elem.setBounds(x, y, width, height);
0798: return this;
0799: }-*/;
0800:
0801: /**
0802: * Sets the element's position and size in one shot. If animation is true then width, height, x and y will be animated concurrently.
0803: *
0804: * @param x X value for new position (coordinates are page-based)
0805: * @param y Y value for new position (coordinates are page-based)
0806: * @param width the new width
0807: * @param height the new height
0808: * @param animate true to animate
0809: * @return this
0810: */
0811: public native BaseElement setBounds(int x, int y, int width,
0812: int height, boolean animate)/*-{
0813: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0814: elem.setBounds(x, y, width, height, animate);
0815: return this;
0816: }-*/;
0817:
0818: /**
0819: * Sets the element's position and size in one shot. If animation is true then width, height, x and y will be animated concurrently.
0820: *
0821: * @param x X value for new position (coordinates are page-based)
0822: * @param y Y value for new position (coordinates are page-based)
0823: * @param width the new width
0824: * @param height the new height
0825: * @param animateConfig the animation config
0826: * @return this
0827: */
0828: public native BaseElement setBounds(int x, int y, int width,
0829: int height, AnimationConfig animateConfig)/*-{
0830: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0831: var animateConfigJS = animateConfig.@com.gwtext.client.core.JsObject::getJsObj()();
0832: elem.setBounds(x, y, width, height, animateConfigJS);
0833: return this;
0834: }-*/;
0835:
0836: /**
0837: * Sets the element's box. Use getBox() on another element to get a box obj.
0838: *
0839: * @param box the box to fill {x, y, width, height}
0840: * @return this
0841: */
0842: public native BaseElement setBox(Box box)/*-{
0843: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0844: var boxJS = box.@com.gwtext.client.core.JsObject::getJsObj()();
0845: elem.setBox(boxJS);
0846: return this;
0847: }-*/;
0848:
0849: /**
0850: * Sets the element's box. Use getBox() on another element to get a box obj. If animate is true then width, height, x and y will be animated concurrently.
0851: *
0852: * @param box the box to fill {x, y, width, height}
0853: * @param adjust Whether to adjust for box-model issues automatically
0854: * @param animate true for the default animation
0855: * @return this
0856: */
0857: public native BaseElement setBox(Box box, boolean adjust,
0858: boolean animate)/*-{
0859: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0860: var boxJS = box.@com.gwtext.client.core.JsObject::getJsObj()();
0861: elem.setBox(boxJS, adjust, animate);
0862: return this;
0863: }-*/;
0864:
0865: /**
0866: * Sets the element's box. Use getBox() on another element to get a box obj. If animate is true then width, height, x and y will be animated concurrently.
0867: *
0868: * @param box the box to fill {x, y, width, height}
0869: * @param adjust Whether to adjust for box-model issues automatically
0870: * @param animateConfig the animation config
0871: * @return this
0872: */
0873: public native BaseElement setBox(Box box, boolean adjust,
0874: AnimationConfig animateConfig)/*-{
0875: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0876: var boxJS = box.@com.gwtext.client.core.JsObject::getJsObj()();
0877: var animateConfigJS = animateConfig.@com.gwtext.client.core.JsObject::getJsObj()();
0878: elem.setBox(boxJS, adjust, animateConfigJS);
0879: return this;
0880: }-*/;
0881:
0882: /**
0883: * Sets the CSS display property. Uses originalDisplay if the specified value is a boolean true.
0884: *
0885: * @param value Boolean value to display the element using its default display
0886: * @return this
0887: */
0888: public native BaseElement setDisplayed(boolean value)/*-{
0889: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0890: elem.setDisplayed(value);
0891: return this;
0892: }-*/;
0893:
0894: /**
0895: * Set the height of the element.
0896: *
0897: * @param height the new height
0898: * @param animate true to animate
0899: * @return this
0900: */
0901: public native BaseElement setHeight(int height, boolean animate)/*-{
0902: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0903: elem.setHeight(height, animate);
0904: return this;
0905: }-*/;
0906:
0907: /**
0908: * Set the height of the element.
0909: *
0910: * @param height the new height
0911: * @param animateConfig the animation config
0912: * @return this
0913: */
0914: public native BaseElement setHeight(int height,
0915: AnimationConfig animateConfig)/*-{
0916: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0917: var animateConfigJS = animateConfig.@com.gwtext.client.core.JsObject::getJsObj()();
0918: elem.setHeight(height, animateConfigJS);
0919: return this;
0920: }-*/;
0921:
0922: /**
0923: * Sets the element's left position directly using CSS style (instead of setX).
0924: *
0925: * @param left the left CSS property value
0926: * @return this
0927: */
0928: public native BaseElement setLeft(String left)/*-{
0929: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0930: elem.setLeft(left);
0931: return this;
0932: }-*/;
0933:
0934: /**
0935: * Quick set left and top adding default units.
0936: *
0937: * @param left the left CSS property value
0938: * @param top the top CSS property value
0939: * @return this
0940: */
0941: public native BaseElement setLeftTop(String left, String top)/*-{
0942: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0943: elem.setLeft(left);
0944: return this;
0945: }-*/;
0946:
0947: /**
0948: * Sets the position of the element in page coordinates, regardless of how the element is positioned. the element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
0949: *
0950: * @param x X value for new position (coordinates are page-based)
0951: * @param y Y value for new position (coordinates are page-based)
0952: * @param animate true to animate
0953: * @return this
0954: */
0955: public native BaseElement setLocation(int x, int y, boolean animate)/*-{
0956: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0957: elem.setLocation(x, y, animate);
0958: return this;
0959: }-*/;
0960:
0961: /**
0962: * Sets the position of the element in page coordinates, regardless of how the element is positioned. the element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
0963: *
0964: * @param x X value for new position (coordinates are page-based)
0965: * @param y Y value for new position (coordinates are page-based)
0966: * @param animateConfig the animation config
0967: * @return this
0968: */
0969: public native BaseElement setLocation(int x, int y,
0970: AnimationConfig animateConfig)/*-{
0971: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0972: var animateConfigJS = animateConfig.@com.gwtext.client.core.JsObject::getJsObj()();
0973: elem.setLocation(x, y, animateConfigJS);
0974: return this;
0975: }-*/;
0976:
0977: /**
0978: * Set the opacity of the element.
0979: *
0980: * @param opacity the new opacity. 0 = transparent, .5 = 50% visibile, 1 = fully visible, etc
0981: * @param animate true to animate
0982: * @return this
0983: */
0984: public native BaseElement setOpacity(float opacity, boolean animate)/*-{
0985: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
0986: elem.setOpacity(opacity, animate);
0987: return this;
0988: }-*/;
0989:
0990: /**
0991: * Set the opacity of the element.
0992: *
0993: * @param opacity the new opacity. 0 = transparent, .5 = 50% visibile, 1 = fully visible, etc
0994: * @param animateConfig the animation config
0995: * @return this
0996: */
0997: public native BaseElement setOpacity(float opacity,
0998: AnimationConfig animateConfig)/*-{
0999: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1000: var animateConfigJS = animateConfig.@com.gwtext.client.core.JsObject::getJsObj()();
1001: elem.setOpacity(opacity, animateConfigJS);
1002: return this;
1003: }-*/;
1004:
1005: /**
1006: * Sets the element's position and size the the specified region. If animation is true then width, height, x and y will be animated concurrently.
1007: *
1008: * @param region the region to fill
1009: * @param animate true to animate
1010: * @return this
1011: */
1012: public native BaseElement setRegion(Region region, boolean animate)/*-{
1013: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1014: var regionJS = region.@com.gwtext.client.core.JsObject::getJsObj()();
1015: elem.setRegion(regionJS, animate);
1016: return this;
1017: }-*/;
1018:
1019: /**
1020: * Sets the element's position and size the the specified region. If animation is true then width, height, x and y will be animated concurrently.
1021: *
1022: * @param region the region to fill
1023: * @param animateConfig the animation config
1024: * @return this
1025: */
1026: public native BaseElement setRegion(Region region,
1027: AnimationConfig animateConfig)/*-{
1028: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1029: var regionJS = region.@com.gwtext.client.core.JsObject::getJsObj()();
1030: var animateConfigJS = animateConfig.@com.gwtext.client.core.JsObject::getJsObj()();
1031: elem.setRegion(regionJS, animateConfigJS);
1032: return this;
1033: }-*/;
1034:
1035: /**
1036: * Sets the element's CSS right style.
1037: *
1038: * @param right the right CSS property value
1039: * @return this
1040: */
1041: public native BaseElement setRight(String right)/*-{
1042: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1043: elem.setRight(right);
1044: return this;
1045: }-*/;
1046:
1047: /**
1048: * Set the size of the element. If animation is true, both width an height will be animated concurrently.
1049: *
1050: * @param width the new width
1051: * @param height the new height
1052: * @param animate true to animate
1053: * @return this
1054: */
1055: public native BaseElement setSize(int width, int height,
1056: boolean animate)/*-{
1057: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1058: elem.setSize(width, height, animate);
1059: return this;
1060: }-*/;
1061:
1062: /**
1063: * Set the size of the element. If animation is true, both width an height will be animated concurrently.
1064: *
1065: * @param width the new width
1066: * @param height the new height
1067: * @param animateConfig the animation config
1068: * @return this
1069: */
1070: public native BaseElement setSize(int width, int height,
1071: AnimationConfig animateConfig)/*-{
1072: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1073: var animateConfigJS = animateConfig.@com.gwtext.client.core.JsObject::getJsObj()();
1074: elem.setSize(width, height, animateConfigJS);
1075: return this;
1076: }-*/;
1077:
1078: /**
1079: * Wrapper for setting style properties.
1080: *
1081: * @param style the style property to be set
1082: * @param value the value to apply to the given property
1083: * @return this
1084: */
1085: public native BaseElement setStyle(String style, String value)/*-{
1086: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1087: elem.setStyle(style, value);
1088: return this;
1089: }-*/;
1090:
1091: /**
1092: * Wrapper for setting style properties.
1093: *
1094: * @param styles the style property to be set
1095: * @return this
1096: */
1097: public native BaseElement setStyles(GenericConfig styles)/*-{
1098: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1099: var stylesJS = styles.@com.gwtext.client.core.JsObject::getJsObj()();
1100: elem.setStyle(stylesJS);
1101: return this;
1102: }-*/;
1103:
1104: /**
1105: * Sets the element's top position directly using CSS style (instead of setY).
1106: *
1107: * @param top the top CSS property value
1108: * @return this
1109: */
1110: public native BaseElement setTop(String top)/*-{
1111: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1112: elem.setTop(top);
1113: return this;
1114: }-*/;
1115:
1116: /**
1117: * Sets the element's visibility mode. When setVisible() is called it will use this to determine whether to set the visibility or the display property.
1118: *
1119: * @param useVisibleProperty true to use VISIBILITY, false for DISPLAY
1120: * @return this
1121: */
1122: public native BaseElement setVisibilityMode(
1123: boolean useVisibleProperty)/*-{
1124: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1125: elem.setVisibilityMode(useVisibleProperty ? $wnd.Ext.Element.VISIBILITY: $wnd.Ext.Element.DISPLAY);
1126: return this;
1127: }-*/;
1128:
1129: /**
1130: * Sets the visibility of the element. If the visibilityMode is set to Element.DISPLAY, it will use the display
1131: * property to hide the element, otherwise it uses visibility. the default is to hide and show using the visibility property.
1132: *
1133: * @param visible Whether the element is visible
1134: * @return this
1135: */
1136: public BaseElement setVisible(boolean visible) {
1137: setVisible(visible, false);
1138: return this ;
1139: }
1140:
1141: /**
1142: * Sets the visibility of the element. If the visibilityMode is set to Element.DISPLAY, it will use the display
1143: * property to hide the element, otherwise it uses visibility. the default is to hide and show using the visibility property.
1144: *
1145: * @param visible Whether the element is visible
1146: * @param animate true to animate
1147: * @return this
1148: */
1149: public native BaseElement setVisible(boolean visible,
1150: boolean animate)/*-{
1151: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1152: elem.setVisible(visible, animate);
1153: return this;
1154: }-*/;
1155:
1156: /**
1157: * Sets the visibility of the element. If the visibilityMode is set to Element.DISPLAY, it will use the display
1158: * property to hide the element, otherwise it uses visibility. the default is to hide and show using the visibility property.
1159: *
1160: * @param visible Whether the element is visible
1161: * @param animateConfig the animation config
1162: * @return this
1163: */
1164: public native BaseElement setVisible(boolean visible,
1165: AnimationConfig animateConfig)/*-{
1166: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1167: var animateConfigJS = animateConfig.@com.gwtext.client.core.JsObject::getJsObj()();
1168: elem.setVisible(visible, animateConfigJS);
1169: return this;
1170: }-*/;
1171:
1172: /**
1173: * Set the width of the element.
1174: *
1175: * @param width the new width
1176: * @param animate true to animate
1177: * @return this
1178: */
1179: public native BaseElement setWidth(int width, boolean animate)/*-{
1180: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1181: elem.setWidth(width, animate);
1182: return this;
1183: }-*/;
1184:
1185: /**
1186: * Set the width of the element.
1187: *
1188: * @param width the new width
1189: * @param animate true to animate
1190: * @return this
1191: */
1192: public native BaseElement setWidth(String width, boolean animate)/*-{
1193: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1194: elem.setWidth(width, animate);
1195: return this;
1196: }-*/;
1197:
1198: /**
1199: * Set the width of the element.
1200: *
1201: * @param width the new width
1202: * @param animateConfig the animation config
1203: * @return this
1204: */
1205: public native BaseElement setWidth(int width,
1206: AnimationConfig animateConfig)/*-{
1207: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1208: var animateConfigJS = animateConfig.@com.gwtext.client.core.JsObject::getJsObj()();
1209: elem.setWidth(width, animateConfigJS);
1210: return this;
1211: }-*/;
1212:
1213: /**
1214: * Sets the X position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
1215: *
1216: * @param x X position of the element
1217: * @param animate true to animate
1218: * @return this
1219: */
1220: public native BaseElement setX(int x, boolean animate)/*-{
1221: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1222: elem.setX(x, animate);
1223: return this;
1224: }-*/;
1225:
1226: /**
1227: * Sets the X position of the element based on page coordinates. Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
1228: *
1229: * @param x X position of the element
1230: * @param animateConfig the animation config
1231: * @return this
1232: */
1233: public native BaseElement setX(int x, AnimationConfig animateConfig)/*-{
1234: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1235: var animateConfigJS = animateConfig.@com.gwtext.client.core.JsObject::getJsObj()();
1236: elem.setX(x, animateConfigJS);
1237: return this;
1238: }-*/;
1239:
1240: /**
1241: * Sets the position of the element in page coordinates, regardless of how the element is positioned. the element must be part of the DOM tree to have page coordinates
1242: * (display:none or elements not appended return false).
1243: *
1244: * @param x X position of the element
1245: * @param y Y position of the element
1246: * @param animate true to animate
1247: * @return this
1248: */
1249: public native BaseElement setXY(int x, int y, boolean animate)/*-{
1250: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1251: elem.setXY([x, y], animate);
1252: return this;
1253: }-*/;
1254:
1255: /**
1256: * Sets the position of the element in page coordinates, regardless of how the element is positioned. the element must be part of the DOM tree to have page coordinates
1257: * (display:none or elements not appended return false).
1258: *
1259: * @param x X position of the element
1260: * @param y Y position of the element
1261: * @param animateConfig the animation config
1262: * @return this
1263: */
1264: public native BaseElement setXY(int x, int y,
1265: AnimationConfig animateConfig)/*-{
1266: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1267: var animateConfigJS = animateConfig.@com.gwtext.client.core.JsObject::getJsObj()();
1268: elem.setXY([x, y], animateConfigJS);
1269: return this;
1270: }-*/;
1271:
1272: /**
1273: * Sets the Y position of the element based on page coordinates. Element must be part of the DOM tree to have page
1274: * coordinates (display:none or elements not appended return false).
1275: *
1276: * @param y Y position of the element
1277: * @param animate true to animate
1278: * @return this
1279: */
1280: public native BaseElement setY(int y, boolean animate)/*-{
1281: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1282: elem.setY(y, animate);
1283: return this;
1284: }-*/;
1285:
1286: /**
1287: * Sets the Y position of the element based on page coordinates. Element must be part of the DOM tree to have page
1288: * coordinates (display:none or elements not appended return false).
1289: *
1290: * @param y Y position of the element
1291: * @param animateConfig the animation config
1292: * @return this
1293: */
1294: public native BaseElement setY(int y, AnimationConfig animateConfig)/*-{
1295: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1296: var animateConfigJS = animateConfig.@com.gwtext.client.core.JsObject::getJsObj()();
1297: elem.setY(y, animateConfigJS);
1298: return this;
1299: }-*/;
1300:
1301: /**
1302: * Show this element - Uses display mode to determine whether to use "display" or "visibility". See {@link #setVisible}.
1303: *
1304: * @param animate true to animate
1305: * @return this
1306: */
1307: public native BaseElement show(boolean animate)/*-{
1308: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1309: elem.show(animate);
1310: return this;
1311: }-*/;
1312:
1313: /**
1314: * Show this element - Uses display mode to determine whether to use "display" or "visibility". See {@link #setVisible}.
1315: *
1316: * @param animateConfig the animation config
1317: * @return this
1318: */
1319: public native BaseElement show(AnimationConfig animateConfig)/*-{
1320: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1321: var animateConfigJS = animateConfig.@com.gwtext.client.core.JsObject::getJsObj()();
1322: elem.show(animateConfigJS);
1323: return this;
1324: }-*/;
1325:
1326: /**
1327: * Stops the specified event from bubbling and optionally prevents the default action.
1328: *
1329: * @param eventName the event name
1330: * @return this
1331: */
1332: public native BaseElement swallowEvent(String eventName)/*-{
1333: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1334: elem.swallowEvent(eventName);
1335: return this;
1336: }-*/;
1337:
1338: /**
1339: * Stops the specified event from bubbling and optionally prevents the default action.
1340: *
1341: * @param eventName the event name
1342: * @param preventDefault true to prevent the default action too
1343: * @return this
1344: */
1345: public native BaseElement swallowEvent(String eventName,
1346: boolean preventDefault)/*-{
1347: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1348: elem.swallowEvent(eventName, preventDefault);
1349: return this;
1350: }-*/;
1351:
1352: /**
1353: * Toggles the element's visibility or display, depending on visibility mode.
1354: *
1355: * @param animate true to animate
1356: * @return this
1357: */
1358: public native BaseElement toggle(boolean animate)/*-{
1359: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1360: elem.toggle(animate);
1361: return this;
1362: }-*/;
1363:
1364: /**
1365: * Toggles the element's visibility or display, depending on visibility mode.
1366: *
1367: * @param animateConfig the animation config
1368: * @return this
1369: */
1370: public native BaseElement toggle(AnimationConfig animateConfig)/*-{
1371: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1372: var animateConfigJS = animateConfig.@com.gwtext.client.core.JsObject::getJsObj()();
1373: elem.toggle(animateConfigJS);
1374: return this;
1375: }-*/;
1376:
1377: /**
1378: * Toggles the specified CSS class on this element (removes it if it already exists, otherwise adds it).
1379: *
1380: * @param className the CSS class to toggle
1381: * @return this
1382: */
1383: public native BaseElement toggleClass(String className)/*-{
1384: var elem = this.@com.gwtext.client.core.JsObject::getJsObj()();
1385: elem.toggleClass(className);
1386: return this;
1387: }-*/;
1388:
1389: /**
1390: * Disables text selection for this element (normalized across browsers).
1391: */
1392: public native void unselectable() /*-{
1393: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1394: el.unselectable();
1395: }-*/;
1396:
1397: /**
1398: * Update the innerHTML of this element.
1399: *
1400: * @param html the new HTML
1401: */
1402: public void update(String html) {
1403: update(html, false);
1404: }
1405:
1406: /**
1407: * Update the innerHTML of this element, optionally searching for and processing scripts.
1408: *
1409: * @param html the new HTML
1410: * @param loadScripts true to look for and process scripts
1411: */
1412: public native void update(String html, boolean loadScripts) /*-{
1413: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1414: el.update(html, loadScripts);
1415: }-*/;
1416:
1417: /**
1418: * Creates and wraps this element with another element.
1419: *
1420: * @param config DomHelper element config object for the wrapper element
1421: * @return this
1422: */
1423: public native Element wrap(DomConfig config) /*-{
1424: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1425: var configJS = config.@com.gwtext.client.core.DomConfig::getJsObject()();
1426: return el.wrap(configJS, true);
1427: }-*/;
1428:
1429: //Ext Fx API's
1430: public native Fx fadeIn() /*-{
1431: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1432: el.fadeIn();
1433: return this;
1434: }-*/;
1435:
1436: public native Fx fadeIn(FxConfig config) /*-{
1437: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1438: var configJS = config.@com.gwtext.client.core.JsObject::getJsObj()();
1439: el.fadeIn(configJS);
1440: return this;
1441: }-*/;
1442:
1443: public native Fx fadeOut() /*-{
1444: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1445: el.fadeOut();
1446: return this;
1447: }-*/;
1448:
1449: public native Fx fadeOut(FxConfig config) /*-{
1450: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1451: var configJS = config.@com.gwtext.client.core.JsObject::getJsObj()();
1452: el.fadeOut(configJS);
1453: return this;
1454: }-*/;
1455:
1456: public native Fx frame() /*-{
1457: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1458: el.frame();
1459: return this;
1460: }-*/;
1461:
1462: public native Fx frame(String color, int count, FxConfig config) /*-{
1463: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1464: var configJS = config.@com.gwtext.client.core.JsObject::getJsObj()();
1465: el.frame(color, count, configJS);
1466: return this;
1467: }-*/;
1468:
1469: public native Fx ghost() /*-{
1470: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1471: el.ghost();
1472: return this;
1473: }-*/;
1474:
1475: public native Fx ghost(String anchorPosition, FxConfig config) /*-{
1476: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1477: var configJS = config.@com.gwtext.client.core.JsObject::getJsObj()();
1478: el.ghost(anchorPosition, configJS);
1479: return this;
1480: }-*/;
1481:
1482: public native boolean hasActiveFx() /*-{
1483: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1484: return el.hasActiveFx();
1485: }-*/;
1486:
1487: public native boolean hasFxBlock() /*-{
1488: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1489: return el.hasFxBlock();
1490: }-*/;
1491:
1492: public native Fx highlight() /*-{
1493: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1494: el.highlight();
1495: return this;
1496: }-*/;
1497:
1498: public native Fx highlight(String color, FxConfig config) /*-{
1499: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1500: var configJS = config.@com.gwtext.client.core.JsObject::getJsObj()();
1501: el.highlight(color, configJS);
1502: return this;
1503: }-*/;
1504:
1505: public native Fx highlight(String color, String attr,
1506: String endColor, FxConfig config) /*-{
1507: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1508: var configJS = config.@com.gwtext.client.core.JsObject::getJsObj()();
1509: if(attr != null) {
1510: configJS['attr'] = attr;
1511: }
1512: if(endColor != null) {
1513: configJS['endColor'] = endColor;
1514: }
1515: el.highlight(color, configJS);
1516: return this;
1517: }-*/;
1518:
1519: public native Fx pause(int seconds) /*-{
1520: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1521: el.pause(seconds);
1522: return this;
1523: }-*/;
1524:
1525: public native Fx puff() /*-{
1526: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1527: el.puff();
1528: return this;
1529: }-*/;
1530:
1531: public native Fx puff(boolean remove, FxConfig config) /*-{
1532: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1533: var configJS = config.@com.gwtext.client.core.JsObject::getJsObj()();
1534: configJS['remove'] = remove;
1535: el.puff(configJS);
1536: return this;
1537: }-*/;
1538:
1539: public native Fx scale(int width, int height) /*-{
1540: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1541: el.scale(width <=0 ? null : width, height <= 0 ? null : height);
1542: return this;
1543: }-*/;
1544:
1545: public native Fx scale(int width, int height, FxConfig config) /*-{
1546: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1547: var configJS = config.@com.gwtext.client.core.JsObject::getJsObj()();
1548: el.scale(width <=0 ? null : width, height <= 0 ? null : height, configJS);
1549: return this;
1550: }-*/;
1551:
1552: public native Fx sequenceFx() /*-{
1553: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1554: el.sequenceFx();
1555: return this;
1556: }-*/;
1557:
1558: public native Fx shift(int x, int y, int width, int height,
1559: FxConfig config) /*-{
1560: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1561: var configJS = config.@com.gwtext.client.core.JsObject::getJsObj()();
1562: if(x > 0) configJS['x'] = x;
1563: if(y > 0) configJS['y'] = y;
1564: if(width > 0) configJS['width'] = width;
1565: if(height > 0) configJS['height'] = height;
1566: el.shift(configJS);
1567: return this;
1568: }-*/;
1569:
1570: public native Fx slideIn() /*-{
1571: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1572: el.slideIn();
1573: return this;
1574: }-*/;
1575:
1576: public native Fx slideIn(String anchorPosition, FxConfig config) /*-{
1577: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1578: var configJS = config.@com.gwtext.client.core.JsObject::getJsObj()();
1579: el.slideIn(anchorPosition, configJS);
1580: return this;
1581: }-*/;
1582:
1583: public native Fx slideOut() /*-{
1584: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1585: el.slideOut();
1586: return this;
1587: }-*/;
1588:
1589: public native Fx slideOut(boolean remove, String anchorPosition,
1590: FxConfig config) /*-{
1591: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1592: var configJS = config.@com.gwtext.client.core.JsObject::getJsObj()();
1593: configJS['remove'] = remove;
1594: el.slideOut(anchorPosition, configJS);
1595: return this;
1596: }-*/;
1597:
1598: public native Fx stopFx() /*-{
1599: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1600: el.stopFx();
1601: return this;
1602: }-*/;
1603:
1604: public native Fx switchOff() /*-{
1605: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1606: el.switchOff();
1607: return this;
1608: }-*/;
1609:
1610: public native Fx switchOff(boolean remove, FxConfig config) /*-{
1611: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1612: var configJS = config.@com.gwtext.client.core.JsObject::getJsObj()();
1613: configJS['remove'] = remove;
1614: el.switchOff(configJS);
1615: return this;
1616: }-*/;
1617:
1618: public native Fx syncFx() /*-{
1619: var el = this.@com.gwtext.client.core.JsObject::getJsObj()();
1620: el.syncFx();
1621: return this;
1622: }-*/;
1623: }
|