PDA

View Full Version : ModelData/BeanModel - where's my bean?



dchicks
20 Oct 2009, 9:10 AM
Hi folks,

I got a good link from the GWT mailing list, but even after reading the posting at http://www.extjs.com/blog/2008/07/14/preview-java-bean-support-with-ext-gwt I'm still having no luck. I must have something munged.

I have a very simple DTO: FontDTO.



public class FontDTO implements Serializable {
private String name;

public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}


I want to bind that bean to a form. So, I create a BeanModel using the @BEAN annotation:




@BEAN(FontDTO.class)
public interface FontBeanModel extends BeanModelMarker {
}


My understanding of all this is that now I can create FontBeanModel instances from FontDTO and the binding and store API's will understand how to get data to and from them. However, when I attempt to bind one of these guys to a form:



new FormBinding(formPanel, true).bind(fontBeanModel);


I get a compilation error indicating that bind() wants a ModelData, not a FontBeanModel. Isn't the whole point of the @BEAN annotation to make that ModelData available for all of my beans?

What am I missing?
Thanks,
Dave

dchicks
20 Oct 2009, 10:05 AM
I figured out the trick. I have to refer to my BeanModel as "BeanModel" instead of "FontBeanModel".