GWT UIBinding找不到零参数构造函数

时间:2010-04-12 17:31:44

标签: gwt uibinder

我正在尝试新的GWT 2.0 UIBinder功能,我有一个如下所示的ui XML:

<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:my='urn:import:com.mystuff.mypackage'>
<g:VerticalPanel>
      <!-- other stuff -->
  <my:FileUploadPanel.ValidatingFileUpload styleName="field" ui:field="fileUpload" />
</g:VerticalPanel>

ValidatingFileUpload是FileUploadPanel中包含的非静态内部类,它扩展了FileUpload GWT类。它有一个显式的零参数构造函数,只需调用super()。但是,当GWT启动时,我收到此错误:

00:00:18.359 [ERROR] Rebind result 'com.mystuff.mypackage.FileUploadPanel.ValidatingFileUpload' has no default (zero argument) constructors.
java.lang.NoSuchMethodException: com.mystuff.mypackage.FileUploadPanel$ValidatingFileUpload.<init>()

知道这里可能出现什么问题吗?

1 个答案:

答案 0 :(得分:3)

非静态内部类需要在其包含类的实例中实例化。这禁止UiBinder在需要时实例化它。请尝试使用静态嵌套类。