]> source.dussan.org Git - gwtquery.git/commitdiff
The method widget now accept the index of the widget to return
authorManolo Carrasco <manolo@apache.org>
Fri, 4 Mar 2011 12:51:53 +0000 (12:51 +0000)
committerManolo Carrasco <manolo@apache.org>
Fri, 4 Mar 2011 12:51:53 +0000 (12:51 +0000)
gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java

index ee082eae2e477fbb49ecabc3b0cd471d8b766a94..58e2227e79bf02b63c86e1f2fa56f92ceba1f176 100644 (file)
@@ -863,9 +863,11 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
    * </pre>\r
    * \r
    */\r
-  public GQuery css(CssSetter cssSetter) {\r
+  public GQuery css(CssSetter... cssSetter) {\r
     for (Element e : elements()) {\r
-      cssSetter.applyCss(e);\r
+      for (CssSetter s : cssSetter) {\r
+        s.applyCss(e);\r
+      }\r
     }\r
     return this;\r
   }\r
@@ -2528,11 +2530,22 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
    * if there isn't any.\r
    */\r
   public <W extends Widget> W widget() {\r
+    return widget(0);\r
+  }\r
+\r
+  /**\r
+   * Return the nth non null attached widget from the matched elements or null\r
+   * if there isn't any.\r
+   */\r
+  public <W extends Widget> W widget(int n) {\r
     for (Element e : elements()) {\r
       @SuppressWarnings("unchecked")\r
       W w = (W) getAssociatedWidget(e);\r
       if (w != null) {\r
-        return w;\r
+        if (n == 0) {\r
+          return w;\r
+        }\r
+        n--;\r
       }\r
     }\r
     return null;\r