I have a GWT app that I ported to GWT 2.4. Now I geta deprecated warning on this line:
historyHandler.register(placeController, eventBus, defaultPlace);
“The method register(PlaceController, EventBus, Place) from the type PlaceHistoryHandler is deprecated”
Is there a better way to achieve the same result here or is it safe to ignore the warning?
public void onModuleLoad()
{
// Create ClientFactory using deferred binding so we can replace with
// different impls in gwt.xml
ClientFactory clientFactory = GWT.create(ClientFactory.class);
EventBus eventBus = clientFactory.getEventBus();
PlaceController placeController = clientFactory.getPlaceController();
// Start ActivityManager for the main widget with our ActivityMapper
ActivityMapper activityMapper = new AppActivityMapper(clientFactory);
ActivityManager activityManager = new ActivityManager(activityMapper, eventBus);
activityManager.setDisplay(appWidget);
// Start PlaceHistoryHandler with our PlaceHistoryMapper
AppPlaceHistoryMapper historyMapper = GWT.create(AppPlaceHistoryMapper.class);
PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper);
historyHandler.register(placeController, eventBus, defaultPlace);
RootPanel.get().add(appWidget);
// Goes to place represented on URL or default place
historyHandler.handleCurrentHistory();
}
}
The method is deprecated because the
EventBustype has moved fromcom.google.gwt.event.sharedtocom.google.web.bindery.event.shared. As indicated in the JavaDocs forPlaceHistoryHandler(which don’t make this especially clear) switching yourEventBusto thecom.google.web.bindery.event.shared.EventBustype will resolve the deprecated warning. That said, for now, bothEventBustypes are functionally identical and the warning is safe to ignore.