public GQuery fadeIn(int millisecs, Function... f) {
return as(Effects).fadeIn(millisecs, f);
}
+
+ /**
+ * Fade the opacity of all matched elements to a specified opacity and firing
+ * an optional callback after completion. Only the opacity is adjusted for
+ * this animation, meaning that all of the matched elements should already
+ * have some form of height and width associated with them.
+ */
+ public GQuery fadeTo(int millisecs, double opacity, Function... f) {
+ return as(Effects).fadeTo(millisecs, opacity, f);
+ }
+
+ /**
+ * Fade the opacity of all matched elements to a specified opacity and firing
+ * an optional callback after completion. Only the opacity is adjusted for
+ * this animation, meaning that all of the matched elements should already
+ * have some form of height and width associated with them.
+ */
+ public GQuery fadeTo(double opacity, Function... f) {
+ return as(Effects).fadeTo(opacity, f);
+ }
/**
* Fade out all matched elements by adjusting their opacity. The effect will take 1000
return this;
}
+ /**
+ * Remove a property for the set of matched elements.
+ */
+ public GQuery removeProp(String name) {
+ for (Element e : elements) {
+ e.<JsCache>cast().delete(name);
+ }
+ return this;
+ }
+
/**
* Replaces the element <code>elem</code> by the specified selector with the matched elements.
* This function is the complement to replaceWith() which does the same task with the parameters
* the License.
*/
package com.google.gwt.query.client;
-import static com.google.gwt.query.client.plugins.QueuePlugin.Queue;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.Map;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.JsArrayMixed;
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwt.dom.client.BodyElement;
-import com.google.gwt.dom.client.ButtonElement;
-import com.google.gwt.dom.client.Document;
+
import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.InputElement;
import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.NodeList;
-import com.google.gwt.dom.client.OptionElement;
-import com.google.gwt.dom.client.SelectElement;
-import com.google.gwt.dom.client.Style.Display;
import com.google.gwt.dom.client.Style.HasCssName;
-import com.google.gwt.dom.client.TextAreaElement;
+import com.google.gwt.query.client.GQuery.Offset;
import com.google.gwt.query.client.css.CSS;
import com.google.gwt.query.client.css.HasCssValue;
import com.google.gwt.query.client.css.TakesCssValue;
import com.google.gwt.query.client.css.TakesCssValue.CssSetter;
-import com.google.gwt.query.client.impl.AttributeImpl;
-import com.google.gwt.query.client.impl.DocumentStyleImpl;
-import com.google.gwt.query.client.impl.SelectorEngine;
-import com.google.gwt.query.client.js.JsCache;
-import com.google.gwt.query.client.js.JsMap;
import com.google.gwt.query.client.js.JsNamedArray;
import com.google.gwt.query.client.js.JsNodeArray;
-import com.google.gwt.query.client.js.JsObjectArray;
-import com.google.gwt.query.client.js.JsRegexp;
-import com.google.gwt.query.client.js.JsUtils;
import com.google.gwt.query.client.plugins.Effects;
-import com.google.gwt.query.client.plugins.Events;
-import com.google.gwt.query.client.plugins.Plugin;
-import com.google.gwt.query.client.plugins.Widgets;
-import com.google.gwt.query.client.plugins.ajax.Ajax;
-import com.google.gwt.query.client.plugins.ajax.Ajax.Settings;
import com.google.gwt.query.client.plugins.effects.PropertiesAnimation.Easing;
-import com.google.gwt.query.client.plugins.events.EventsListener;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Event;
-import com.google.gwt.user.client.EventListener;
-import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Widget;
-import com.google.gwt.query.client.LazyBase;
public interface LazyGQuery<T> extends LazyBase<T>{
/**
*
- * The animate() method allows you to create animation effects on any numeric Attribute, CSS
- * property, or color CSS property.
+ * The animate() method allows you to create animation effects on any numeric HTML Attribute,
+ * CSS property, or color CSS property.
*
* Concerning to numeric properties, values are treated as a number of pixels unless otherwise
* specified. The units em and % can be specified where applicable.
*
* By default animate considers css properties, if you wanted to animate element attributes you
- * should to prepend the symbol dollar to the attribute name.
+ * should to prepend the symbol dollar to the attribute name. It's useful to animate svg elements.
+ *
+ * NOTE: The ability of animating attribute values is only available in gquery but not jquery
+ *
*
* Example:
*
* <pre class="code">
- * //move the element from its original position to left:500px for 500ms
+ * //move the element from its original position to left:500px
* $("#foo").animate("left:'500'");
- * // Change the width attribute of a table
- * $("table").animate("$width:'500'"), 400, Easing.LINEAR);
+ *
+ * // Change the width html attribute of a table, note the symbol '$' to
+ * // tell gquery which it is an html-attribute instead of a css-property.
+ * $("table").animate("$width:'500'");
* </pre>
*
* In addition to numeric values, each property can take the strings 'show', 'hide', and 'toggle'.
* <pre class="code">
* //move the element from its original position to 500px to the left for 500ms and
* // change the background color of the element at the end of the animation
+ *
* $("#foo").animate("left:'+=500'", new Function(){
- *
* public void f(Element e){
* $(e).css(CSS.BACKGROUND_COLOR.with(RGBColor.RED);
* }
- *
* });
* </pre>
*
- * The duration of the animation is 500ms.
+ * The default duration of the animation is 500ms.
*
* For color css properties, values can be specified via hexadecimal or rgb or literal values.
*
* $("#foo").animate("backgroundColor:'red', color:'#ffffff', borderColor:'rgb(129, 0, 70)'");
* </pre>
*
- * @param prop the property to animate : "cssName:'value'"
+ * @param stringOrProperties the property to animate : "cssName:'value'"
* @param funcs an array of {@link Function} called once the animation is complete
*/
LazyGQuery<T> animate(Object stringOrProperties, Function... funcs);
/**
- * The animate() method allows you to create animation effects on any numeric Attribute, CSS
- * property, or color CSS property.
+ *
+ * The animate() method allows you to create animation effects on any numeric HTML Attribute,
+ * CSS property, or color CSS property.
*
* Concerning to numeric properties, values are treated as a number of pixels unless otherwise
* specified. The units em and % can be specified where applicable.
*
* By default animate considers css properties, if you wanted to animate element attributes you
- * should to prepend the symbol dollar to the attribute name.
+ * should to prepend the symbol dollar to the attribute name. It's useful to animate svg elements.
+ *
+ * NOTE: The ability of animating attribute values is only available in gquery but not jquery
+ *
*
* Example:
*
* <pre class="code">
- * //move the element from its original position to the position top:500px and left:500px for 400ms.
- * //use a swing easing function for the transition
- * $("#foo").animate(Properties.create("{top:'500px',left:'500px'}"), 400, Easing.SWING);
- * // Change the width and border attributes of a table
+ * //move the element from its original position to left:500px for 500ms using a swing easing
+ * $("#foo").animate("left:'500'", 500, Easing.SWING);
+ *
+ * // Change the width html attribute of a table, note the symbol '$' to
+ * // tell gquery which it is an html-attribute instead of a css-property.
+ * // the animation will last 400ms, and we use the LINEAR easing algorithm
* $("table").animate(Properties.create("{$width: '500', $border: '10'}"), 400, Easing.LINEAR);
* </pre>
*
LazyGQuery<T> animate(Object stringOrProperties, int duration, Easing easing, Function... funcs);
/**
- * The animate() method allows you to create animation effects on any numeric Attribute, CSS
- * properties, or color CSS property.
+ * The animate() method allows you to create animation effects on any numeric HTML Attribute,
+ * CSS property, or color CSS property.
*
- * Concerning to numeric property, values are treated as a number of pixels unless otherwise
+ * Concerning to numeric properties, values are treated as a number of pixels unless otherwise
* specified. The units em and % can be specified where applicable.
*
* By default animate considers css properties, if you wanted to animate element attributes you
- * should to prepend the symbol dollar to the attribute name.
+ * should to prepend the symbol dollar to the attribute name. It's useful to animate svg elements.
+ *
+ * NOTE: The ability of animating attribute values is only available in gquery but not jquery
+ *
*
* Example:
*
* <pre class="code">
- * //move the element from its original position to left:500px for 2s
- * $("#foo").animate("left:'500px'", 2000);
- * // Change the width attribute of a table
+ * //move the element from its original position to left:500px for 500ms
+ * $("#foo").animate("left:'500'", 500);
+ *
+ * // Change the width html attribute of a table, note the symbol '$' to
+ * // tell gquery which it is an html-attribute instead of a css-property.
+ * // the animation will last 400ms
* $("table").animate("$width:'500'"), 400);
* </pre>
*
*/
LazyGQuery<T> fadeIn(int millisecs, Function... f);
+ /**
+ * Fade the opacity of all matched elements to a specified opacity and firing
+ * an optional callback after completion. Only the opacity is adjusted for
+ * this animation, meaning that all of the matched elements should already
+ * have some form of height and width associated with them.
+ */
+ LazyGQuery<T> fadeTo(int millisecs, double opacity, Function... f);
+
+ /**
+ * Fade the opacity of all matched elements to a specified opacity and firing
+ * an optional callback after completion. Only the opacity is adjusted for
+ * this animation, meaning that all of the matched elements should already
+ * have some form of height and width associated with them.
+ */
+ LazyGQuery<T> fadeTo(double opacity, Function... f);
+
/**
* Fade out all matched elements by adjusting their opacity. The effect will take 1000
* milliseconds to complete
* returned object contains two integer properties, top and left. The method works only with
* visible elements.
*/
- com.google.gwt.query.client.GQuery.Offset offset();
+ Offset offset();
+
+ /**
+ * Set the current coordinates of every element in the set of matched elements, relative to the document.
+ */
+ LazyGQuery<T> offset(Offset offset);
+
+ /**
+ * Set the current coordinates of every element in the set of matched elements, relative to the document.
+ */
+ LazyGQuery<T> offset(int top, int left);
/**
* Returns a GQuery collection with the positioned parent of the first matched element. This is
* contains two Integer properties, top and left. For accurate calculations make sure to use pixel
* values for margins, borders and padding. This method only works with visible elements.
*/
- com.google.gwt.query.client.GQuery.Offset position();
+ Offset position();
/**
* Prepend content to the inside of every matched element. This operation is the best way to
*/
LazyGQuery<T> removeData(String name);
+ /**
+ * Remove a property for the set of matched elements.
+ */
+ LazyGQuery<T> removeProp(String name);
+
/**
* Replaces the element <code>elem</code> by the specified selector with the matched elements.
* This function is the complement to replaceWith() which does the same task with the parameters
public final native <T> JsArrayMixed getArray(T id) /*-{
var r = this[id];
- if (r && Object.prototype.toString.call(r) == '[object Array]') {
+ if (r && @com.google.gwt.query.client.js.JsUtils::isArray(*)(r)) {
return r;
}
return null;
return this.indexOf(o);
}-*/;
- public final native <T> void putBoolean(T id, boolean b) /*-{
+ public final native <T> JsCache putBoolean(T id, boolean b) /*-{
this[id] = b;
+ return this;
}-*/;
- public final native <T> void putNumber(T id, double n) /*-{
+ public final native <T> JsCache putNumber(T id, double n) /*-{
this[id] = n;
+ return this;
}-*/;
- public final native <T, O> void put(T id, O obj) /*-{
+ public final native <T, O> JsCache put(T id, O obj) /*-{
this[id] = obj;
+ return this;
}-*/;
public final native int length() /*-{
public Effects fadeOut(int millisecs, Function... f) {
return animate("opacity: 'hide'", millisecs, f);
};
-
+
+ /**
+ * Fade the opacity of all matched elements to a specified opacity and firing
+ * an optional callback after completion. Only the opacity is adjusted for
+ * this animation, meaning that all of the matched elements should already
+ * have some form of height and width associated with them.
+ */
+ public Effects fadeTo(double opacity, Function... f) {
+ return fadeTo(Speed.DEFAULT, opacity, f);
+ }
+
/**
* Fade the opacity of all matched elements to a specified opacity and firing
* an optional callback after completion. Only the opacity is adjusted for
*/
LazyEffects<T> fadeOut(int millisecs, Function... f);
+ /**
+ * Fade the opacity of all matched elements to a specified opacity and firing
+ * an optional callback after completion. Only the opacity is adjusted for
+ * this animation, meaning that all of the matched elements should already
+ * have some form of height and width associated with them.
+ */
+ LazyEffects<T> fadeTo(double opacity, Function... f);
+
/**
* Fade the opacity of all matched elements to a specified opacity and firing
* an optional callback after completion. Only the opacity is adjusted for
*/
LazyEvents<T> bind(String event, Object data, Function... funcs);
+ GQuery die(int eventbits, String nameSpace);
+
GQuery die(int eventbits);
/**
GQuery live(int eventbits, Object data, Function... funcs);
+ GQuery live(int eventbits, String nameSpace, Object data, Function... funcs);
+
GQuery live(String eventName, Object data, Function... funcs);
/**
import com.google.gwt.query.client.js.JsCache;
import com.google.gwt.query.client.js.JsUtils;
import com.google.gwt.query.client.plugins.Effects;
+import com.google.gwt.query.client.plugins.Events;
import com.google.gwt.query.client.plugins.effects.PropertiesAnimation;
import com.google.gwt.user.client.Event;
public interface PredicateOverlay extends ExportOverlay<Predicate> {
public boolean f(Element e, int i);
}
-
+
private GQueryOverlay(){}
/**
return Properties.create("left: " + o.left + ", top:" + o.top);
}
+ @ExportInstanceMethod
+ public static GQuery offset(GQuery instance, JsCache o) {
+ return instance.offset(new Offset(o.getInt("left"), o.getInt("top")));
+ }
+
+ @ExportInstanceMethod
+ public static Element[] toArray(GQuery g) {
+ return g.elements();
+ }
+
+ @ExportInstanceMethod
+ public static GQuery trigger(GQuery g, String name, Function f) {
+ g.as(Events.Events).triggerHtmlEvent(name, f);
+ return g;
+ }
+
@ExportInstanceMethod
public static GQuery unbind(GQuery g, String s, Function o) {
return g.unbind(s);
public abstract GQuery appendTo(GQuery other);
public abstract GQuery appendTo(Node n);
public abstract GQuery appendTo(String html);
- public abstract <T extends GQuery> T as(Class<T> plugin);
+// public abstract <T extends GQuery> T as(Class<T> plugin);
public abstract GQuery before(GQuery query);
public abstract GQuery before(Node n);
public abstract GQuery die(String eventName);
// public abstract GQuery die(int eventbits);
public abstract GQuery each(Function... f);
- public abstract Element[] elements();
+// public abstract Element[] elements();
public abstract GQuery empty();
// public abstract GQuery end();
public abstract GQuery eq(int pos);
public abstract GQuery fadeIn(int millisecs, Function... f);
public abstract GQuery fadeOut(Function... f);
public abstract GQuery fadeOut(int millisecs, Function... f);
+ public abstract GQuery fadeTo(double opacity, Function... f);
+ public abstract GQuery fadeTo(int millisecs, double opacity, Function... f);
public abstract Effects fadeToggle(int millisecs, Function... f);
public abstract GQuery filter(Predicate filterFn);
// public abstract GQuery filter(String... filters);
public abstract GQuery find(String... filters);
public abstract GQuery first();
+ // TODO: focusIn
+ // TODO: focusOut
public abstract GQuery focus(Function... f);
public abstract Element get(int i);
public abstract Node getContext();
- public abstract GQuery getPreviousObject();
- public abstract String getSelector();
- public abstract GQuery gt(int pos);
+// public abstract GQuery getPreviousObject();
+// public abstract String getSelector();
+// public abstract GQuery gt(int pos);
+ public abstract GQuery has(String selector);
+ public abstract GQuery has(Element elem);
public abstract boolean hasClass(String... classes);
public abstract int height();
public abstract GQuery height(int height);
public abstract GQuery hover(Function fover, Function fout);
public abstract String html();
public abstract GQuery html(String html);
- public abstract String id();
- public abstract GQuery id(String id);
+// public abstract String id();
+// public abstract GQuery id(String id);
public abstract int index(Element element);
+ // TODO: init
public abstract int innerHeight();
public abstract int innerWidth();
public abstract GQuery insertAfter(Element elem);
public abstract GQuery insertBefore(GQuery query);
public abstract GQuery insertBefore(String selector);
public abstract boolean is(String... filters);
- public abstract boolean isEmpty();
+// public abstract boolean isEmpty();
public abstract GQuery keydown(Function... f);
public abstract GQuery keydown(int key);
public abstract GQuery keypress(Function... f);
public abstract GQuery keyup(Function... f);
public abstract GQuery keyup(int key);
public abstract GQuery last();
- public abstract int left();
- public abstract int length();
+// public abstract int left();
+// public abstract int length();
public abstract GQuery live(String eventName, Function... funcs);
// public abstract GQuery live(int eventbits, Function... funcs);
// public abstract GQuery live(int eventbits, Object data, Function... funcs);
public abstract GQuery live(String eventName, Object data, Function... funcs);
-// public abstract GQuery load(Function f);
- public abstract GQuery lt(int pos);
-// public abstract <W> List<W> map(Function f);
+// TODO: public abstract GQuery load(Function f);
+// public abstract GQuery lt(int pos);
+// TODO: public abstract <W> List<W> map(Function f);
public abstract GQuery mousedown(Function... f);
+ public abstract GQuery mouseenter(Function... f);
+ public abstract GQuery mouseleave(Function... f);
public abstract GQuery mousemove(Function... f);
public abstract GQuery mouseout(Function... f);
public abstract GQuery mouseover(Function... f);
public abstract GQuery parents();
public abstract GQuery parents(String... filters);
public abstract GQuery parentsUntil(String selector);
-// public abstract Offset position();
public abstract GQuery prepend(GQuery query);
public abstract GQuery prepend(Node n);
public abstract GQuery prepend(String html);
public abstract GQuery prev(String... selectors);
public abstract GQuery prevAll();
public abstract GQuery prevUntil(String selector);
+ // TODO: pushStack
public abstract boolean prop(String key);
public abstract GQuery prop(String key, boolean value);
public abstract GQuery prop(String key, Function closure);
public abstract GQuery removeAttr(String key);
public abstract GQuery removeClass(String... classes);
public abstract GQuery removeData(String name);
+ public abstract GQuery removeProp(String name);
public abstract GQuery replaceAll(Element elem);
public abstract GQuery replaceAll(GQuery target);
public abstract GQuery replaceAll(String selector);
public abstract GQuery replaceWith(GQuery target);
public abstract GQuery replaceWith(String html);
public abstract GQuery resize(Function... f);
- public abstract void restoreCssAttrs(String... cssProps);
- public abstract void resize(Function f);
- public abstract void saveCssAttrs(String... cssProps);
+// public abstract void restoreCssAttrs(String... cssProps);
+// public abstract void resize(Function f);
+// public abstract void saveCssAttrs(String... cssProps);
public abstract GQuery scroll(Function... f);
- public abstract GQuery scrollIntoView();
- public abstract GQuery scrollIntoView(boolean ensure);
+// public abstract GQuery scrollIntoView();
+// public abstract GQuery scrollIntoView(boolean ensure);
public abstract int scrollLeft();
public abstract GQuery scrollLeft(int left);
- public abstract GQuery scrollTo(int left, int top);
+// public abstract GQuery scrollTo(int left, int top);
public abstract int scrollTop();
public abstract GQuery scrollTop(int top);
public abstract GQuery select();
- public abstract GQuery setArray(NodeList<Element> list);
- public abstract void setPreviousObject(GQuery previousObject);
- public abstract GQuery setSelector(String selector);
+ // TODO: selector
+ // TODO: selector
+ // TODO: serialize
+ // TODO: serializeArray
+ // public abstract GQuery setArray(NodeList<Element> list);
+ // public abstract void setPreviousObject(GQuery previousObject);
+ // public abstract GQuery setSelector(String selector);
public abstract GQuery show();
public abstract GQuery siblings();
public abstract GQuery siblings(String... selectors);
public abstract GQuery toggle(Function... fn);
public abstract GQuery toggleClass(String... classes);
public abstract GQuery toggleClass(String clz, boolean addOrRemove);
- public abstract int top();
public abstract String toString(boolean pretty);
-// public abstract GQuery trigger(int eventbits, int... keys);
-// public abstract GQuery unbind(int eventbits);
+// public abstract GQuery unbind(String eventName);
+// public abstract GQuery unbind(String eventName, Function f);
public abstract GQuery undelegate();
public abstract GQuery undelegate(String selector);
public abstract GQuery undelegate(String selector, String eventName);
- public abstract GQuery undelegate(String selector, int eventBit);
+// public abstract GQuery undelegate(String selector, int eventBit);
// public abstract JsNodeArray unique(NodeList<Element> result);
+ // TODO: unload
public abstract GQuery unwrap();
public abstract String val();
public abstract GQuery val(String... values);
- public abstract String[] vals();
- public abstract boolean isVisible();
+// public abstract String[] vals();
+// public abstract boolean isVisible();
public abstract int width();
public abstract GQuery width(int width);
public abstract GQuery wrap(Element elem);