除了复制和粘贴现有的 GWT 编辑器示例之外,我发现其他任何事情都令人沮丧。这是创建最小编辑器的尝试,但没有成功。
public class ContactEditor extends Composite implements Editor<Contact> {
interface Binder extends UiBinder<Widget, ContactEditor> {}
interface ContactEditorDriver extends
SimpleBeanEditorDriver<Contact, ContactEditor> {}
private final ContactEditorDriver editorDriver;
@UiField TextBox salutation;
public ContactEditor(Contact contact) {
editorDriver = GWT.create(ContactEditorDriver.class);
editorDriver.initialize(this);
editorDriver.edit(contact);
initWidget(GWT.<Binder> create(Binder.class).createAndBindUi(this));
}
}
当它被实例化时
ContactEditor contactEditor = new ContactEditor(new Contact());
我得到一个UmbrellaException
包含
Caused by: java.lang.NullPointerException: null
at ...ContactEditor_SimpleBeanEditorDelegate.attachSubEditors(ContactEditor_SimpleBeanEditorDelegate.java:12)
at com.google.gwt.editor.client.impl.AbstractEditorDelegate.initialize(AbstractEditorDelegate.java:264)
at com.google.gwt.editor.client.impl.SimpleBeanEditorDelegate.initialize(SimpleBeanEditorDelegate.java:32)
at com.google.gwt.editor.client.impl.AbstractSimpleBeanEditorDriver.edit(AbstractSimpleBeanEditorDriver.java:45)
at ...ContactEditor.<init>(ContactEditor.java
这是怎么回事---子编辑器?失败似乎在生成的代码中,我很难调试。
非常感谢。