Thank you for your reply. I probably didn't describe my question exactly
because you misunderstood it completelly.

I'm talking about GWT MVP approach through Places & Activities -
http://code.google.com/webtoolkit/doc/latest/DevGuideMvpActivitiesAndPlaces.html


- I'm providing fully MVP friendly interfaces that looks nearly same as in
that article (View implements it and activity implements its Presenter
interface part).
- I'm not talking about fetching data in views anywhere in my question,
only whether view can pass Receiver into Activity.

Regards,
Zdenek

On Tue, Feb 7, 2012 at 2:58 PM, Thomas Broyer <[email protected]> wrote:

>
>
> On Tuesday, February 7, 2012 1:12:04 PM UTC+1, Zdenek wrote:
>>
>> Hi! I have simple question about Places & Activities. I'd like to know
>> how asynchronous calls (through RequestFactory) should be made, what's the
>> best practice.
>
>
> First, your questions are about MVP, not about Places or Activities.
>
> 1) Is good to control loading from the view? I mean passing receiver from
>> the view to the activity to be able to act on onSuccess?
>>
>> public interface MyView extends IsWidget {
>> void setPresenter(Presenter presenter);
>>
>> public interface Presenter {
>> void goTo(Place place);
>> void fetchSomeData(Receiver<List<**SomeDataProxy>> receiver);
>> void fetchSomeDataMore(**SomeDataProxy someData, 
>> Receiver<List<**SomeDataMoreProxy>>
>> receiver);
>> }
>> }
>>
>> 2) Or should I go without passing receiver and define two-way
>> communication? (IMO this approach's worse than 1st one)
>>
>> public interface MyView extends IsWidget {
>> void setPresenter(Presenter presenter);
>> void setSomeData(List<**SomeDataProxy> someData);
>> void setSomeDataMore(List<**SomeDataMoreProxy> someDataMore);
>>
>> public interface Presenter {
>> void goTo(Place place);
>> void fetchSomeData();
>> void fetchSomeDataMore(**SomeDataProxy someData);
>> }
>> }
>>
>
> Your view shouldn't "fetch" data, that's the role of the presenter. The
> presenter should "drive" the view, not the other way around. The view's
> responsibility (besides displaying things) is to route user-initiated
> events to the presenter so it can react to them.
>
> Same for your goTo(Place) method: the view should tell the presenter that
> some link/button/whatever has been "actioned", and the presenter translates
> that into a Place and a call to PlaceController#goTo.
>
> --
> 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/-/sNxXHwQip9gJ.
>
> 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.
>



-- 
S pozdravem
Zdeněk Doležal

-- 
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