dev@javaserverfaces.java.net

Re: javax.faces.component.MessageFactory.getLabel(FacesContext,UIComponent)

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Mon, 29 Oct 2007 13:37:43 -0700

Mark Collette wrote:
> -------------
> Most likely, yes.
>
> String label = (String) component.getAttributes().get("label");
> if (label == null || label.length() == 0) {
> label = component.getClientId(context);
> }
> return label;
>
> (I think it makes sense to introduce a signature change as well)
>
> I think the above would be sufficient.
> -------------
>
> Sorry Ryan, I was using the dev-digest, so I didn't get your replies
> until after I sent both of my messages.
>
> I mostly use JSF 1.1, so I might be off with the ValueExpression stuff
> here, but I believe that using both
> UIComponent.getAttributes.get("label") and
> UIComponent.getValueExpression("label") does have some validity. It's
> really only when a UIComponent has an attribute getter method, that by
> convention will access the local field and the ValueExpression, that
> the UIComponent.getAttributes.get() will be sufficient. If there is no
> getter method, the one would have to do both calls.
I may be missing something here, but I don't see the value of a
getAttributes() and a getValueExpression(). getAttributes().get() will
check the the PropertyDescriptors for the component, the internal
attributes, and value expressions.


>
> I'm approaching this from two perspectives, wanting to duplicate this
> functionality for JSF 1.1 code, and wanting to make sure that the
> standard JSF 1.2 code is correct and compatible. So I'm half reporting
> a bug, and half seeking guidance :)
>
> - Mark Collette
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net
>