Bind XMLGregorianCalendar to DateField using Form

I’m trying to use the Form class to automatically generate the fields for a jax-ws gen client object. One of the properties is an XMLGregorianCalendar. I created a custom FieldFactory to use a DateField for the DOB property. However, I get an error that the DateField only accepts java.util.Date. Is there a way to create a custom converter and still leverage the Form binding?

Hi!

There is no official support for XMLGregorianCalendar in Vaadin yet. I think you have two viable options. You could do a special datefield that supports XMLGregorianCalendar quite easily by extending the standard datefield component. Another option is that you create a wrapper property for XMLGregorianCalendar. I’d do the first one due later usage and cleaner code.

cheers,
matti

Hi Matti,

Thanks for the quick response. I did think of both of your options but was curious to know if there were other alternatives.

However, what I should’ve remembered (before posting here) was that I could override the XJC and change the xsd data type mapping to java.util.Date. Now I can utilize the Form and all it’s glory.

So, I apologize for your time lost and again appreciate the quick response.