Hi, I find your post quite interesting. I'm being stuck with similar
questions for a while. Is amazing how an app can become a big mess in
no time.

There are a few questions / thoughts I've about your design.

> In my opinion, a presenter should NOT attach the corresponding view to
> DOM or a container presenter itself.
>
> public interface Presenter {
>         public Viewable bind(Place place);
>         public void unbind(Place place);
>
> }
>
> public interface Container extends Presenter {
>         public void showChild(Place place, Viewable childView);
>         public void closeChild(Place place, Viewable childView);
>
> }
...
> In my Place Service implementation, Place Service knows the dependency
> between presenters but not presenter themselves. Therefore, when a
> view been required, Place Service will call the Presenter.bind(Place
> place) function to ask the corresponding Presenter to provide a View
> instance.

You need to know before hand that this presenter provides a Viewable
for that Place.So providing the place here seems to my a bit
redundant.
Unless you expect the Presenter to be a Container. But in that case I
think the showChild(Place place, Viewable childView) may be enough.


> (3).
> Besides controller simple presenters, a Place Service should provide
> automatic (invisible to Presenters) bind/unbind support to complex
> dependency graph. E.g.
> Root (C)
>     - Header (P)
>     - PageContainer (C)
>         - Login (P)
>         - Main (C)
>             - Page1 (P)
>             - Page2 (P)
>             - Page3 (P)
>             - ...
>     - Footer (P)
>
> To build this kind of complex graph, I've created a Place Binder to
> simplify configuration and used a GIN module to centralize them.

How do you implement this Place Binder? Are you using the GWT
Generator to generate code at compilation time. Or is more like you
instantiated all the views first with the presenters using GIN, and
then defining the layout in some way you can recall when needed. Is a
bit unclear since you seem to be binding instances (so needs to be at
Runtime) but a bit down the "generate" code seems to be static.

Could be great if you can provide an example application using your
framework. Or give more insights in the Place Binder. I think is a
great idea to be able to define the layout in that manner.


Best regards
- Fran



>
> // setToRoot is a special function to let place service know when to
> stop scanning.
> bind(root).serve(Places.ROOT).setToRoot().contains(Places.Header,
> Places.PageContainer, Places.Footer);
> bind(header).serve(Places.HEADER);
> bind(pageContainer).serve(Places.PAGE_CONTAINER).contains(Places.Login,
> Places.Main);
>
> // setToDefault make the current presenter default entry of
> application (If history token is not specified by user)
> bind(login).serve(Places.LOGIN).setToDefault();
>
> // contains function can take a Place class type instead of specific
> instance, this way any Place extends PagePlace will be handled by
> MainPresenter.
> bind(main).serve(Places.MAIN).contains(PagePlace.class);
> bind(page1).serve(Pages.PAGE1);
> bind(page2).serve(Pages.PAGE2);
> bind(page3).serve(Pages.PAGE3);
> bind(footer).serve(Places.FOOTER);
>
> After configuring the graph, we can navigate to any HistoryPlace
> through Place Service API or browser URL now.
> e.g.
> "placeService.go();" in the entry point will lead PlaceService
> actually call following functions automatically to display all
> required views on screen.
> LoginPresenter.bind(Places.LOGIN);
> PageContainer.bind(Places.PAGE_CONTAINER); // Place Service found out
> LOGIN page depend on PAGE_CONTAINER and PAGE_CONTAINER is not bound
> yet.
> PageContainer.showChild(Places.LOGIN, loginView); // Place Service
> tell PAGE_CONTAINER to display login view.
> RootContainer.bind(Places.ROOT); // Bind the root view
> rootPanelService.get().add(rootView); // Attach the root view
> RootContainer.showChild(Places.PAGE_CONTAINER, pageContainerView);
> HeaderPresenter.bind(Places.HEADER); // Place Service detect all the
> dependency and bind all required views automatically.
> RootContainer.showChild(Places.HEADER, headerView);
> HeaderPresenter.bind(Places.FOOTER);
> RootContainer.showChild(Places.FOOTER, headerView);
>
> When user successfully login, loginPresenter calls
> "placeService.go(Pages.PAGE1)" Place Service will detect shared
> ancestor of both branches and tell all containers in the branch
> current view belongs to close the child.
> PageContainer.closeChild(Places.LOGIN, loginView);
> LoginPresenter.unbind(Places.LOGIN); // By default, unbind() function
> will be called when a view closed;
> Page1Presenter.bind(Pages.PAGE1);
> MainContainer.bind(Places.MAIN);
> MainContainer.showChild(Pages.PAGE1, page1View);
> PageContainer.showChild(Places.MAIN, mainView);
>
> Cheers,
> Jiang Zhu

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" 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-web-toolkit?hl=en.

Reply via email to