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