myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject cvs commit: incubator-myfaces/src/components/org/apache/myfaces/custom/calendar HtmlCalendarRenderer.java
Date Fri, 08 Apr 2005 02:02:26 GMT
schof       2005/04/07 19:02:26

  Modified:    src/components/org/apache/myfaces/custom/calendar
                        HtmlCalendarRenderer.java
  Log:
  Fixes MYFACES-167 (Thanks to David Heffelfinger for reporting the bug and supplying the
patch.)
  
  Revision  Changes    Path
  1.21      +26 -4     incubator-myfaces/src/components/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java
  
  Index: HtmlCalendarRenderer.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/components/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- HtmlCalendarRenderer.java	11 Feb 2005 14:11:04 -0000	1.20
  +++ HtmlCalendarRenderer.java	8 Apr 2005 02:02:26 -0000	1.21
  @@ -46,6 +46,9 @@
   
   /**
    * $Log$
  + * Revision 1.21  2005/04/08 02:02:26  schof
  + * Fixes MYFACES-167 (Thanks to David Heffelfinger for reporting the bug and supplying
the patch.)
  + *
    * Revision 1.20  2005/02/11 14:11:04  mmarinschek
    * fixed jira 97
    *
  @@ -128,7 +131,18 @@
   
           Locale currentLocale = facesContext.getViewRoot().getLocale();
   
  -        Date value = RendererUtils.getDateValue(inputCalendar);
  +        
  +        Date value;
  +        
  +        try
  +        {
  +            value = RendererUtils.getDateValue(inputCalendar);
  +        }
  +        catch (IllegalArgumentException illegalArgumentException)
  +        {
  +            value = null;
  +        }
  +       
   
           Calendar timeKeeper = Calendar.getInstance(currentLocale);
           timeKeeper.setTime(value!=null?value:new Date());
  @@ -171,8 +185,16 @@
               RendererUtils.copyHtmlInputTextAttributes(inputCalendar, inputText);
   
               inputText.setTransient(true);
  -            inputText.setValue(getConverter(inputCalendar).getAsString(
  -                    facesContext,inputCalendar,value));
  +            
  +            if (value == null && inputCalendar.getSubmittedValue() != null)
  +            {
  +                inputText.setValue(inputCalendar.getSubmittedValue());
  +            }
  +            else
  +            {
  +                inputText.setValue(getConverter(inputCalendar).getAsString(
  +                        facesContext,inputCalendar,value));
  +            }
               inputText.setEnabledOnUserRole(inputCalendar.getEnabledOnUserRole());
               inputText.setVisibleOnUserRole(inputCalendar.getVisibleOnUserRole());
   
  
  
  

Mime
View raw message