Hi, I am new to gwt also this event-handle programing model.  I am
trying to use gwt-presenter 1.1.1.  However, I have a few problems
with the eventbus.  The eventbus in gwt-presenter is actually realized
by HandlerManager.   I have a event (EventPage) firing for a page,
within the handling, it calls method B.  Within metod B, it makes an
AJAX call for some data, I realize it by calling C function, which
fire another event (EventData) when it receive the data.  Here is the
idea

eventbus.addHandler(EventPage.Type, new PageHandler(){

.....
B();
}
--------------------------------------------------------------------------------
eventbus.fire(new EventPage())
----------------------------------------------------------------------------------------
......
B(){
eventbus.addHandler(EventData.Type, new DataHandler(){
public void processData(EventData event){
...populate page with the data and show it.
....
});
C();
}
--------------------------------------------------------------------------
C(){
Ajax_call(new callback(){
...
public void onResponseReceived(Request request,
                                                Response response) {
process data,
eventbus.fire(new EventData())
}



My eventbus is an singleton in type of HandlerManager.  The problem is
the definition of B() is only accessible after fire EventPage.  In the
HandlerManager, there is one variable called firingDepth, it is 0 when
EventPage fires and 1 after.  When it is larger than 0, it always
quene the handler registration (addHandler(EventData)) and do not
register until back to firingDepth==0.  So when C() fires EventData(),
nothing happens because the handler has not registered yet (it will
not be until C() exits.)

What is the reason to put such a queue into HandlerManager?  Is there
anyway to get my problem fixed?  Thank you very much.

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

Reply via email to