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
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---