From: Manuel Carrasco MoƱino Date: Mon, 26 Nov 2012 07:57:34 +0000 (+0100) Subject: support IsWidget and List X-Git-Tag: release-1.3.2~37^2~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=42f8afc80dce6ea0fba7c41e28d551f9981462ca;p=gwtquery.git support IsWidget and List --- 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;