Thursday, May 26, 2011

Broken editor type conversions in GWT trunk r10227

Hello,
I'm trying to use trunk version of GWT but I'm encountering some conversion issues with the Editor framework. 

Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
at com.google.gwt.text.shared.testing.PassthroughRenderer.render(PassthroughRenderer.java:1)
at com.google.gwt.user.client.ui.ValueBoxBase.setValue(ValueBoxBase.java:394)
at com.google.gwt.user.client.ui.ValueBoxBase.setValue(ValueBoxBase.java:389)
at com.google.gwt.editor.ui.client.adapters.ValueBoxEditor.setValue(ValueBoxEditor.java:106)
at com.google.gwt.editor.client.impl.Refresher.visit(Refresher.java:45)
at com.google.gwt.editor.client.impl.Initializer.visit(Initializer.java:49)
at com.google.gwt.editor.client.impl.AbstractEditorContext.traverse(AbstractEditorContext.java:128)
at com.clouway.requestfactory.app.client.CustomerEditor_RequestFactoryEditorDelegate.accept(CustomerEditor_RequestFactoryEditorDelegate.java:54)
at com.google.gwt.editor.client.impl.AbstractEditorContext.traverse(AbstractEditorContext.java:129)
at com.clouway.requestfactory.app.client.CustomerEditorWorkflow_DriverImpl.accept(CustomerEditorWorkflow_DriverImpl.java:6)
at com.google.gwt.editor.client.impl.BaseEditorDriver.doEdit(BaseEditorDriver.java:92)
at com.google.web.bindery.requestfactory.gwt.client.impl.AbstractRequestFactoryEditorDriver.edit(AbstractRequestFactoryEditorDriver.java:178)

The AbstractEditorDriverGenerator is generating different AbstractEditorContext for each property of the entity, so the following declaration:
  @UiField
  ValueBoxEditorDecorator<Integer> age;

  Age:
      <e:ValueBoxEditorDecorator ui:field="age">
        <e:valuebox>
          <g:TextBox/>
        </e:valuebox>
      </e:ValueBoxEditorDecorator>

generates AbstractEditorContext for "age" field as 
    @Override public Class getEditedType() { return java.lang.Integer.class; }
  @Override public java.lang.Integer getFromModel() {
    return (parent != null && true) ? parent.getAge() : null;
  }

And here is the problem, the   TextBoxBase class is using the default PassthroghtParser (of type String)

protected TextBoxBase(Element elem) {
  super(elem, PassthroughRenderer.instance(), PassthroughParser.instance());
}
which is causing the provided exception. Any idea how I can make it working ?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment