Activity/Places is not MVP. An Activity is just something abstract that
starts for a given place. What you do in your Activity can by anything. In
most examples you see an Activity that is used as Presenter for the View
the Activity reveals. In most cases that makes sense but you are not forced
to do so. The Activity could also hold a reference to a presenter or only
reveal a common widget as view that internally does MVP. So please don't
think of MVP automatically when talking about Activities and Places.
In case of your Menubar you could do the same as CellTable does:
Instantiate a hidden presenter that contains the logic you want to split
out of the view (see HasDataPresenter and AbstractHasData). That way your
Menubar uses MVP as an implementation detail.
public MenuBar() {
presenter = new MenuBarPresenter(this); //or use GIN
}
@UiHandler
void onMenuItemClicked(ClickEvent e) {
presenter.goToMenuItem(...);
}
public void setItems(List<Items> items) {
presenter.setItems(items);
}
As the Menubar is always visible I would not create an
ActivityMapper/Activity for it. It would just sit hardcoded in the most
outer app UI, listening for PlaceChangeEvents so it can highlight the
current menu item and calling PlaceController.goTo() when an item is
clicked.
-- J.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.