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:
- My call to the
placeHistoryHandler
'sregister(...)
method is showing up as being deprecated. Why is it deprecated and what should it be (as of GWT 2.5.1)? - Is there one
RootPanel
per module/EntryPoint
or is there only oneRootPanel
per GWT app (regardless of how many modules you have)? - What is the connection/relation between the
mainPanel
(above) that itself has been added to theRootPanel
, and theAcceptsOneWidget
that gets passed into eachAbstractActivity#start
method?
<body>
element. So there is exactly one.AcceptsOneWidget
to theRootPanel
. YourActivity
has to create its view and set it into theAcceptsOneWidget
passed to thestart()
Take a look at the Activity and Places section of gwtproject.org