aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java73
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/QueuePlugin.java4
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/EventsListener.java3
3 files changed, 74 insertions, 6 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java
index 08f6415d..ad6e1a75 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/Function.java
@@ -15,6 +15,7 @@
*/
package com.google.gwt.query.client;
+import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.query.client.js.JsUtils;
import com.google.gwt.user.client.Event;
@@ -177,8 +178,7 @@ public abstract class Function {
* Override this method for bound callbacks
*/
public void f(Object... data) {
- setData(data);
- f();
+ fe(data);
}
/**
@@ -267,4 +267,73 @@ public abstract class Function {
}
}
+ /**
+ * Methods fe(...) should be used from asynchronous contexts so as we can
+ * catch the exception and send it to the GWT UncaughtExceptionHandler.
+ * They are intentionally final to avoid override them
+ */
+ public final void fe() {
+ fe((Object)null);
+ }
+
+ /**
+ * Methods fe(...) should be used from asynchronous contexts so as we can
+ * catch the exception and send it to the GWT UncaughtExceptionHandler
+ * They are intentionally final to avoid override them
+ */
+ public final void fe(Object data) {
+ fe(new Object[]{data});
+ }
+
+ /**
+ * Methods fe(...) should be used from asynchronous contexts so as we can
+ * catch the exception and send it to the GWT UncaughtExceptionHandler
+ * They are intentionally final to avoid override them
+ */
+ public final void fe(Object... data) {
+ setData(data);
+ if (GWT.getUncaughtExceptionHandler() != null) {
+ try {
+ f();
+ } catch (Exception e) {
+ GWT.getUncaughtExceptionHandler().onUncaughtException(e);
+ }
+ return;
+ }
+ f();
+ }
+
+ /**
+ * Methods fe(...) should be used from asynchronous contexts so as we can
+ * catch the exception and send it to the GWT UncaughtExceptionHandler
+ * They are intentionally final to avoid override them
+ */
+ public final boolean fe(Event ev, Object data) {
+ if (GWT.getUncaughtExceptionHandler() != null) {
+ try {
+ return f(ev, data);
+ } catch (Exception e) {
+ GWT.getUncaughtExceptionHandler().onUncaughtException(e);
+ }
+ return true;
+ }
+ return f(ev, data);
+ }
+
+ /**
+ * Methods fe(...) should be used from asynchronous contexts so as we can
+ * catch the exception and send it to the GWT UncaughtExceptionHandler
+ * They are intentionally final to avoid override them
+ */
+ public final void fe(com.google.gwt.dom.client.Element elem) {
+ if (GWT.getUncaughtExceptionHandler() != null) {
+ try {
+ f(elem.<com.google.gwt.dom.client.Element>cast());
+ } catch (Exception e) {
+ GWT.getUncaughtExceptionHandler().onUncaughtException(e);
+ }
+ return;
+ }
+ f(elem.<com.google.gwt.dom.client.Element>cast());
+ }
}
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/QueuePlugin.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/QueuePlugin.java
index 3a461a27..dc97b4b3 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/QueuePlugin.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/QueuePlugin.java
@@ -262,7 +262,7 @@ public class QueuePlugin<T extends QueuePlugin<?>> extends GQuery {
Object f = q.peek();
if (f != null) {
if (f instanceof Function) {
- ((Function) f).f(elem.<com.google.gwt.dom.client.Element>cast());
+ ((Function) f).fe(elem);
}
}
}
@@ -279,7 +279,7 @@ public class QueuePlugin<T extends QueuePlugin<?>> extends GQuery {
q.add(func);
if (q.size() == 1) {
if (func instanceof Function) {
- ((Function) func).f(elem.<com.google.gwt.dom.client.Element>cast());
+ ((Function) func).fe(elem);
}
}
}
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/EventsListener.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/EventsListener.java
index 1328d77f..7699c476 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/EventsListener.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/events/EventsListener.java
@@ -71,7 +71,7 @@ public class EventsListener implements EventListener {
public boolean fire(Event event) {
if (times != 0) {
times--;
- return function.f(event, data);
+ return function.fe(event, data);
}
return true;
}
@@ -92,7 +92,6 @@ public class EventsListener implements EventListener {
*/
private static class LiveBindFunction extends BindFunction {
-
JsNamedArray<JsObjectArray<BindFunction>> bindFunctionBySelector;
LiveBindFunction(int type, String namespace) {