You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Andrew Robinson (JIRA)" <de...@myfaces.apache.org> on 2007/08/27 22:05:32 UTC

[jira] Created: (TRINIDAD-653) PanelLabelAndMessageRenderer shouldn't need the "for" given to detect what it is for

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.


Re: [jira] Resolved: (TRINIDAD-653) PanelLabelAndMessageRenderer shouldn't need the "for" given to detect what it is for

Posted by Zubin Wadia <zw...@gmail.com>.
On 8/31/07, Zubin Wadia <zw...@gmail.com> wrote:
> On 8/31/07, Andrew Robinson (JIRA) <de...@myfaces.apache.org> wrote:
> >
> >      [
> >
> https://issues.apache.org/jira/browse/TRINIDAD-653?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
> > ]
> >
> > Andrew Robinson resolved TRINIDAD-653.
> > --------------------------------------
> >
> >        Resolution: Fixed
> >     Fix Version/s: 1.0.3-core
> >
> > Committed revision 571586.
> >
> > > 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
> > >            Assignee: Andrew Robinson
> > >             Fix For: 1.0.3-core
> > >
> > >
> > > 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.
> >
> >
>

Re: [jira] Resolved: (TRINIDAD-653) PanelLabelAndMessageRenderer shouldn't need the "for" given to detect what it is for

Posted by Zubin Wadia <zw...@gmail.com>.
On 8/31/07, Andrew Robinson (JIRA) <de...@myfaces.apache.org> wrote:
>
>      [
> https://issues.apache.org/jira/browse/TRINIDAD-653?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
> ]
>
> Andrew Robinson resolved TRINIDAD-653.
> --------------------------------------
>
>        Resolution: Fixed
>     Fix Version/s: 1.0.3-core
>
> Committed revision 571586.
>
> > 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
> >            Assignee: Andrew Robinson
> >             Fix For: 1.0.3-core
> >
> >
> > 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.
>
>

[jira] Resolved: (TRINIDAD-653) PanelLabelAndMessageRenderer shouldn't need the "for" given to detect what it is for

Posted by "Andrew Robinson (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/TRINIDAD-653?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Robinson resolved TRINIDAD-653.
--------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.0.3-core

Committed revision 571586.

> 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
>            Assignee: Andrew Robinson
>             Fix For: 1.0.3-core
>
>
> 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.


[jira] Commented: (TRINIDAD-653) PanelLabelAndMessageRenderer shouldn't need the "for" given to detect what it is for

Posted by "Matt Cooper (JIRA)" <de...@myfaces.apache.org>.
    [ 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.