4 Replies Latest reply on May 15, 2009 8:44 AM by ilya_shaikovsky

    rich:calendar custom converter not called

    nicog

      Hello,

      Using RF 3.3.0GA

      I have the following converter

       <converter>
       <converter-id>MagicCalendarConverter</converter-id>
       <converter-class>com.mfpsoft.converters.MagicCalendarConverter</converter-class>
       </converter>
      


      and
      public class MagicCalendarConverter extends DateTimeConverter {
      
      // public MagicCalendarConverter() {
      // super();
      // }
      
      
       @Override
       public Object getAsObject(FacesContext arg0, UIComponent component, String dateString) {
       Object result;
       try{
       result = super.getAsObject(arg0, component, dateString);
       } catch (ConverterException ex){
       return null;
       }
       return result;
       }
      
       @Override
       public String getAsString(FacesContext arg0, UIComponent component, Object dateObject) {
       String result = null;
       try{
       result = super.getAsString(arg0, component, dateObject);
       } catch (ConverterException ex){
       return null;
       }
       return result;
       }
      
      }
      


      I tried using converter attribute or f:converter but getting the same result:
      =>Converter methods are never called.

      (for test, I specified a constructor (commented here) and it is called)

      Do you have any work around for this?
      Many thanks in advance
      Regards

        • 1. Re: rich:calendar custom converter not called
          ilya_shaikovsky

          1) update your version to 3.3.1 latest CR.

          if not helps show the page also.

          • 2. Re: rich:calendar custom converter not called
            nicog

            thks i will try and let you know

            CR2 has been officially announced but I see CR3 in repository
            should I go with CR3

            • 3. Re: rich:calendar custom converter not called
              nicog

              It does not help:

              here is the jsp part in f:subview and f:form

              <rich:panel id="complement4_2Panel">
              <rich:calendar enableManualInput="true" popup="true" style="width:200px" datePattern="#{SessionBean.datePattern}"
              id="complement4_2"
              value="#{ClientFicheBean.client.complement4}" oninputchange="enableSave();" onchanged="enableSave();" >
              <f:converter converterId="MagicCalendarConverter"/>
              </rich:calendar>
              </rich:panel>
              
              


              • 4. Re: rich:calendar custom converter not called
                ilya_shaikovsky

                 

                package org.richfaces.demo.calendar;
                
                import javax.faces.component.UIComponent;
                import javax.faces.context.FacesContext;
                import javax.faces.convert.ConverterException;
                import javax.faces.convert.DateTimeConverter;
                
                public class CalendarConverter extends DateTimeConverter {
                
                // public MagicCalendarConverter() {
                // super();
                // }
                
                
                 @Override
                 public Object getAsObject(FacesContext arg0, UIComponent component, String dateString) {
                 System.out.println("CalendarConverter.getAsObject()");
                 Object result;
                 try{
                 result = super.getAsObject(arg0, component, dateString);
                 } catch (ConverterException ex){
                 return null;
                 }
                 return result;
                 }
                
                 @Override
                 public String getAsString(FacesContext arg0, UIComponent component, Object dateObject) {
                 System.out.println("CalendarConverter.getAsString()");
                 String result = null;
                 try{
                 result = super.getAsString(arg0, component, dateObject);
                 } catch (ConverterException ex){
                 return null;
                 }
                 return result;
                 }
                
                }
                

                 <rich:calendar value="#{calendarBean.selectedDate}"
                 locale="#{calendarBean.locale}"
                 popup="#{calendarBean.popup}"
                 datePattern="#{calendarBean.pattern}"
                 showApplyButton="#{calendarBean.showApply}" cellWidth="24px" cellHeight="22px" style="width:200px">
                 <f:converter converterId="CalendarConverter"/>
                 </rich:calendar>
                 <h:commandButton value="click" />
                

                and
                 <converter>
                 <converter-id>CalendarConverter</converter-id>
                 <converter-class>org.richfaces.demo.calendar.CalendarConverter</converter-class>
                 </converter>
                


                Works fine for me under current todays snapshot. And also was checked at prev week.. also worked :/