You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Sylvain Vieujot <sv...@apache.org> on 2004/12/04 23:24:22 UTC

Strange error

In my htmlEditor, I added a new property : addKupuLogo that show/hides
the library's logo.
In the webapp page I just commited, I added a addKupuLogo="false"
property.

The problem is that it doesn't work.
It works however if I use ="#{false}"
Reading the UIComponentTagUtils,setBooleanProperty, I understand that in
one case the property is stored in the component's valueBindings, and in
the other case, it's stored in the component's attributes.
So it seems reasonable that the code to retrieve it always returns a
null valueBinding, and so, the default value.
Here is the code from HtmlEditor.java :
    public Boolean isAddKupuLogo(){
   		if (_addKupuLogo != null)
   		    return _addKupuLogo;
   		ValueBinding vb = getValueBinding("addKupuLogo");
   		return vb != null ? (Boolean)vb.getValue(getFacesContext()) :
Boolean.TRUE;
    }

BUT where I really can't connect the dots, is that in the other
components (even the one that I did), similar code works just fine.
I think I missed something very simple, but I really don't find it.

How is it that we can treat in the same way value bindings and
attributes without complex code ?

Thanks

Sylvain.

Re: Strange error

Posted by Sylvain Vieujot <sv...@apache.org>.
Ok, I've found the solution.
In fact, when an attribute is set, the setter from the component bean is
called in javax.faces.component._ComponentAttributesMap

The error I had was that I used Boolean return values in the component's
bean.
So _ComponentAttributesMap thinks they is no setter.

I'll commit the bug fixes for my component.

Sylvain.

On Sat, 2004-12-04 at 18:24 -0400, Sylvain Vieujot wrote:

> In my htmlEditor, I added a new property : addKupuLogo that show/hides
> the library's logo.
> In the webapp page I just commited, I added a addKupuLogo="false"
> property.
> 
> The problem is that it doesn't work.
> It works however if I use ="#{false}"
> Reading the UIComponentTagUtils,setBooleanProperty, I understand that
> in one case the property is stored in the component's valueBindings,
> and in the other case, it's stored in the component's attributes.
> So it seems reasonable that the code to retrieve it always returns a
> null valueBinding, and so, the default value.
> Here is the code from HtmlEditor.java :
>     public Boolean isAddKupuLogo(){
>    if (_addKupuLogo != null)
>        return _addKupuLogo;
>    ValueBinding vb = getValueBinding("addKupuLogo");
>    return vb != null ? (Boolean)vb.getValue(getFacesContext()) :
> Boolean.TRUE;
>     }
> 
> BUT where I really can't connect the dots, is that in the other
> components (even the one that I did), similar code works just fine.
> I think I missed something very simple, but I really don't find it.
> 
> How is it that we can treat in the same way value bindings and
> attributes without complex code ?
> 
> Thanks
> 
> Sylvain.