From 715e08e4e7228f27cae55e602923f7fdb9d26463 Mon Sep 17 00:00:00 2001 From: Manolo Carrasco Date: Wed, 14 Sep 2011 12:14:54 +0000 Subject: Make data available in Function --- .../java/com/google/gwt/query/client/Function.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'gwtquery-core/src') 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 0792a2e5..1293071b 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 @@ -26,6 +26,7 @@ public abstract class Function { private com.google.gwt.dom.client.Element element = null; private Event event = null; private int index = -1; + private Object[] data = new Object[0]; public T getElement() { return element.cast(); @@ -48,6 +49,14 @@ public abstract class Function { index = i; } + public Object[] getData() { + return data; + } + + public void setData(Object...data) { + this.data = data; + } + public int getIndex() { return index; } @@ -130,11 +139,20 @@ public abstract class Function { return null; } + /** + * Override this method for bound callbacks + */ + public void f(Object... data) { + setData(data); + f(); + } + /** * Override this method for bound event handlers if you wish to deal with * per-handler user data. */ public boolean f(Event e, Object data) { + setData(data); setEvent(e); return f(e); } -- cgit v1.2.3