Hey Guys, I am also interested in an implementation of GWT 2.1 MVP using GIN.
I have made some head way with it. This has been done mostly by extending the ActivityManager, PlaceController and PlaceHistoryHandler classes and overriding their constructors to use GIN injection. I don't know if this is the correct implementation and if anyone has comments please let me know. But I have been able to remove the need for the ClientFactory and use GIN injection to instantiate everything but the Activity classes. However, I do not know how to tackle the ActivityMapper class. As Tolga says how do we replace the nested if statement with a GIN module? I would much prefer to be able to instantiate the Activity Class this way as I am using the SecureDispatchAsync as would like to use DI to pass it to the Activity. Regards, Aigeec On Oct 20, 1:31 am, Tolga Tarhan <[email protected]> wrote: > Folks, > > I'm trying to make GWT 2.1 MVP work nicely with GIN. It looks like this use > case was specifically considered when > creating PlaceHistoryMapperWithFactory, but no such thing seems to exist for > ActivityMapper. There is a passing reference to using Gin in > DevGuideMvpActivitiesAndPlaces.html , where it says "... ClientFactory is > used by HelloActivity to obtain a reference to the HelloView as well as the > EventBus and PlaceController. Any of these could alternatively be injected > via GIN." and also when it says "A better way to implement the chain of > nested ifs would be with a GIN module", in reference to ActivityMapper. > > The problem, however, is that we cannot both inject application-level > objects (EventBus, PlaceController, etc) and also pass the Place as > constructor arguments to the Activity. We could have all of the dependencies > for every Activity (like all the views) injected into our ActivityMapper and > pass them thru, but this leaks a lot of details into what should be a very > simple mapper class. If done incorrectly, it would also cause code-splitting > issues. > > One way around this is to inject a Provider<MyActivity> or > AsyncProvider<MyActivity> in the ActivityMapper and then do something like > myActivityProvider.get().initPlace(place) - which is like the assisted > injection that's discussed in the Guice docs. I'm wondering if there's a > more elegant way that was considered? > > Additionally, I'm not sure I understand how to "implement the chain of > nested ifs" in a GIN module. This sounds like a great idea, but what did you > have in mind to make GIN do this for us? We can have GIN differentiate on a > bunch of things (annotations, generics, interfaces, etc), but I don't know > how you could replace the if-block with GIN. Could someone point me in the > right direction here? > > Thanks, > Tolga -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
