You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Igor Vaynberg <ig...@gmail.com> on 2007/08/18 20:55:30 UTC

abstractbehavior.isenabled()

ive noticed something interesting just now

lets say you add a header contributor to a component. then call
setenabled(false) on that component. guess what - bam - no header
contributor. this is because

AbstractBehavior.java
    public boolean isEnabled(Component component)
    {
        return component.isEnabled();
    }

in some cases it might make sense, but probably in most cases it does not.
this is also true for any other behaviors that extend the abstractbehavior.
so if you have a behavior that sets some class, guess what - that wont work
either.

i think we should change abstractbehavior#isEnabled() to always return true.
the, probably small, subset of behaviors where it makes sense to disable
with component they can do that themselves.

thoughts?

-igor

Re: abstractbehavior.isenabled()

Posted by Eelco Hillenius <ee...@gmail.com>.
On 8/18/07, Igor Vaynberg <ig...@gmail.com> wrote:
> ive noticed something interesting just now
>
> lets say you add a header contributor to a component. then call
> setenabled(false) on that component. guess what - bam - no header
> contributor. this is because
>
> AbstractBehavior.java
>     public boolean isEnabled(Component component)
>     {
>         return component.isEnabled();
>     }
>
> in some cases it might make sense, but probably in most cases it does not.
> this is also true for any other behaviors that extend the abstractbehavior.
> so if you have a behavior that sets some class, guess what - that wont work
> either.
>
> i think we should change abstractbehavior#isEnabled() to always return true.
> the, probably small, subset of behaviors where it makes sense to disable
> with component they can do that themselves.
>
> thoughts?

I agree.

Eelco

Re: abstractbehavior.isenabled()

Posted by Johan Compagner <jc...@gmail.com>.
sounds fine

On 8/18/07, Igor Vaynberg <ig...@gmail.com> wrote:
> ive noticed something interesting just now
>
> lets say you add a header contributor to a component. then call
> setenabled(false) on that component. guess what - bam - no header
> contributor. this is because
>
> AbstractBehavior.java
>     public boolean isEnabled(Component component)
>     {
>         return component.isEnabled();
>     }
>
> in some cases it might make sense, but probably in most cases it does not.
> this is also true for any other behaviors that extend the abstractbehavior.
> so if you have a behavior that sets some class, guess what - that wont work
> either.
>
> i think we should change abstractbehavior#isEnabled() to always return true.
> the, probably small, subset of behaviors where it makes sense to disable
> with component they can do that themselves.
>
> thoughts?
>
> -igor
>