[ 
https://issues.apache.org/jira/browse/WICKET-673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12506583
 ] 

Eelco Hillenius commented on WICKET-673:
----------------------------------------

That's unfortunate Timo. But I already left a comment in detachBehaviors that 
imho we should *always* detach behaviors, no matter what. We shouldn't want to 
get into situations where undetached models and behaviors can be lingering 
around just because of a mistake in the business logic, and I also think that 
this current method of detaching is more expensive than it should be. And then 
there are the side effects. So what I'm about to commit now is:

        public final void detachBehaviors()
        {
                if (behaviors != null)
                {
                        for (Iterator i = behaviors.iterator(); i.hasNext();)
                        {
                                IBehavior behavior = (IBehavior)i.next();

                                // Always detach models, 'accepted' or not. 
Otherwise, if they
                                // are accepted during render, but not here - 
something can go
                                // undetached, and calling isEnabled can also 
lead to nasty side
                                // effects. See for instance Timo's comment on
                                // 
http://issues.apache.org/jira/browse/WICKET-673
                                behavior.detach(this);

                                if (behavior.isTemporary())
                                {
                                        i.remove();
                                }
                        }
                }
        }

That should work for you, right?

> synchronize AbstractBehavior#isEnabled(Component component) with 
> Component#isEnabled
> ------------------------------------------------------------------------------------
>
>                 Key: WICKET-673
>                 URL: https://issues.apache.org/jira/browse/WICKET-673
>             Project: Wicket
>          Issue Type: Bug
>            Reporter: Eelco Hillenius
>            Assignee: Eelco Hillenius
>             Fix For: 1.3.0-beta2
>
>
> AbstractBehavior#isEnabled(Component component) currently returns true
> by default. Better would be:
>        public boolean isEnabled(Component component)
>        {
>                return component.isEnabled();
>        }
> Behaviors should be ignored when a component is not visible, but some
> components like TextFields for instance, can be disabled but still
> visible. A concrete case I have here is a disabled textfield with a
> datapicker attached, and the datepicker is still visible and worse,
> when you use it, you can change the value in the textfield.
> See also 
> http://www.nabble.com/AbstractBehavior-isEnabled%28Component-component%29-tf3949139.html

-- 
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