Say I want to create a GWT app that consists of two simple "screens":
- A Main Menu that users see when the app first starts up (they go to specific URL) - forget login screens, etc., for this simple example; and
- An Edit Preferences "page"/screen/view that takes the place of the Main Menu when the user clicks a button on the Main Menu; this Edit Preferences screen also has a button that takes the user back to the Main Menu; thus
- The user can simply go back and forth between the Main Menu and Edit Preference "pages" (this is GWT so its actually a single-page app) all day long
So the pseudo-code for this might look like:
public class MainMenuPresenter implements Presenter {
// mainMenuScreen may be a Composite that contains a Button for
// switching/navigating to the EditPreferencesView
private MainMenuView mainMenuScreen;
}
public class EditPreferencesPresenter implements Presenter {
// editPrefsScreen may be a Composite that contains a Button for
// switching/navigating back to the MainMenuView
private EditPreferencesView editPrefsScreen;
}
Questions:
- How does a
Place
and its associatedActivities
fit into this paradigm? If it's a choice between MVP and Places/Activities, then how would this example look using the Activities/Places paradigm? - If MVP and Activities/Places can play nicely together (and are not mutually exclusive), then how could we implement GWT's History API here so that we can set
MainMenuView
as one "place" in history,EditPreferencesView
as a second "place", and then allow the user to hit the Back/Forward browser buttons and keep toggling between them? - If MVP and Activities/Places are mutually exclusive, and I have to choose between the two, is there anything different about the code in Question #2 above that needs to change?
I'm also interested in how a Place
ties into an ActivityManager
, and how/who fires/handles PlaceChangeEvents
, but I'll save that for later; I need to understand these concepts before I can move on to those. Thanks in advance!