Hi! I've been using a variation of Eduardo's implemantation for a while, and it works great.
In my application I'm using setters and a initialize method. Unfortunately GIN doesn't support Assisted Injection, as Guice do, so no go for immutable objects. Regards, Tercio On Aug 18, 9:03 am, Alen Vrecko <[email protected]> wrote: > I've looked at it some weeks ago. It would be nice if you added some > tests for your example. I am wondering why do you have an interface > for the presenter and not just a concrete class? > > Cheers, > Alen > > On Aug 18, 6:06 am, Eduardo Nunes <[email protected]> wrote: > > > > > I would recommend both of you take a look > > inhttp://gwt-mvp-sample.googlecode.com > > It's an implementation and sample application using the MVP pattern. > > I'm working on a new version and I will publish it as soon as > > possible. > > > Best regards, > > Eduardo S. Nunes > > > On Mon, Aug 17, 2009 at 5:23 PM, Alen Vrecko<[email protected]> wrote: > > > > I am in a similar situation. Have some displays containing other > > > displays. I am also using setters. But this is what I am experimenting > > > with: > > > > I have a Document editing UI that takes a file browser ui (each > > > document can have corresponding files) and a single file upload ui. > > > This is how it looks like: > > > > // other presenters are injected > > > DocumentEditor(Presenter) is ctor injected with > > > +FileBrowserPresenter > > > +SingleFileUploadPresenter > > > +RpcService > > > +EventBus > > > > // the presenter is injected with the presenter > > > DocumentEditorWidget is ctor injected with > > > +DocumentEditorPresenter > > > +SingleFileUploadWidget // created via new > > > +FileBrowserWidget // created via new > > > > that is right. I made the widget have a strong dependency on the > > > presenter. I see the Presenter/View a wholesome unit. Where logic from > > > the UI has been factored out in the presenter. > > > > This is different from what is presented at the slides > > > > PhoneEditWidget phoneEditWidget = new PhoneEditWidget(); > > > PhoneEditor phoneEditor = new PhoneEditor(phoneEditWidget, > > > rpcService); > > > > I am doing > > > > PhoneEditor phoneEditor = new PhoneEditor(phoneEditWidget, > > > rpcService); > > > PhoneEditWidget phoneEditWidget = new PhoneEditWidget(phoneEditor); > > > > I can then do > > > > @Inject Provider<DocumentEditorWidget> documentEditors; > > > panel.add(documentEditors.get()); > > > > with no problems. > > > > the bindDisplay and display of DocumentEditor look like > > > > public static interface Display{ > > > ... > > > FileBrowser.Display getFileBrowser(); > > > SingleFileUpload.Display getUpload(); > > > } > > > > public void bindDisplay(Display display) { > > > ... > > > fileBrowserPresenter.bindDisplay(display.getFileBrowser()); > > > uploadPresenter.bindDisplay(display.getUpload()); > > > } > > > > I can't really call this a best practice. Will see what the code will > > > tell me after some more time. Am also interested in what other people > > > are doing. > > > > Cheers > > > Alen > > > -- > > Eduardo S. Nuneshttp://e-nunes.com.br --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-guice" 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-guice?hl=en -~----------~----~----~----~------~----~------~--~---
