内部接口扩展的UiBinder <t,t> </t,t>的延迟绑定失败

时间:2014-02-10 09:15:16

标签: java gwt uibinder gin

错误:注入com.avtodoria.tracer.web.client.view.SearchProfileViewImpl时出错。$ SearchProfileViewUiBinder:无法创建或继承绑定:找不到com.avtodoria.tracer.web.client.view的@Inject或默认构造函数。 SearchProfileViewImpl $ SearchProfileViewUiBinder

通常,如果我忘记使用@Inject注释构造函数SearchProfileViewImpl,则会出现此错误。 但是:

...
import com.google.inject.Inject;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.web.bindery.event.shared.EventBus;
...


public class SearchResultViewImpl extends AbstractView implements SearchResultView {

    interface SearchResultViewUiBinder extends UiBinder<FlowPanel, SearchResultViewImpl> {}

@Inject
private EventBus eventBus;

@UiField(provided = true)
CellTable<SearchResultProxy> resultTable;
@UiField(provided = true)
MapWidget mapWidget;
@UiField
SearchResultResources res;
@UiField
Breadcrumbs breadcrumbs;
@UiField
FlowPanel resultPanel;
@UiField
Button collapseButton;
@UiField
NavLink backLink;
@UiField
NavLink currentSearchPatternNavLink;
@UiField
Pager pager;
@UiField
Grid pagerPanel;
@UiField
FlowPanel container;

**@Inject**
public SearchResultViewImpl(SearchResultViewUiBinder uiBinder) {
    prepareResultTable();
    prepareMap();
    initWidget(uiBinder.createAndBindUi(this));
    res.css().ensureInjected();

    pager.setDisplay(resultTable);

    detailsPopup = new SearchResultDetailsPopup(map, DEFAULT_PROJECTION, "resultDetailsPopup", 300, 300);

    bindEvents();
}
...

在同样使用Uibinder的类中,此错误不会出现。

杜松子酒模块:

public class AppModule extends AbstractGinModule {

@Override
protected void configure() {
    bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);

    bind(AppView.class).to(AppViewImpl.class);
    bind(SearchProfileView.class).to(SearchProfileViewImpl.class);
    bind(AreaSelectView.class).to(AreaSelectViewImpl.class);
    bind(SearchResultView.class).to(SearchResultViewImpl.class);
}
...

另外,我的同事使用相同的代码,但没有这个错误。另外,这个问题只出现在我运行GWT调试时。我尝试重新安装整个项目和IDE但没有改变。 帮帮我吧!

PS我为我的英语道歉,但我希望问题很清楚。

0 个答案:

没有答案