[ 
https://issues.apache.org/jira/browse/TRINIDAD-653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12523101
 ] 

Matt Cooper commented on TRINIDAD-653:
--------------------------------------

If there are multiple EditableValueHolders inside the body of the 
panelLabelAndMessage, perhaps the default behavior (if no for is specified) 
should be to traverse through the children/grandchildren until the first one is 
found.  The children might be wrapped in some other layout component in which 
we would probably want to skip over.

> PanelLabelAndMessageRenderer shouldn't need the "for" given to detect what it 
> is for
> ------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-653
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-653
>             Project: MyFaces Trinidad
>          Issue Type: Improvement
>    Affects Versions: 1.0.2-core
>            Reporter: Andrew Robinson
>
> Since CorePanelLabelAndMessage will usually be used having the first child 
> component as the input, the renderer should be able to determine the "for" 
> attribute value without it being specified. Here is code that can be used in 
> the PanelLabelAndMessageRenderer:
>   @Override
>   protected String getLabelFor(FacesContext context, RenderingContext arc,
>     UIComponent component, FacesBean bean)
>   {
>     String forValue = getFor(bean);
>     String val = MessageUtils.getClientIdFor(context, component, forValue);
>     if (val == null)
>     {
>       if (component.getChildCount() > 0)
>       {
>         UIComponent firstChild = (UIComponent)component.getChildren().get(0);
>         if (firstChild instanceof EditableValueHolder)
>         {
>           val = firstChild.getClientId(context);
>         }
>       }
>     }
>     return val;
>   }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to