[richfaces-issues] [JBoss JIRA] Commented: (RF-1471) Support non default date types for Calendar component

Bryan Brouckaert (JIRA) jira-events at lists.jboss.org
Tue Dec 4 08:38:51 EST 2007


    [ http://jira.jboss.com/jira/browse/RF-1471?page=comments#action_12390442 ] 
            
Bryan Brouckaert commented on RF-1471:
--------------------------------------

So when I have the above section in my faces-config.xml and the  the following section in a page:

   <rich:calendar id="date" value="#{bean.dateTest}" />

And where "bean.dateTest" an instance is of "javax.xml.datatype.XMLGregorianCalendar" it will work?


In version 3.1.2 it gives the following exception:
   javax.faces.FacesException: Wrong attibute type
        at org.richfaces.component.UICalendar.getAsDate(UICalendar.java:261)
        at org.richfaces.component.UICalendar.getCurrentDateOrDefault(UICalendar.java:230)
        at org.richfaces.renderkit.CalendarRendererBase.getCurrentDate(CalendarRendererBase.java:355)
        at org.richfaces.renderkit.html.CalendarRenderer.doEncodeEnd(CalendarRenderer.java:225)
        at org.richfaces.renderkit.html.CalendarRenderer.doEncodeEnd(CalendarRenderer.java:436)
        at org.ajax4jsf.renderkit.RendererBase.encodeEnd(RendererBase.java:135)

I'm not talking about a converter for the presentation, I'm talking about a converter to convert any type to date (=the internal type of the calendar component).  Since that type of convertors aren't support by JSF, we need to be creative and pass via a string.

> Support non default date types for Calendar component
> -----------------------------------------------------
>
>                 Key: RF-1471
>                 URL: http://jira.jboss.com/jira/browse/RF-1471
>             Project: RichFaces
>          Issue Type: Feature Request
>    Affects Versions: 3.1.2
>            Reporter: Bryan Brouckaert
>         Assigned To: Alexej Kushunin
>             Fix For: 3.2.0
>
>
> The current implementation of the Calendar component only supports java.util.Date, java.util.Calendar and java.lang.String as valid types for the component's value.  There are many other date types in  the Java world.  There is the very useful org.joda.time.DateMidnight from joda-time and the javax.xml.datatype.XMLGregorianCalendar that is part of JavaEE.
> Supporting all possible date types is impossible, but it is possible to fall back on the string representation of the object via custom converters.
> In the case of the XMLGregorianCalendar class, the following section in the faces-config.xml should be taken into account:
>    <converter>
>         <converter-for-class>javax.xml.datatype.XMLGregorianCalendar</converter-for-class>
>         <converter-class>be.cin.mycarenet.portal.converter.XMLGregorianCalendarConverter</converter-class>
>     </converter>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the richfaces-issues mailing list