myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Marinschek" <martin.marinsc...@gmail.com>
Subject Re: svn commit: r602069 - /myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java
Date Thu, 13 Dec 2007 07:14:39 GMT
Hi Simon,

looks good to me on a quick glance.

By the way, while you are working at this, could you maybe also review
the way the converting is done in the component. After several people
have worked on this, this is now really a mess. Maybe you would find a
more decent option with a quick review?

regards,

Martin

On Dec 7, 2007 12:39 PM, Simon Kitching <simon.kitching@chello.at> wrote:
> By the way, I'd be happy if someone (martin marinschek) did a quick double-check of this
commit. The patch seems obvious, and works fine when testing, but a second pair of eyes might
be nice.
>
> ---- skitching@apache.org schrieb:
>
> > Author: skitching
> > Date: Fri Dec  7 03:15:14 2007
> > New Revision: 602069
> >
> > URL: http://svn.apache.org/viewvc?rev=602069&view=rev
> > Log:
> > Minor code optimisation: when rendering readonly or disabled calendar, don't bother
to create link and param components that will never be used.
> >
> > Modified:
> >     myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java
> >
> > Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java
> > URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java?rev=602069&r1=602068&r2=602069&view=diff
> > ==============================================================================
> > --- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java
(original)
> > +++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/calendar/HtmlCalendarRenderer.java
Fri Dec  7 03:15:14 2007
> > @@ -734,13 +734,7 @@
> >              throws IOException
> >      {
> >          Converter converter = getConverter(component);
> > -
> >          Application application = facesContext.getApplication();
> > -        HtmlCommandLink link
> > -                = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
> > -        link.setId(component.getId() + "_" + valueForLink.getTime() + "_link");
> > -        link.setTransient(true);
> > -        link.setImmediate(component.isImmediate());
> >
> >          HtmlOutputText text
> >                  = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE);
> > @@ -748,30 +742,33 @@
> >          text.setId(component.getId() + "_" + valueForLink.getTime() + "_text");
> >          text.setTransient(true);
> >
> > -        UIParameter parameter
> > -                = (UIParameter)application.createComponent(UIParameter.COMPONENT_TYPE);
> > -        parameter.setId(component.getId() + "_" + valueForLink.getTime() + "_param");
> > -        parameter.setTransient(true);
> > -        parameter.setName(component.getClientId(facesContext));
> > -        parameter.setValue(converter.getAsString(facesContext, component, valueForLink));
> > -
> >          HtmlInputCalendar calendar = (HtmlInputCalendar)component;
> >          if (calendar.isDisabled() || calendar.isReadonly())
> >          {
> > -             // In this case, it appears that the link and parameter components
are not
> > -             // used .. so why bother creating them above?
> >              component.getChildren().add(text);
> >
> >              RendererUtils.renderChild(facesContext, text);
> > +            return;
> >          }
> > -        else
> > -        {
> > -            RendererUtils.addOrReplaceChild(component,link);
> > -            link.getChildren().add(parameter);
> > -            link.getChildren().add(text);
> >
> > -            RendererUtils.renderChild(facesContext, link);
> > -        }
> > +        HtmlCommandLink link
> > +                = (HtmlCommandLink)application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
> > +        link.setId(component.getId() + "_" + valueForLink.getTime() + "_link");
> > +        link.setTransient(true);
> > +        link.setImmediate(component.isImmediate());
> > +
> > +        UIParameter parameter
> > +                = (UIParameter)application.createComponent(UIParameter.COMPONENT_TYPE);
> > +        parameter.setId(component.getId() + "_" + valueForLink.getTime() + "_param");
> > +        parameter.setTransient(true);
> > +        parameter.setName(component.getClientId(facesContext));
> > +        parameter.setValue(converter.getAsString(facesContext, component, valueForLink));
> > +
> > +        RendererUtils.addOrReplaceChild(component,link);
> > +        link.getChildren().add(parameter);
> > +        link.getChildren().add(text);
> > +
> > +        RendererUtils.renderChild(facesContext, link);
> >      }
> >
> >      private Converter getConverter(UIInput component)
> >
> >
>
>



-- 

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Mime
View raw message