]> source.dussan.org Git - gwtquery.git/commitdiff
Created missing methods in LazyGQuery, removed parameter warnings
authorManolo Carrasco <manolo@apache.org>
Thu, 6 May 2010 13:29:12 +0000 (13:29 +0000)
committerManolo Carrasco <manolo@apache.org>
Thu, 6 May 2010 13:29:12 +0000 (13:29 +0000)
gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java
gwtquery-core/src/main/java/com/google/gwt/query/client/LazyEffects.java
gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java
gwtquery-core/src/test/java/com/google/gwt/query/client/GwtEventsTest.java

index 36318ad8675ea41104ce086d3b7f02abfe0a99fb..0bb29fef7f1dc4aebb1a899e529c6eba0cffefe6 100644 (file)
@@ -552,6 +552,7 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
   /**\r
    * Convert to Plugin interface provided by Class literal.\r
    */\r
+  @SuppressWarnings("unchecked")\r
   public <T extends GQuery> T as(Class<T> plugin) {\r
     // GQuery is not a plugin for itself\r
     if (plugin == GQUERY) {\r
index cad430b55bbf33852706a46c548f3b9153062521..3ac91232afbd16b4e4a516ed1b21d391b1fa4e23 100644 (file)
@@ -3,7 +3,7 @@ package com.google.gwt.query.client;
 /**
  *
  */
-public interface LazyEffects extends LazyGQuery {
+public interface LazyEffects extends LazyGQuery<Effects> {
 
   LazyEffects animate(Properties properties, Effects.Speed speed,
       Effects.Easing easing, Function complete);
index 3ac8c3b7545fa88917fe25302064e928b2626e0a..5e95bfc30ecf5d8c5c1cc159ff05c337236c1802 100644 (file)
@@ -2,7 +2,6 @@ package com.google.gwt.query.client;
 
 import com.google.gwt.dom.client.Element;
 import com.google.gwt.dom.client.Node;
-//import com.google.gwt.query.client.css.CssProperty;
 
 /**
  * Created by IntelliJ IDEA. User: ray Date: May 2, 2009 Time: 10:48:07 PM To
@@ -13,68 +12,67 @@ public interface LazyGQuery<T> extends LazyBase<T> {
   /**
    * Add elements to the set of matched elements if they are not included yet.
    */
-
-  LazyGQuery add(String selector);
+  LazyGQuery<T> add(String selector);
 
   /**
    * Adds the specified classes to each matched element. Add elements to the set
    * of matched elements if they are not included yet.
    */
-  LazyGQuery add(GQuery previousObject);
+  LazyGQuery<T> add(GQuery previousObject);
 
   /**
    * Adds the specified classes to each matched element.
    */
-  LazyGQuery addClass(String... classes);
+  LazyGQuery<T> addClass(String... classes);
 
   /**
    * Insert content after each of the matched elements. The elements must
    * already be inserted into the document (you can't insert an element after
    * another if it's not in the page).
    */
-  LazyGQuery after(Node n);
+  LazyGQuery<T> after(Node n);
 
   /**
    * Insert content after each of the matched elements. The elements must
    * already be inserted into the document (you can't insert an element after
    * another if it's not in the page).
    */
-  LazyGQuery after(String html);
+  LazyGQuery<T> after(String html);
 
   /**
    * Insert content after each of the matched elements. The elements must
    * already be inserted into the document (you can't insert an element after
    * another if it's not in the page).
    */
-  LazyGQuery after(GQuery query);
+  LazyGQuery<T> after(GQuery query);
 
   /**
    * Add the previous selection to the current selection. Useful for traversing
    * elements, and then adding something that was matched before the last
    * traversal.
    */
-  LazyGQuery andSelf();
+  LazyGQuery<T> andSelf();
 
   /**
    * Append content to the inside of every matched element. This operation is
    * similar to doing an appendChild to all the specified elements, adding them
    * into the document.
    */
-  LazyGQuery append(String html);
+  LazyGQuery<T> append(String html);
 
   /**
    * Append content to the inside of every matched element. This operation is
    * similar to doing an appendChild to all the specified elements, adding them
    * into the document.
    */
-  LazyGQuery append(Node n);
+  LazyGQuery<T> append(Node n);
 
   /**
    * Append content to the inside of every matched element. This operation is
    * similar to doing an appendChild to all the specified elements, adding them
    * into the document.
    */
-  LazyGQuery append(GQuery query);
+  LazyGQuery<T> append(GQuery query);
 
   /**
    * Append all of the matched elements to another, specified, set of elements.
@@ -82,225 +80,209 @@ public interface LazyGQuery<T> extends LazyBase<T> {
    * $(A).append(B), in that instead of appending B to A, you're appending A to
    * B.
    */
-  LazyGQuery appendTo(GQuery other);
+  LazyGQuery<T> appendTo(GQuery other);
 
   /**
    * Convert to Plugin interface provided by Class literal.
    */
-  <T extends LazyGQuery> T as(Class<T> plugin);
+  <P extends GQuery> P as(Class<P> plugin);
 
   /**
    * Set a single property to a value, on all matched elements.
    */
-  LazyGQuery attr(String key, String value);
+  LazyGQuery<T> attr(String key, String value);
 
   /**
    * Set a key/value object as properties to all matched elements.
-   *
+   * 
    * Example: $("img").attr(new Properties("src: 'test.jpg', alt: 'Test
    * Image'"))
    */
-  LazyGQuery attr(Properties properties);
+  LazyGQuery<T> attr(Properties properties);
 
   /**
    * Set a single property to a computed value, on all matched elements.
    */
-  LazyGQuery attr(String key, Function closure);
+  LazyGQuery<T> attr(String key, Function closure);
 
   /**
    * Insert content before each of the matched elements. The elements must
    * already be inserted into the document (you can't insert an element before
    * another if it's not in the page).
    */
-  LazyGQuery before(Node n);
+  LazyGQuery<T> before(Node n);
 
   /**
    * Insert content before each of the matched elements. The elements must
    * already be inserted into the document (you can't insert an element before
    * another if it's not in the page).
    */
-  LazyGQuery before(GQuery query);
+  LazyGQuery<T> before(GQuery query);
 
   /**
    * Insert content before each of the matched elements. The elements must
    * already be inserted into the document (you can't insert an element before
    * another if it's not in the page).
    */
-  LazyGQuery before(String html);
+  LazyGQuery<T> before(String html);
 
   /**
-   * Binds a handler to a particular Event (like Event.ONCLICK) for each matched
-   * element.
-   *
-   * The event handler is passed as a Function that you can use to prevent
-   * default behaviour. To stop both default action and event bubbling, the
+   * Binds a set of handlers to a particular Event for each matched element.
+   * 
+   * The event handlers are passed as Functions that you can use to prevent
+   * default behavior. To stop both default action and event bubbling, the
    * function event handler has to return false.
-   *
+   * 
    * You can pass an additional Object data to your Function as the second
    * parameter
+   * 
    */
-  LazyGQuery bind(int eventbits, Object data, Function f);
-
-  /**
-   * Bind a function to the blur event of each matched element.
-   */
-  LazyGQuery blur(Function f);
+  LazyGQuery<T> bind(int eventbits, Object data, Function... f);
 
   /**
-   * Trigger a blur event.
+   * Bind a set of functions to the blur event of each matched element. Or
+   * trigger the event if no functions are provided.
    */
-  LazyGQuery blur();
+  LazyGQuery<T> blur(Function... f);
 
   /**
-   * Bind a function to the change event of each matched element.
+   * Bind a set of functions to the change event of each matched element. Or
+   * trigger the event if no functions are provided.
    */
-  LazyGQuery change(Function f);
-
-  /**
-   * Trigger a change event.
-   */
-  LazyGQuery change();
+  LazyGQuery<T> change(Function... f);
 
   /**
    * Get a set of elements containing all of the unique children of each of the
    * matched set of elements. This set is filtered with the expressions that
    * will cause only elements matching any of the selectors to be collected.
    */
-  LazyGQuery children(String... filters);
+  LazyGQuery<T> children(String... filters);
 
   /**
    * Get a set of elements containing all of the unique immediate children of
    * each of the matched set of elements. Also note: while parents() will look
    * at all ancestors, children() will only consider immediate child elements.
    */
-  LazyGQuery children();
-
-  /**
-   * Trigger a click event.
-   */
-  LazyGQuery click();
+  LazyGQuery<T> children();
 
   /**
-   * Triggers the click event of each matched element. Causes all of the
-   * functions that have been bound to that click event to be executed.
+   * Bind a set of functions to the click event of each matched element. Or
+   * trigger the event if no functions are provided.
    */
-  LazyGQuery click(Function f);
+  LazyGQuery<T> click(Function... f);
 
   /**
    * Clone matched DOM Elements and select the clones. This is useful for moving
    * copies of the elements to another location in the DOM.
    */
-  LazyGQuery clone();
+  LazyGQuery<T> clone();
 
   /**
    * Filter the set of elements to those that contain the specified text.
    */
-  LazyGQuery contains(String text);
+  LazyGQuery<T> contains(String text);
 
   /**
    * Find all the child nodes inside the matched elements (including text
    * nodes), or the content document, if the element is an iframe.
    */
-  LazyGQuery contents();
+  LazyGQuery<T> contents();
 
   /**
    * Set a single style property to a value, on all matched elements using
    * type-safe overhead-free enumerations.
-   *
-   * @param property a CSS property type
-   * @param value a legal value from the type T
-   * @param <T> inferred from the CSS property type
+   * 
+   * @param property
+   *          a CSS property type
+   * @param value
+   *          a legal value from the type T
+   * @param <T>
+   *          inferred from the CSS property type
    * @return
    */
-//  <T> LazyGQuery css(CssProperty<T> property, T value);
+  // <T> LazyGQuery<T> css(CssProperty<T> property, T value);
 
   /**
    * Set a key/value object as style properties to all matched elements. This
    * serves as the best way to set a large number of style properties on all
    * matched elements.
-   *
+   * 
    * Example: $(".item").css(Properties.create("color: 'red', background:
    * 'blue'"))
    */
-  LazyGQuery css(Properties properties);
+  LazyGQuery<T> css(Properties properties);
 
   /**
    * Set a single style property to a value, on all matched elements.
    */
-  LazyGQuery css(String prop, String val);
+  LazyGQuery<T> css(String prop, String val);
 
   /**
-   * Trigger a double click event.
+   * Bind a set of functions to the dblclick event of each matched element. Or
+   * trigger the event if no functions are provided.
    */
-  LazyGQuery dblclick();
-
-  /**
-   * Bind a function to the dblclick event of each matched element.
-   */
-  LazyGQuery dblclick(Function f);
+  LazyGQuery<T> dblclick(Function... f);
 
   /**
    * Removes a queued function from the front of the queue and executes it.
    */
-  LazyGQuery dequeue(String type);
+  LazyGQuery<T> dequeue(String type);
 
   /**
    * Removes a queued function from the front of the FX queue and executes it.
    */
-  LazyGQuery dequeue();
+  LazyGQuery<T> dequeue();
 
   /**
-   * Run one or more Functions over each element of the GQuery.
+   * Run one or more Functions over each element of the GQuery. You have to
+   * override one of these funcions: public void f(Element e) public String
+   * f(Element e, int i)
    */
-  LazyGQuery each(Function... f);
+  LazyGQuery<T> each(Function... f);
 
   /**
    * Remove all child nodes from the set of matched elements.
    */
-  LazyGQuery empty();
+  LazyGQuery<T> empty();
 
   /**
    * Revert the most recent 'destructive' operation, changing the set of matched
    * elements to its previous state (right before the destructive operation).
    */
-  LazyGQuery end();
+  LazyGQuery<T> end();
 
   /**
    * Reduce GQuery to element in the specified position.
    */
-  LazyGQuery eq(int pos);
+  LazyGQuery<T> eq(int pos);
 
   /**
-   * Trigger an error event.
+   * Bind a set of functions to the error event of each matched element. Or
+   * trigger the event if no functions are provided.
    */
-  LazyGQuery error();
-
-  /**
-   * Bind a function to the error event of each matched element.
-   */
-  LazyGQuery error(Function f);
+  LazyGQuery<T> error(Function... f);
 
   /**
    * Fade in all matched elements by adjusting their opacity.
    */
-  LazyGQuery fadeIn(int millisecs);
+  LazyGQuery<T> fadeIn(int millisecs);
 
   /**
    * Fade in all matched elements by adjusting their opacity. The effect will
    * take 1000 milliseconds to complete
    */
-  LazyGQuery fadeIn();
+  LazyGQuery<T> fadeIn();
 
   /**
    * Fade out all matched elements by adjusting their opacity.
    */
-  LazyGQuery fadeOut(int millisecs);
+  LazyGQuery<T> fadeOut(int millisecs);
 
   /**
    * Fade out all matched elements by adjusting their opacity. The effect will
    * take 1000 milliseconds to complete
    */
-  LazyGQuery fadeOut();
+  LazyGQuery<T> fadeOut();
 
   /**
    * Removes all elements from the set of matched elements that do not match the
@@ -308,7 +290,7 @@ public interface LazyGQuery<T> extends LazyBase<T> {
    * current element. If the function returns false, then the element is removed
    * - anything else and the element is kept.
    */
-  LazyGQuery filter(Predicate filterFn);
+  LazyGQuery<T> filter(Predicate filterFn);
 
   /**
    * Removes all elements from the set of matched elements that do not pass the
@@ -316,34 +298,29 @@ public interface LazyGQuery<T> extends LazyBase<T> {
    * a search. Provide a comma-separated list of expressions to apply multiple
    * filters at once.
    */
-  LazyGQuery filter(String... filters);
+  LazyGQuery<T> filter(String... filters);
 
   /**
    * Searches for all elements that match the specified css expression. This
    * method is a good way to find additional descendant elements with which to
    * process.
-   *
+   * 
    * Provide a comma-separated list of expressions to apply multiple filters at
    * once.
    */
-  LazyGQuery find(String... filters);
+  LazyGQuery<T> find(String... filters);
 
   /**
-   * Trigger a focus event.
+   * Bind a set of functions to the focus event of each matched element. Or
+   * trigger the event if no functions are provided.
    */
-  LazyGQuery focus();
-
-  /**
-   * Bind a function to the focus event of each matched element.
-   */
-
-  LazyGQuery focus(Function f);
+  LazyGQuery<T> focus(Function... f);
 
   /**
    * Return the previous set of matched elements prior to the last destructive
    * operation (e.g. query)
    */
-  LazyGQuery getPreviousObject();
+  LazyGQuery<T> getPreviousObject();
 
   /**
    * Returns true any of the specified classes are present on any of the matched
@@ -351,23 +328,23 @@ public interface LazyGQuery<T> extends LazyBase<T> {
    * The position of the element in the set of matched elements starts at 0 and
    * goes to length - 1.
    */
-  LazyGQuery gt(int pos);
+  LazyGQuery<T> gt(int pos);
 
   /**
    * Set the height of every element in the matched set.
    */
-  LazyGQuery height(int height);
+  LazyGQuery<T> height(int height);
 
   /**
    * Set the height style property of every matched element. It's useful for
    * using 'percent' or 'em' units Example: $(".a").width("100%")
    */
-  LazyGQuery height(String height);
+  LazyGQuery<T> height(String height);
 
   /**
    * Make invisible all matched elements.
    */
-  LazyGQuery hide();
+  LazyGQuery<T> hide();
 
   /**
    * Bind a function to the mouseover event of each matched element. A method
@@ -377,126 +354,139 @@ public interface LazyGQuery<T> extends LazyBase<T> {
    * is fired. Whenever the mouse moves off of the element, the second specified
    * function fires.
    */
-  LazyGQuery hover(Function fover, Function fout);
+  LazyGQuery<T> hover(Function fover, Function fout);
 
   /**
    * Set the innerHTML of every matched element.
    */
-  LazyGQuery html(String html);
+  LazyGQuery<T> html(String html);
 
   /**
    * Insert all of the matched elements after another, specified, set of
    * elements.
    */
-  LazyGQuery insertAfter(String selector);
+  LazyGQuery<T> insertAfter(String selector);
 
   /**
    * Insert all of the matched elements after another, specified, set of
    * elements.
    */
-  LazyGQuery insertAfter(Element elem);
+  LazyGQuery<T> insertAfter(Element elem);
 
   /**
    * Insert all of the matched elements after another, specified, set of
    * elements.
    */
-  LazyGQuery insertAfter(GQuery query);
+  LazyGQuery<T> insertAfter(GQuery query);
 
   /**
    * Insert all of the matched elements before another, specified, set of
    * elements.
-   *
+   * 
    * The elements must already be inserted into the document (you can't insert
    * an element after another if it's not in the page).
    */
-  LazyGQuery insertBefore(Element item);
+  LazyGQuery<T> insertBefore(Element item);
 
   /**
    * Insert all of the matched elements before another, specified, set of
    * elements.
-   *
+   * 
    * The elements must already be inserted into the document (you can't insert
    * an element after another if it's not in the page).
    */
-  LazyGQuery insertBefore(GQuery query);
+  LazyGQuery<T> insertBefore(GQuery query);
 
   /**
    * Insert all of the matched elements before another, specified, set of
    * elements.
-   *
+   * 
    * The elements must already be inserted into the document (you can't insert
    * an element after another if it's not in the page).
    */
-  LazyGQuery insertBefore(String selector);
+  LazyGQuery<T> insertBefore(String selector);
+
+  /**
+   * Bind a set of functions to the keydown event of each matched element. Or
+   * trigger the event if no functions are provided.
+   */
+  LazyGQuery<T> keydown(Function... f);
 
   /**
-   * Trigger a keydown event.
+   * Trigger a keydown event passing the key pushed
    */
-  LazyGQuery keydown();
+  LazyGQuery<T> keydown(int key);
 
   /**
-   * Trigger a keypress event.
+   * Bind a set of functions to the keypress event of each matched element. Or
+   * trigger the event if no functions are provided.
    */
-  LazyGQuery keypress();
+  LazyGQuery<T> keypress(Function... f);
 
   /**
-   * Bind a function to the keypress event of each matched element.
+   * Trigger a keypress event passing the key pushed
    */
-  LazyGQuery keypressed(Function f);
+  LazyGQuery<T> keypress(int key);
 
   /**
-   * Trigger a keyup event.
+   * Bind a set of functions to the keyup event of each matched element. Or
+   * trigger the event if no functions are provided.
    */
-  LazyGQuery keyup();
+  LazyGQuery<T> keyup(Function... f);
 
   /**
-   * Bind a function to the keyup event of each matched element.
+   * Trigger a keyup event passing the key pushed
    */
-  LazyGQuery keyup(Function f);
+  LazyGQuery<T> keyup(int key);
 
   /**
    * Bind a function to the load event of each matched element.
    */
-  LazyGQuery load(Function f);
+  LazyGQuery<T> load(Function f);
 
   /**
    * Reduce the set of matched elements to all elements before a given position.
    * The position of the element in the set of matched elements starts at 0 and
    * goes to length - 1.
    */
-  LazyGQuery lt(int pos);
+  LazyGQuery<T> lt(int pos);
 
   /**
-   * Bind a function to the mousedown event of each matched element.
+   * Bind a set of functions to the mousedown event of each matched element. Or
+   * trigger the event if no functions are provided.
    */
-  LazyGQuery mousedown(Function f);
+  LazyGQuery<T> mousedown(Function... f);
 
   /**
-   * Bind a function to the mousemove event of each matched element.
+   * Bind a set of functions to the mousemove event of each matched element. Or
+   * trigger the event if no functions are provided.
    */
-  LazyGQuery mousemove(Function f);
+  LazyGQuery<T> mousemove(Function... f);
 
   /**
-   * Bind a function to the mouseout event of each matched element.
+   * Bind a set of functions to the mouseout event of each matched element. Or
+   * trigger the event if no functions are provided.
    */
-  LazyGQuery mouseout(Function f);
+  LazyGQuery<T> mouseout(Function... f);
 
   /**
-   * Bind a function to the mouseover event of each matched element.
+   * Bind a set of functions to the mouseover event of each matched element. Or
+   * trigger the event if no functions are provided.
    */
-  LazyGQuery mouseover(Function f);
+  LazyGQuery<T> mouseover(Function... f);
 
   /**
-   * Bind a function to the mouseup event of each matched element.
+   * Bind a set of functions to the mouseup event of each matched element. Or
+   * trigger the event if no functions are provided.
    */
-  LazyGQuery mouseup(Function f);
+  LazyGQuery<T> mouseup(Function... f);
 
   /**
    * Get a set of elements containing the unique next siblings of each of the
    * given set of elements. next only returns the very next sibling for each
    * element, not all next siblings see {#nextAll}.
    */
-  LazyGQuery next();
+  LazyGQuery<T> next();
 
   /**
    * Get a set of elements containing the unique next siblings of each of the
@@ -504,97 +494,97 @@ public interface LazyGQuery<T> extends LazyBase<T> {
    * the very next sibling for each element, not all next siblings see
    * {#nextAll}.
    */
-  LazyGQuery next(String... selectors);
+  LazyGQuery<T> next(String... selectors);
 
   /**
    * Find all sibling elements after the current element.
    */
-  LazyGQuery nextAll();
+  LazyGQuery<T> nextAll();
 
   /**
    * Removes the specified Element from the set of matched elements. This method
    * is used to remove a single Element from a jQuery object.
    */
-  LazyGQuery not(Element elem);
+  LazyGQuery<T> not(Element elem);
 
   /**
    * Removes any elements inside the passed set of elements from the set of
    * matched elements.
    */
-  LazyGQuery not(GQuery gq);
+  LazyGQuery<T> not(GQuery gq);
 
   /**
    * Removes elements matching the specified expression from the set of matched
    * elements.
    */
-  LazyGQuery not(String... filters);
+  LazyGQuery<T> not(String... filters);
 
   /**
    * Returns a GQuery collection with the positioned parent of the first matched
    * element. This is the first parent of the element that has position (as in
    * relative or absolute). This method only works with visible elements.
    */
-  LazyGQuery offsetParent();
+  LazyGQuery<T> offsetParent();
 
   /**
    * Binds a handler to a particular Event (like Event.ONCLICK) for each matched
    * element. The handler is executed only once for each element.
-   *
+   * 
    * The event handler is passed as a Function that you can use to prevent
    * default behaviour. To stop both default action and event bubbling, the
    * function event handler has to return false.
-   *
+   * 
    * You can pass an additional Object data to your Function as the second
    * parameter
    */
-  LazyGQuery one(int eventbits, Object data, Function f);
+  LazyGQuery<T> one(int eventbits, Object data, Function f);
 
   /**
    * Get a set of elements containing the unique parents of the matched set of
    * elements.
    */
-  LazyGQuery parent();
+  LazyGQuery<T> parent();
 
   /**
    * Get a set of elements containing the unique parents of the matched set of
    * elements. You may use an optional expressions to filter the set of parent
    * elements that will match one of them.
    */
-  LazyGQuery parent(String... filters);
+  LazyGQuery<T> parent(String... filters);
 
   /**
    * Get a set of elements containing the unique ancestors of the matched set of
    * elements (except for the root element). The matched elements are filtered,
    * returning those that match any of the filters.
    */
-  LazyGQuery parents(String... filters);
+  LazyGQuery<T> parents(String... filters);
 
   /**
    * Get a set of elements containing the unique ancestors of the matched set of
    * elements (except for the root element).
    */
-  LazyGQuery parents();
+  LazyGQuery<T> parents();
 
   /**
    * Prepend content to the inside of every matched element. This operation is
    * the best way to insert elements inside, at the beginning, of all matched
    * elements.
    */
-  LazyGQuery prepend(String html);
+  LazyGQuery<T> prepend(String html);
 
   /**
    * Prepend content to the inside of every matched element. This operation is
    * the best way to insert elements inside, at the beginning, of all matched
    * elements.
    */
-  LazyGQuery prepend(GQuery query);
+  LazyGQuery<T> prepend(GQuery query);
 
   /**
    * Prepend content to the inside of every matched element. This operation is
    * the best way to insert elements inside, at the beginning, of all matched
    * elements.
    */
-  LazyGQuery prepend(Node n);
+  LazyGQuery<T> prepend(Node n);
 
   /**
    * Prepend all of the matched elements to another, specified, set of elements.
@@ -602,112 +592,113 @@ public interface LazyGQuery<T> extends LazyBase<T> {
    * $(A).prepend(B), in that instead of prepending B to A, you're prepending A
    * to B.
    */
-  LazyGQuery prependTo(GQuery elms);
+  LazyGQuery<T> prependTo(GQuery elms);
 
   /**
    * Get a set of elements containing the unique previous siblings of each of
    * the matched set of elements. Only the immediately previous sibling is
    * returned, not all previous siblings.
    */
-  LazyGQuery prev();
+  LazyGQuery<T> prev();
 
   /**
    * Get a set of elements containing the unique previous siblings of each of
    * the matched set of elements filtered by selector. Only the immediately
    * previous sibling is returned, not all previous siblings.
    */
-  LazyGQuery prev(String... selectors);
+  LazyGQuery<T> prev(String... selectors);
 
   /**
    * Find all sibling elements in front of the current element.
    */
-  LazyGQuery prevAll();
+  LazyGQuery<T> prevAll();
 
   /**
    * Adds a new function, to be executed, onto the end of the queue of all
    * matched elements.
    */
-  LazyGQuery queue(String type, Function data);
+  LazyGQuery<T> queue(String type, Function data);
 
   /**
    * Adds a new function, to be executed, onto the end of the queue of all
    * matched elements in the FX queue.
    */
-  LazyGQuery queue(Function data);
+  LazyGQuery<T> queue(Function data);
 
   /**
    * Removes all matched elements from the DOM.
    */
-  LazyGQuery remove();
+  LazyGQuery<T> remove();
 
   /**
    * Remove the named attribute from every element in the matched set.
    */
-  LazyGQuery removeAttr(String key);
+  LazyGQuery<T> removeAttr(String key);
 
   /**
    * Removes the specified classes to each matched element.
    */
-  LazyGQuery removeClass(String... classes);
+  LazyGQuery<T> removeClass(String... classes);
 
   /**
    * Removes named data store from an element.
    */
-  LazyGQuery removeData(String name);
+  LazyGQuery<T> removeData(String name);
 
   /**
    * Replaces the elements matched by the specified selector with the matched
    * elements. This function is the complement to replaceWith() which does the
    * same task with the parameters reversed.
    */
-  LazyGQuery replaceAll(GQuery query);
+  LazyGQuery<T> replaceAll(GQuery query);
 
   /**
    * Replaces the elements matched by the specified selector with the matched
    * elements. This function is the complement to replaceWith() which does the
    * same task with the parameters reversed.
    */
-  LazyGQuery replaceAll(String html);
+  LazyGQuery<T> replaceAll(String html);
 
   /**
    * Replaces the elements matched by the specified selector with the matched
    * elements. This function is the complement to replaceWith() which does the
    * same task with the parameters reversed.
    */
-  LazyGQuery replaceAll(Element elem);
+  LazyGQuery<T> replaceAll(Element elem);
 
   /**
    * Replaces all matched elements with the specified HTML or DOM elements. This
    * returns the GQuery element that was just replaced, which has been removed
    * from the DOM.
    */
-  LazyGQuery replaceWith(GQuery query);
+  LazyGQuery<T> replaceWith(GQuery query);
 
   /**
    * Replaces all matched elements with the specified HTML or DOM elements. This
    * returns the GQuery element that was just replaced, which has been removed
    * from the DOM.
    */
-  LazyGQuery replaceWith(String html);
+  LazyGQuery<T> replaceWith(String html);
 
   /**
    * Replaces all matched elements with the specified HTML or DOM elements. This
    * returns the GQuery element that was just replaced, which has been removed
    * from the DOM.
    */
-  LazyGQuery replaceWith(Element elem);
+  LazyGQuery<T> replaceWith(Element elem);
 
   /**
-   * Bind a function to the scroll event of each matched element.
+   * Bind a set of functions to the scroll event of each matched element. Or
+   * trigger the event if no functions are provided.
    */
-  LazyGQuery scroll(Function f);
+  LazyGQuery<T> scroll(Function... f);
 
   /**
    * When a value is passed in, the scroll left offset is set to that value on
    * all matched elements. This method works for both visible and hidden
    * elements.
    */
-  LazyGQuery scrollLeft(int left);
+  LazyGQuery<T> scrollLeft(int left);
 
   /**
    * Gets the scroll left offset of the first matched element. This method works
@@ -720,7 +711,7 @@ public interface LazyGQuery<T> extends LazyBase<T> {
    * all matched elements. This method works for both visible and hidden
    * elements.
    */
-  LazyGQuery scrollTop(int top);
+  LazyGQuery<T> scrollTop(int top);
 
   /**
    * Gets the scroll top offset of the first matched element. This method works
@@ -728,74 +719,74 @@ public interface LazyGQuery<T> extends LazyBase<T> {
    */
   int scrollTop();
 
-  LazyGQuery select();
+  LazyGQuery<T> select();
 
   /**
    * Return the number of elements in the matched set. Make visible all mached
    * elements
    */
-  LazyGQuery show();
+  LazyGQuery<T> show();
 
   /**
    * Get a set of elements containing all of the unique siblings of each of the
    * matched set of elements.
    */
-  LazyGQuery siblings();
+  LazyGQuery<T> siblings();
 
   /**
    * Get a set of elements containing all of the unique siblings of each of the
    * matched set of elements filtered by the provided set of selectors.
    */
-  LazyGQuery siblings(String... selectors);
+  LazyGQuery<T> siblings(String... selectors);
 
   /**
    * Selects a subset of the matched elements.
    */
-  LazyGQuery slice(int start, int end);
+  LazyGQuery<T> slice(int start, int end);
 
-  LazyGQuery submit();
+  LazyGQuery<T> submit();
 
   /**
    * Set the innerText of every matched element.
    */
-  LazyGQuery text(String txt);
+  LazyGQuery<T> text(String txt);
 
   /**
    * Toggle among two or more function calls every other click.
    */
-  LazyGQuery toggle(Function... fn);
+  LazyGQuery<T> toggle(Function... fn);
 
   /**
    * Adds or removes the specified classes to each matched element.
    */
-  LazyGQuery toggleClass(String... classes);
+  LazyGQuery<T> toggleClass(String... classes);
 
   /**
    * Adds or removes the specified classes to each matched element.
    */
-  LazyGQuery toggleClass(String clz, boolean sw);
+  LazyGQuery<T> toggleClass(String clz, boolean sw);
 
   /**
    * Trigger an event of type eventbits on every matched element.
    */
-  LazyGQuery trigger(int eventbits, int... keys);
+  LazyGQuery<T> trigger(int eventbits, int... keys);
 
   /**
    * Removes all events that match the eventbits.
    */
-  LazyGQuery unbind(int eventbits);
+  LazyGQuery<T> unbind(int eventbits);
 
   /**
    * Sets the value attribute of every matched element In the case of multivalue
    * elements, all values are setted for other elements, only the first value is
    * considered.
    */
-  LazyGQuery val(String... values);
+  LazyGQuery<T> val(String... values);
 
   /**
    * Set the width of every matched element.
    */
-  LazyGQuery width(int width);
+  LazyGQuery<T> width(int width);
 
   /**
    * Wrap each matched element with the specified HTML content. This wrapping
@@ -806,7 +797,7 @@ public interface LazyGQuery<T> extends LazyBase<T> {
    * within its structure -- it is that element that will enwrap everything
    * else.
    */
-  LazyGQuery wrap(GQuery query);
+  LazyGQuery<T> wrap(GQuery query);
 
   /**
    * Wrap each matched element with the specified HTML content. This wrapping
@@ -817,7 +808,7 @@ public interface LazyGQuery<T> extends LazyBase<T> {
    * within its structure -- it is that element that will enwrap everything
    * else.
    */
-  LazyGQuery wrap(Element elem);
+  LazyGQuery<T> wrap(Element elem);
 
   /**
    * Wrap each matched element with the specified HTML content. This wrapping
@@ -828,7 +819,7 @@ public interface LazyGQuery<T> extends LazyBase<T> {
    * within its structure -- it is that element that will enwrap everything
    * else.
    */
-  LazyGQuery wrap(String html);
+  LazyGQuery<T> wrap(String html);
 
   /**
    * Wrap all the elements in the matched set into a single wrapper element.
@@ -836,13 +827,13 @@ public interface LazyGQuery<T> extends LazyBase<T> {
    * get wrapped with an element. This wrapping process is most useful for
    * injecting additional structure into a document, without ruining the
    * original semantic qualities of a document.
-   *
+   * 
    * This works by going through the first element provided (which is generated,
    * on the fly, from the provided HTML) and finds the deepest descendant
    * element within its structure -- it is that element that will enwrap
    * everything else.
    */
-  LazyGQuery wrapAll(String html);
+  LazyGQuery<T> wrapAll(String html);
 
   /**
    * Wrap all the elements in the matched set into a single wrapper element.
@@ -850,13 +841,13 @@ public interface LazyGQuery<T> extends LazyBase<T> {
    * get wrapped with an element. This wrapping process is most useful for
    * injecting additional structure into a document, without ruining the
    * original semantic qualities of a document.
-   *
+   * 
    * This works by going through the first element provided (which is generated,
    * on the fly, from the provided HTML) and finds the deepest descendant
    * element within its structure -- it is that element that will enwrap
    * everything else.
    */
-  LazyGQuery wrapAll(Element elem);
+  LazyGQuery<T> wrapAll(Element elem);
 
   /**
    * Wrap all the elements in the matched set into a single wrapper element.
@@ -864,13 +855,13 @@ public interface LazyGQuery<T> extends LazyBase<T> {
    * get wrapped with an element. This wrapping process is most useful for
    * injecting additional structure into a document, without ruining the
    * original semantic qualities of a document.
-   *
+   * 
    * This works by going through the first element provided (which is generated,
    * on the fly, from the provided HTML) and finds the deepest descendant
    * element within its structure -- it is that element that will enwrap
    * everything else.
    */
-  LazyGQuery wrapAll(GQuery query);
+  LazyGQuery<T> wrapAll(GQuery query);
 
   /**
    * Wrap the inner child contents of each matched element (including text
@@ -881,7 +872,7 @@ public interface LazyGQuery<T> extends LazyBase<T> {
    * HTML) and finds the deepest ancestor element within its structure -- it is
    * that element that will enwrap everything else.
    */
-  LazyGQuery wrapInner(GQuery query);
+  LazyGQuery<T> wrapInner(GQuery query);
 
   /**
    * Wrap the inner child contents of each matched element (including text
@@ -892,7 +883,7 @@ public interface LazyGQuery<T> extends LazyBase<T> {
    * HTML) and finds the deepest ancestor element within its structure -- it is
    * that element that will enwrap everything else.
    */
-  LazyGQuery wrapInner(String html);
+  LazyGQuery<T> wrapInner(String html);
 
   /**
    * Wrap the inner child contents of each matched element (including text
@@ -903,5 +894,5 @@ public interface LazyGQuery<T> extends LazyBase<T> {
    * HTML) and finds the deepest ancestor element within its structure -- it is
    * that element that will enwrap everything else.
    */
-  LazyGQuery wrapInner(Element elem);
+  LazyGQuery<T> wrapInner(Element elem);
 }
index ca28b0f777cf082a950f9da4d2afa52ff3784808..bd81aee5bcfaf8e7ce1442394a457f54b242b7b1 100644 (file)
@@ -16,6 +16,7 @@
 package com.google.gwt.query.client;
 
 import static com.google.gwt.query.client.GQuery.$;
+import static com.google.gwt.query.client.GQuery.lazy;
 
 import com.google.gwt.dom.client.Element;
 import com.google.gwt.event.dom.client.ClickEvent;
@@ -182,12 +183,8 @@ public class GwtEventsTest extends GWTTestCase {
       }
     });
     RootPanel.get().add(b);
-    $("button").click(new Function(){
-      public boolean f(Event e) {
-        $(e).css("color", "red");
-        return true;
-      }
-    });
+    $("button").click(lazy().css("color", "red").done());
+    
     $("button").click();
     assertEquals("red", $("button").css("color"));    
     assertEquals("black", $("button").css("background-color"));