From 42f8afc80dce6ea0fba7c41e28d551f9981462ca Mon Sep 17 00:00:00 2001 From: =?utf8?q?Manuel=20Carrasco=20Mo=C3=B1ino?= Date: Mon, 26 Nov 2012 08:57:34 +0100 Subject: [PATCH] support IsWidget and List --- .../main/java/com/google/gwt/query/client/GQuery.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 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 e5e86de4..e0655c91 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 @@ -64,6 +64,7 @@ import com.google.gwt.user.client.Event; import com.google.gwt.user.client.EventListener; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.GqUi; +import com.google.gwt.user.client.ui.IsWidget; import com.google.gwt.user.client.ui.Widget; /** @@ -270,8 +271,8 @@ public class GQuery implements Lazy { if (o instanceof JavaScriptObject) { return $((JavaScriptObject)o); } - if (o instanceof Widget) { - return $(new Widget[]{(Widget)o}); + if (o instanceof IsWidget) { + return $(Arrays.asList(o)); } System.err.println("GQuery.$(Object o) could not wrap the type : " + o.getClass()); } @@ -287,8 +288,8 @@ public class GQuery implements Lazy { for (Object o : nodesOrWidgets) { if (o instanceof Node) { elms.addNode((Node) o); - } else if (o instanceof Widget) { - elms.addNode(((Widget) o).getElement()); + } else if (o instanceof IsWidget) { + elms.addNode(((IsWidget)o).asWidget().getElement()); } } } @@ -574,7 +575,7 @@ public class GQuery implements Lazy { } } catch (Exception e2) { // Some times this code could raise an exception. - // We do not want GQuery to fail, but in dev-move we log the error. + // We do not want GQuery to fail, but in dev-mode we log the error. e2.printStackTrace(); } return null; -- 2.39.5