From 1c9c2236c15156e6bb3fce72ecb498786b4df9de Mon Sep 17 00:00:00 2001 From: Manolo Carrasco Date: Thu, 15 Mar 2012 10:07:17 +0000 Subject: [PATCH] Rename class --- .../main/java/gwtquery/jsquery/client/JsMenu.java | 2 +- .../java/gwtquery/jsquery/client/JsQuery.java | 2 +- .../gwtquery/jsquery/client/OverlayGQuery.java | 10 +++++----- .../utils/{JsQAux.java => JsQueryUtils.java} | 15 +++++++++------ 4 files changed, 16 insertions(+), 13 deletions(-) rename jsquery/src/main/java/gwtquery/jsquery/client/utils/{JsQAux.java => JsQueryUtils.java} (90%) diff --git a/jsquery/src/main/java/gwtquery/jsquery/client/JsMenu.java b/jsquery/src/main/java/gwtquery/jsquery/client/JsMenu.java index 7051a711..1312cc55 100644 --- a/jsquery/src/main/java/gwtquery/jsquery/client/JsMenu.java +++ b/jsquery/src/main/java/gwtquery/jsquery/client/JsMenu.java @@ -3,7 +3,7 @@ package gwtquery.jsquery.client; public abstract class JsMenu { public static native void loadPlugin() /*-{ - var l = @gwtquery.jsquery.client.utils.JsQAux::log(Ljava/lang/Object;); + var l = @gwtquery.jsquery.client.utils.JsQueryUtils::log(Ljava/lang/Object;); var window = $wnd; var document = $doc; var jQuery = $wnd.$; diff --git a/jsquery/src/main/java/gwtquery/jsquery/client/JsQuery.java b/jsquery/src/main/java/gwtquery/jsquery/client/JsQuery.java index 2180b5bb..ad15715a 100644 --- a/jsquery/src/main/java/gwtquery/jsquery/client/JsQuery.java +++ b/jsquery/src/main/java/gwtquery/jsquery/client/JsQuery.java @@ -26,7 +26,7 @@ public class JsQuery implements EntryPoint { } private native static void testJs() /*-{ - var l = @gwtquery.jsquery.client.utils.JsQAux::log(Ljava/lang/Object;); + var l = @gwtquery.jsquery.client.utils.JsQueryUtils::log(Ljava/lang/Object;); l($.each); $.each(["a","b"], function(a, b){ l("kk " + " " + a + " " + b); diff --git a/jsquery/src/main/java/gwtquery/jsquery/client/OverlayGQuery.java b/jsquery/src/main/java/gwtquery/jsquery/client/OverlayGQuery.java index 8515883c..4708212f 100644 --- a/jsquery/src/main/java/gwtquery/jsquery/client/OverlayGQuery.java +++ b/jsquery/src/main/java/gwtquery/jsquery/client/OverlayGQuery.java @@ -1,6 +1,6 @@ package gwtquery.jsquery.client; -import gwtquery.jsquery.client.utils.JsQAux; +import gwtquery.jsquery.client.utils.JsQueryUtils; import org.timepedia.exporter.client.Export; import org.timepedia.exporter.client.ExportAfterCreateMethod; @@ -84,7 +84,7 @@ public class OverlayGQuery implements ExportOverlay { @ExportStaticMethod("$wnd.$") public static GQuery $(Object o) { - return JsQAux.dollar(o); + return JsQueryUtils.dollar(o); } @ExportStaticMethod("$wnd.$") @@ -94,17 +94,17 @@ public class OverlayGQuery implements ExportOverlay { @ExportStaticMethod("$wnd.$.extend") public static JavaScriptObject extend(Object...objs) { - return JsQAux.extend(objs); + return JsQueryUtils.extend(objs); } @ExportStaticMethod("$wnd.$.each") public static JavaScriptObject[] each(JavaScriptObject[] objs, Function f) { - return JsQAux.each(objs, f); + return JsQueryUtils.each(objs, f); } @ExportStaticMethod("$wnd.$.inArray") public static int inArray(Object o, Object arr) { - return JsQAux.inArray(o, arr); + return JsQueryUtils.inArray(o, arr); } @ExportInstanceMethod diff --git a/jsquery/src/main/java/gwtquery/jsquery/client/utils/JsQAux.java b/jsquery/src/main/java/gwtquery/jsquery/client/utils/JsQueryUtils.java similarity index 90% rename from jsquery/src/main/java/gwtquery/jsquery/client/utils/JsQAux.java rename to jsquery/src/main/java/gwtquery/jsquery/client/utils/JsQueryUtils.java index a4748647..5025f61b 100644 --- a/jsquery/src/main/java/gwtquery/jsquery/client/utils/JsQAux.java +++ b/jsquery/src/main/java/gwtquery/jsquery/client/utils/JsQueryUtils.java @@ -12,7 +12,14 @@ import com.google.gwt.query.client.js.JsCache; import com.google.gwt.query.client.js.JsNodeArray; import com.google.gwt.query.client.js.JsUtils; -public abstract class JsQAux { +/** + * These are a set of utility methods needed in jsquery because + * either they are not in the GQuery core yet, or they are already + * there but we need to modify their behavior. + * Most of them should be moved to the GQuery core api. + * + */ +public abstract class JsQueryUtils { private native static String dumpObject(JavaScriptObject o) /*-{ var s = ""; @@ -21,17 +28,13 @@ public abstract class JsQAux { return s; }-*/; - private static native void runJsFunction(JavaScriptObject f) /*-{ - f(); - }-*/; - public static GQuery dollar(Object o) { if (o instanceof String) { return GQuery.$((String) o); } else if (o instanceof JavaScriptObject) { JavaScriptObject jso = (JavaScriptObject) o; if (JsUtils.isFunction(jso)) { - runJsFunction(jso); + new JsUtils.JsFunction(jso).fe(); } else { GQuery r = GQuery.$(jso); if (JsUtils.isArray(jso)) { -- 2.39.5