Thanks Thomas. Your replies are always quick and helpful. 

Regarding your comment on my third point, the reason why I have external 
dependencies is because let's say my custom view has some custom table 
(Cell Table has some limitations so not using it). That means I can reuse 
the custom table in my parent view as a widget and can show multiple 
widgets based on different data I get from my parent Activity RPC call. 
Also I have a onMouseOver event which shows a custom pop-up like Netflix on 
a certain cell in each row.  I also have onClick event on a certain column 
in each row which basically need to take the user to a different place. I 
have no way to get hold of Place Controller in my Custom Widget for onClick 
event. What if one of my column has two radio buttons and onChange of that 
radio button should fire an event and update that value to the database. 
Again without ClientFactory I won't be able to make RPC call and hence I 
need a separate Presenter for that custom widget to handle the click events 
and have RPC call to make an update to DB. We clearly don't want RPC code 
inside custom widget file as that code will not be testable without 
GWTTestCases which I want to avoid.

So yea you are right, it is not just widget which simply shows data but it 
has user interactions but it is still consider a reusable custom widget. 

So your approach of parent view, child view, parent presenter which could 
be activity and child presenter is mentioned in this thread? : 
https://groups.google.com/forum/?fromgroups=#!searchin/google-web-toolkit/composite$20views$20using$20MVP/google-web-toolkit/yHLSA881wsM/c0iQq7JSJRQJ

Please advise. 

On Wednesday, September 12, 2012 11:12:41 AM UTC-5, Thomas Broyer wrote:
>
>
> On Wednesday, September 12, 2012 6:04:04 PM UTC+2, BM wrote:
>>
>> Hi Jens,
>> Thanks for replying back with an example. You answered what I am needing 
>> for. So that definitely helps. I kind of thought about this approach but 
>> couple of things I found here which I am not sure is better way to do that.
>>
>> 1) My presenter would need additional dependencies like ClientFactory, 
>> EventBus. That means my MyCustomWidget need to have ClientFactory, EventBus 
>> so that I can pass them to the Presenter. Considering we want to make our 
>> MVP Views as dumb as possible and have only GWT widget code inside is this 
>> okay to include ClientFactory, EventBus in your View class now?
>>
>
> Why not?
> (that wouldn't be my preferred approach if you ask me)
>  
>
>> 2) If you see the classic GWT MVP view, Place instantiates an Activity 
>> class passing ClientFactory in it's constructor and Activity class start 
>> method uses ClientFactory to get the view and assign itself inside the view 
>> as it's presenter. Whereas your way is opposite where your Composite View 
>> class is instantiating Activity through it's constructor and passing itself 
>> to the Presenter.
>>
>
> Yes.
> FYI, CellTable, CellList, etc. use MVP internally, with the view 
> constructing the presenter (simplifying a bit), as Jens suggested.
>
> 3) If I am referencing this Custom Composite View MyCustomWidget in 
>> another Ui Binder View how do I pass ClientFactory, EventBus to 
>> this MyCustomWidget using UIBinder? That means I have to 
>> pass ClientFactory, EventBus to every Parent View so that it can get passed 
>> to the  MyCustomWidget if that view is using it. This kind of differs to 
>> existing Activities & Places framework where MVP View doesn't 
>> hold ClientFactory, EventBus objects but it's Activity class do.
>>
>> What do you think?
>>>
>>>
>>>
> When you have such external dependencies, it's clear that these components 
> are not "just widgets". In that case, I'd rather follow the Wave way: 
> "parent view" creates the "child view", "parent presenter" creates the 
> "child presenter" giving it its "child view" retrieved from the "parent 
> view".
> See 
> http://www.google.com/events/io/2010/sessions/gwt-continuous-build-testing.html
>

-- 
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/-/iZcOzlQJtSUJ.
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