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
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.