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 good with it - i never use the eventbus given in start - 
why is there an eventbus?. because of this uncertainty i opened the other 
thread<https://groups.google.com/forum/?fromgroups#!topic/google-web-toolkit/ktF5b1jLxtY>.
 
I thought resolving a string /token to a model(that needs more than just 
call one service - probably i should refactor the services :-|) is a more 
usual use case.

So i guess i will refactor it and use a delegate to handle the callback.

On Wednesday, 25 April 2012 10:49:52 UTC+2, Jens wrote:
>
> 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() {
>   void onSuccess() {
>     //call method that handles the state
>    }
> });
>
> Or you implement the Callback interface directly in your Activity (but 
> then I would rename it to StateResolverPeer.stateResolved(T state) or 
> something like that) and then simply call stateResolver.resolveState(...., 
> this).
>
> If there is a 1:1 relation I would not use event bus in most cases.
>
> -- J.
>

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

Reply via email to