From 02ed20bdc7e7801e81947b144f2e51dadc1fc072 Mon Sep 17 00:00:00 2001 From: Manolo Carrasco Date: Fri, 4 Mar 2011 12:51:53 +0000 Subject: The method widget now accept the index of the widget to return --- .../main/java/com/google/gwt/query/client/GQuery.java | 19 ++++++++++++++++--- 1 file 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 { * * */ - 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 { * if there isn't any. */ public 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 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; -- cgit v1.2.3