You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Timo Rantalaiho (JIRA)" <ji...@apache.org> on 2007/06/20 12:55:26 UTC

[jira] Commented: (WICKET-673) synchronize AbstractBehavior#isEnabled(Component component) with Component#isEnabled

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

Timo Rantalaiho commented on WICKET-673:
----------------------------------------

This seems to have a bit surprising side effect when leaving from the page: we're overriding Component.isEnabled() to check something from session, but because AbstractBehavior.isEnabled() is called when detaching and _after_ session is already gone from the thread local, and it now delegates to Component.isEnabled(), this happens:


java.lang.NullPointerException  // because data in session is now not available
	at my.project.MyComponent.isEnabled(MyComponent.java:41)
	at org.apache.wicket.behavior.AbstractBehavior.isEnabled(AbstractBehavior.java:157)
	at org.apache.wicket.Component.isBehaviorAccepted(Component.java:3124)
	at org.apache.wicket.Component.detachBehaviors(Component.java:938)
	at org.apache.wicket.Component.detachModels(Component.java:964)
	at org.apache.wicket.Component.detach(Component.java:906)
	at org.apache.wicket.MarkupContainer.detachChildren(MarkupContainer.java:1431)
	at org.apache.wicket.Component.detach(Component.java:910)
	at org.apache.wicket.MarkupContainer.detachChildren(MarkupContainer.java:1431)
	at org.apache.wicket.Component.detach(Component.java:910)
	at org.apache.wicket.MarkupContainer.detachChildren(MarkupContainer.java:1431)
	at org.apache.wicket.Component.detach(Component.java:910)
	at org.apache.wicket.MarkupContainer.detachChildren(MarkupContainer.java:1431)
	at org.apache.wicket.Component.detach(Component.java:910)
	at org.apache.wicket.MarkupContainer.detachChildren(MarkupContainer.java:1431)
	at org.apache.wicket.Component.detach(Component.java:910)
	at org.apache.wicket.MarkupContainer.detachChildren(MarkupContainer.java:1431)
	at org.apache.wicket.Component.detach(Component.java:910)
	at org.apache.wicket.request.target.component.PageRequestTarget.detach(PageRequestTarget.java:81)
	at org.apache.wicket.RequestCycle.detach(RequestCycle.java:911)


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