我应该使用哪种GWT EventBus?

che*_*tts 20 java gwt event-handling

在gwt-user.jar中有2个EventBus接口和SimpleEventBus implmentations.

com.google.gwt.event.shared.EventBuscom.google.web.bindery.event.shared.EventBus 我将把这些作为"gwt.event"和"web.bindery".

查看JavaDocs和源代码,我可以看到gwt.event只包含web.bindery.但是,gwt.event实现还隐藏了许多已弃用的方法

那么我应该使用哪种实现方式?(我在GWT 2.4上)

Col*_*rth 19

通常你应该使用中的一个com.google.web.bindery.过去唯一的版本com.google.gwt.event,但是当RequestFactory和AutoBeans从GWT本身移出时,com.google.web.bindery它们可以在非GWT客户端中工作.

如果您com.google.web.bindery在演示者中使用该版本等,则可以在需要时更轻松地在外部GWT应用程序中使用.将该实例传递给PlaceController使用EventBus的其他类时,您也不会获得弃用警告.

  • 如果您使用Activity和Places,则start方法中的Activity需要com.google.gwt.event.shared.EventBus (3认同)