GWT UIBinding 找不到零参数构造函数
我正在尝试新的 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>()
知道这里可能出了什么问题吗?
I'm trying my hand at the new GWT 2.0 UIBinder capability, and I have a ui XML that looks like this:
<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 is a non-static inner class contained in FileUploadPanel that extends the FileUpload GWT class. It has an explicit zero-arg constructor that simply calls super()
. However, when GWT starts up, I get this error:
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>()
Any idea what might be going wrong here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
非静态内部类需要在其包含类的实例中实例化。这会阻止 UiBinder 在需要时实例化它。尝试使用静态嵌套类。
A non-static inner class needs to be instantiated within an instance of its containing class. This prohibits UiBinder from instantiating it when needed. Try using a static nested class instead.