aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManolo Carrasco <manolo@apache.org>2012-03-15 09:57:24 +0000
committerManolo Carrasco <manolo@apache.org>2012-03-15 09:57:24 +0000
commit87a50b9638d27a578f5ff1289581d31b7653b3df (patch)
treebdd48dd08cd1434ce1c0ec81aad7ceada42409b0
parent334d9f88bc8e625e7eab6c0ce8450c7aa7066126 (diff)
downloadgwtquery-87a50b9638d27a578f5ff1289581d31b7653b3df.tar.gz
gwtquery-87a50b9638d27a578f5ff1289581d31b7653b3df.zip
move JsFunction to JsUtils and make it public
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilderBase.java9
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java18
2 files changed, 19 insertions, 8 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilderBase.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilderBase.java
index 8620501a..e1064332 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilderBase.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonBuilderBase.java
@@ -90,14 +90,7 @@ public abstract class JsonBuilderBase<J extends JsonBuilderBase<?>> implements J
return (Function)o;
} else if (o instanceof JavaScriptObject
&& JsUtils.isFunction((JavaScriptObject)o)) {
- return new Function() {
- private native void exec(JavaScriptObject f, Object data) /*-{
- f(data);
- }-*/;
- public void f() {
- exec((JavaScriptObject)o, getData()[0]);
- }
- };
+ return new JsUtils.JsFunction((JavaScriptObject)o);
}
}
return null;
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java
index b8c3e4e3..488e693b 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/js/JsUtils.java
@@ -22,6 +22,7 @@ import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Node;
import com.google.gwt.dom.client.NodeList;
+import com.google.gwt.query.client.Function;
import com.google.gwt.query.client.GQuery;
import com.google.gwt.query.client.Properties;
import com.google.gwt.user.client.DOM;
@@ -33,6 +34,23 @@ public class JsUtils {
private static JsUtilsImpl utilsImpl = GWT.create(JsUtilsImpl.class);
+ public static class JsFunction extends Function {
+ private JavaScriptObject jso = null;
+ public JsFunction(JavaScriptObject f) {
+ if (JsUtils.isFunction(f)) {
+ jso = f;
+ }
+ }
+ private native void exec(JavaScriptObject f, Object data) /*-{
+ f(data);
+ }-*/;
+ public void f() {
+ if (jso != null) {
+ exec(jso, getData()[0]);
+ }
+ }
+ }
+
public static class JsUtilsImpl {
public native Element parseXML(String xml) /*-{
return new DOMParser().parseFromString(xml, "text/xml").documentElement;