aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManolo Carrasco <manolo@apache.org>2011-03-04 12:51:53 +0000
committerManolo Carrasco <manolo@apache.org>2011-03-04 12:51:53 +0000
commit02ed20bdc7e7801e81947b144f2e51dadc1fc072 (patch)
treeb9832468bbe50dc7146aefcf695ea5a7f4d9a0f7
parent11b54244a60443d7a5a8edd1deb13833e8d24e59 (diff)
downloadgwtquery-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.java19
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;