Behold, my first GWT app's EntryPoint
impl:
public class MyModule implements EntryPoint {
private SimplePanel mainPanel = new SimplePanel();
@Override
public void onModuleLoad() {
// Extract all root-level dependencies from the injector.
// Using Gin here.
EventBus eventBus = injector.getEventBus();
PlaceController placeController = injector.getPlaceController();
SignInEventListener signInEventListener = injector.getSignInEventListener();
PlaceHistoryMapper placeHistoryMapper = injector.getPlaceHistoryMapper();
// Start the activity manager.
activityManager = new ActivityManager(signInEventListener, eventBus);
activityManager.setDisplay(mainPanel);
// Start the place history mapper.
placeHistoryHandler = new PlaceHistoryHandler(placeHistoryMapper);
placeHistoryHandler.register(placeController, eventBus, startingPlace);
// Add the main panel to the RootPanel.
RootPanel.get().add(mainPanel);
// Navigate to the place represented by the current URL, otherwise the startingPlace.
placeHistoryHandler.handleCurrentHistory();
}
}
Several questions:
placeHistoryHandler
's register(...)
method is showing up as being deprecated. Why is it deprecated and what should it be (as of GWT 2.5.1)?RootPanel
per module/EntryPoint
or is there only one RootPanel
per GWT app (regardless of how many modules you have)?mainPanel
(above) that itself has been added to the RootPanel
, and the AcceptsOneWidget
that gets passed into each AbstractActivity#start
method?<body>
element. So there is exactly one.AcceptsOneWidget
to the RootPanel
. Your Activity
has to create its view and set it into the AcceptsOneWidget
passed to the start()
Take a look at the Activity and Places section of gwtproject.org