diff options
author | Manolo Carrasco <manolo@apache.org> | 2011-03-04 12:51:53 +0000 |
---|---|---|
committer | Manolo Carrasco <manolo@apache.org> | 2011-03-04 12:51:53 +0000 |
commit | 02ed20bdc7e7801e81947b144f2e51dadc1fc072 (patch) | |
tree | b9832468bbe50dc7146aefcf695ea5a7f4d9a0f7 | |
parent | 11b54244a60443d7a5a8edd1deb13833e8d24e59 (diff) | |
download | gwtquery-02ed20bdc7e7801e81947b144f2e51dadc1fc072.tar.gz gwtquery-02ed20bdc7e7801e81947b144f2e51dadc1fc072.zip |
The method widget now accept the index of the widget to return
-rw-r--r-- | gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java index ee082eae..58e2227e 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java @@ -863,9 +863,11 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> { * </pre>
*
*/
- public GQuery css(CssSetter cssSetter) {
+ public GQuery css(CssSetter... cssSetter) {
for (Element e : elements()) {
- cssSetter.applyCss(e);
+ for (CssSetter s : cssSetter) {
+ s.applyCss(e);
+ }
}
return this;
}
@@ -2528,11 +2530,22 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> { * if there isn't any.
*/
public <W extends Widget> W widget() {
+ return widget(0);
+ }
+
+ /**
+ * Return the nth non null attached widget from the matched elements or null
+ * if there isn't any.
+ */
+ public <W extends Widget> W widget(int n) {
for (Element e : elements()) {
@SuppressWarnings("unchecked")
W w = (W) getAssociatedWidget(e);
if (w != null) {
- return w;
+ if (n == 0) {
+ return w;
+ }
+ n--;
}
}
return null;
|