我想在MVP GWT 2.4中使用杜松子酒。在我的模块中,我有:在Gwt 2.4 EventBus和杜松子酒的麻烦
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.SimpleEventBus;
@Override
protected void configure() {
bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);
...
}
上面的代码使用新的com.google.web.bindery.event.shared.EventBus
。问题是当我想要实现的活动注入事件总线MVP活动:
package com.google.gwt.activity.shared;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
public interface Activity {
...
void start(AcceptsOneWidget panel, EventBus eventBus);
}
Activity
使用过时的com.google.gwt.event.shared.EventBus
。我怎样才能调和这两个?很明显,如果我要求使用不推荐使用的EventBus类型,那么Gin会抱怨,因为我没有为它指定绑定。
更新:这将允许应用程序建立的,但现在有两个不同的EventBus
s,这是可怕的:
protected void configure() {
bind(com.google.gwt.event.shared.EventBus.class).to(
com.google.gwt.event.shared.SimpleEventBus.class).in(Singleton.class);
bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);
...
一个黑客是只使用了过时的版本无处不在我的代码。这样做有多糟糕? – 2012-02-13 21:54:01