GWT弃用:PlaceHistoryHandler.register?(GWT deprecated

2019-10-16 14:13发布

我有一个GWT应用程序,我移植到GWT 2.4。 现在我木屐在这条线已过时的警告:

 historyHandler.register(placeController, eventBus, defaultPlace);

“离型PlaceHistoryHandler方法寄存器(PlaceController,EventBus,地点)已过时”

有没有更好的办法在这里实现同样的结果,或者是安全的忽略警告?

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();
     }
    } 

Answer 1:

该方法已被弃用,因为EventBus类型已经从移动com.google.gwt.event.sharedcom.google.web.bindery.event.shared 。 正如指出的JavaDoc中PlaceHistoryHandler (不使这个特别清楚)切换您的EventBuscom.google.web.bindery.event.shared.EventBus类型将解决弃用警告。 也就是说,就目前来看,这两种EventBus类型的功能相同,并警告是安全的忽视。



文章来源: GWT deprecated: PlaceHistoryHandler.register?