myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simon <simon.kitch...@chello.at>
Subject Re: svn commit: r615199 - /myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
Date Sat, 26 Jan 2008 08:53:50 GMT
This patch looks weird to me.

Why is myfaces-shared being patched to contain trinidad-specific code?

Does this particular trinidad issue occur on the Sun RI?
* If so, then the problem is a trinidad one, and needs to be fixed in
trinidad.
* if not, then the problem is a generic myfaces one, and should be fixed
with a general-purpose fix, not a trinidad-specific hack.

Regards,
Simon

On Fri, 2008-01-25 at 12:16 +0000, tomsp@apache.org wrote:
> Author: tomsp
> Date: Fri Jan 25 04:16:50 2008
> New Revision: 615199
> 
> URL: http://svn.apache.org/viewvc?rev=615199&view=rev
> Log:
> MYFACES-1809 applied patch from Martin Haimberger
> 
> Modified:
>     myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
> 
> Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
> URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java?rev=615199&r1=615198&r2=615199&view=diff
> ==============================================================================
> --- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
(original)
> +++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
Fri Jan 25 04:16:50 2008
> @@ -213,7 +213,10 @@
>              onClick.append(formInfo.getForm().getClientId(facesContext));
>              onClick.append("',1,{source:'");
>              onClick.append(component.getClientId(facesContext));
> -            onClick.append("'});return false;");
> +            onClick.append("'");
> +            // See Jira Issue 1809 https://issues.apache.org/jira/browse/MYFACES-1809
> +            onClick.append(getChildParametersTrinidad(component));
> +            onClick.append("});return false;");
>          }
>          else {
>              HtmlRendererUtils.renderFormSubmitScript(facesContext);
> @@ -259,6 +262,38 @@
>              target = (String) component.getAttributes().get(HTML.TARGET_ATTR);
>          }
>          return target;
> +    }
> +
> +   /**
> +    * See Jira Issue 1809 https://issues.apache.org/jira/browse/MYFACES-1809
> +    */
> +    private String getChildParametersTrinidad(UIComponent component) {
> +        //https://issues.apache.org/jira/browse/MYFACES-1809//add child parameters
> +        StringBuffer params = new StringBuffer();
> +        for (Iterator it = getChildren(component).iterator(); it.hasNext();) {
> +
> +            UIComponent child = (UIComponent) it.next();
> +            if (child instanceof UIParameter) {
> +                String name = ((UIParameter) child).getName();
> +
> +                if (name == null) {
> +                   throw new IllegalArgumentException("Unnamed parameter value not allowed
within command link.");
> +                }
> +
> +                Object value = ((UIParameter) child).getValue();
> +
> +                //UIParameter is no ValueHolder, so no conversion possible - calling
.toString on value....
> +                String strParamValue = value != null ? org.apache.myfaces.shared.renderkit.html.util.HTMLEncoder.encode(value.toString(),
false, false) : "";
> +
> +                params.append(",'");
> +
> +                params.append(name);
> +                params.append("':'");
> +                params.append(strParamValue);
> +                params.append("'");
> +            }
> +        }
> +        return params.toString();
>      }
>  
>      private StringBuffer addChildParameters(UIComponent component, UIComponent nestingForm)
{
> 
> 


Mime
View raw message