Re: Activity how to react on event that is triggered in start-method

2012-04-25 Thread tanteanni
i think this is not the problem. first i register for event then i fetch the data that triggers the event. here is the code of start method: @Override public final void start(final AcceptsOneWidget panel, final com.google.gwt.event.shared.EventBus eventBus) { this.eb = new

Re: Activity how to react on event that is triggered in start-method

2012-04-25 Thread Chris Price
Ah yes, the code you pasted exactly fits the problem I described. The activity start method is called by the ActivityManager from within the PlaceChangeEvent.Handler [1]. The SimpleEventBus, uses deferred methods to only apply changes to the handler lists after the current round of events have

Re: Activity how to react on event that is triggered in start-method

2012-04-25 Thread tanteanni
Thanks! I understand (some time ago i had a similar problem but in my main-Class - it didn't react on first place change event) but the solution is ugly: ...Scheduler.get().scheduleFinally(new ScheduledCommand()... is there another way to get this working? i need the dataModel in start to

Re: Activity how to react on event that is triggered in start-method

2012-04-25 Thread Chris Price
I think your only two choices are to either avoid the event bus for the async data call, or as you suggest with the Scheduler. On Wed, Apr 25, 2012 at 7:54 AM, tanteanni tantea...@hotmail.com wrote: Thanks! I understand (some time ago i had a similar problem but in my main-Class - it didn't

Re: Activity how to react on event that is triggered in start-method

2012-04-25 Thread tanteanni
Ok so either i use Scheduler and loose test ability or i refactor and use a delegate/handler as used in async-services, right? (no answer means yes :-)) On Wednesday, 25 April 2012 09:11:22 UTC+2, Chris Price wrote: I think your only two choices are to either avoid the event bus for the

Re: Activity how to react on event that is triggered in start-method

2012-04-25 Thread Jens
Instead of using the EventBus you could also use a Callback in your StateResolver. Seems to me that only the class that calls stateResolver.resolve() is interested in the result, so there isn't a real need for using an application wide event bus. stateResolver.resolveState(, new Callback()

Re: Activity how to react on event that is triggered in start-method

2012-04-25 Thread tanteanni
you are right jens my first solution was a local eventbus - as you see my stateresolver takes an EventBus as argument - but this didn't work either. The current solution was copied from a gwt-example. i used the solution with callback in two of my other activities. but my feeling isn't very

Activity how to react on event that is triggered in start-method

2012-04-24 Thread tanteanni
i have an activity that needs another class to resolve the state (ids to real objects) brought by current place. this class' getData(StateObject) is called within start-method right after registering for the class' gotData-event. But the activitie's onGotData-data method isn't called the first

Re: Activity how to react on event that is triggered in start-method

2012-04-24 Thread Chris Price
Does your data fetch include the event bus in some way? If so you may be running into the problem that handler changes (adds/removes) are only applied after the current event has completed. In this case that event would be the place change eventually calling the activity start. Sorry for the lack