Because when you have a presenter that uses another presenter, you should wire than by interfaces. Consider that you have to test a presenter A that has references to presenters B and C, using interfaces you can test presenter A providing mocks of presenters B and C.
Best regards, Eduardo S. Nunes On Tue, Aug 18, 2009 at 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 > > > -- Eduardo S. Nunes http://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 -~----------~----~----~----~------~----~------~--~---
