Wednesday, June 23, 2010

Pass a method as parameter in GWT

Hi.
Im building a logic here that a class A instantiate a object of
another class B. B has a specified clickHandler that does a animation.
I want that the class A can pass a method to the class B as a
parameter to do the animation and some extra stuff that I wanna do in
the class A.
So I was thinking in something like that:

class A
Button trigger = new Button();
trigger.addClickHandler(new ClickHandler(){
//doStuff
callBack();
}

class B
A a = new A();
a.setCallBack(doThis());

public void doThis(){
Window.alert("test");
}

How can I do that in GWT?

Thanks for the attention
Cheers

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment