看哪,我的第一个 GWT 应用的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();
}
}
几个问题:
- 我对
placeHistoryHandler
'sregister(...)
方法的调用显示为已弃用。为什么不推荐使用它,它应该是什么(从 GWT 2.5.1 开始)? - 每个模块有一个
RootPanel
/或者EntryPoint
RootPanel
每个 GWT 应用程序只有一个(不管你有多少模块)? mainPanel
本身已添加到 的(上面)RootPanel
与AcceptsOneWidget
传递给每个AbstractActivity#start
方法的 之间的连接/关系是什么?