Hi Thomas,
AHHA !! Thank you very much!! Finally I understood it!! I owe you
one.

I think I was getting confused with the term "activity". You helped me
clear the doubt that my presenter can act itself as a presenter or
presenter + activity together.

Now I understood what you meant by "mock HasXxxHandlers" and why it is
so painful.

Seriously thanks a bunch! I appreciate it and that's what I love about
this community.

On Sep 2, 11:02 am, Thomas Broyer <t.bro...@gmail.com> wrote:
> I'm sorry I don't understand; the code from the article (and the "Activities
> and Places" page from the documentation) speaks for itself.
>
> interface Presenter: defines methods called by the view (generally in
> response to user events)
> interface View: defines methods called by the presenter to update the view +
> defines a setPresenter(Presenter) method.
>
> class MyPresenter: implements the Presenter interface, receives a View in
> its constructor. At one point, calls the view.setPresenter(this) (if
> MyPresenter is an activity, you'd probably do that in the start() method;
> and I like calling view.setPresenter(null) in onStop and onCancel so it
> "cleans things up after itself")
> class MyView: implements the View interface. When it needs to talk to the
> presenter, it uses the one previously set by a call to setPresenter.
>
> MyPresenter doesn't know MyView, only View; and MyView doesn't know
> MyPresenter, only Presenter. But MyPresenter and MyView both have a
> reference to the other (through the View and Presenter interfaces; the View
> received in the Presenter's constructor, and the Presenter receivedin the
> View's setPresenter)
>
> When you test MyPresenter, you mock View, and call methods from the
> implemented Presenter interface to simulate user actions on the view.
>
> (note: this is how many people do; if you prefer injecting the presenter
> into the view, injecting it with a setter rather than the constructor, etc.
> feel free to do it the way you like it, the way feel comfortable with)

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to