Thank you for your replies.
Thomas, it was me who misunderstood your answer ;-). So are saying that if
view is calling fetchXxx it is actually "fetching" data. So, I can rename
then method from fetchXxx to onDataNeeds and its fine? But back to the
problem, whats best solution (just interface with methods) for following
situation:
1) Presenter is starting view.
2) View is building some widgets, components etc.
3) One widget need to be fill with data of EntityProxy (so call to
presenter is needed).
4) After having a response, view continues to build more widget according
results.
5) For some extra widgets view has created, we need another bunch of data
based on concrete EntityProxy (so call for extra data).
6) That widgets need to be filled after response from presenter is received.
Because of asynchronous communication, there must be defined "setter
methods" on the view (if I don't use callbacks from the view, eg Receiver)
for setting the reponses. These methods tends to be a little problematic
because you probably have to find right widget the response is concerned to
(this is not needed with callbacks because you have your final variables
available). And this is my problem.
Am I really violating MVP design with the callbacks? Because this "finding"
of widgets / elements after response is received can be time consuming.
Solution with callbacks.
interface presenter {
onDataNeeds(Receiver callback);
onExtraDataNeeds(EntityProxy item, Receiver callback);
}
No special methods on view. But without callbacks, there must be two setter
methods, eg:
interface view {
setData(data);
setExtraData(EntityProxy item);
}
You need to find correct widget in setExtraData according item. You cannot
pass widget information to presenter. And for example if you have table and
want to modify some row, you have to go through it and find that row based
on EntityProxy item.
Zdenek
On Tue, Feb 7, 2012 at 5:16 PM, Thomas Broyer <[email protected]> wrote:
>
>
> On Tuesday, February 7, 2012 3:09:36 PM UTC+1, Zdenek wrote:
>>
>> 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<http://code.google.com/webtoolkit/doc/latest/DevGuideMvpActivitiesAndPlaces.html>
>>
>>
>
> Places and Activities, despite what can be said in the docs, have nothing
> to do with MVP (you can very well make an Activity that doesn't use MVP).
> Whether you use Activities or not (e.g. following the "part II" tutorial)
> doesn't change your question.
>
> - 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.
>>
>
> You're defining fetchXxx methods on your presenter, to be called by the
> view, so the view indeed is "fetching" data (through the presenter, but
> that doesn't change the problem).
>
> --
> 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/-/kNo1dJyZRVEJ.
>
> 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.