You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sergey Derugo (JIRA)" <ji...@apache.org> on 2008/11/06 16:03:46 UTC

[jira] Issue Comment Edited: (WICKET-1919) MarkupContainer.setEnabled() doesn't enable/disable child components

    [ https://issues.apache.org/jira/browse/WICKET-1919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645487#action_12645487 ] 

xsergey edited comment on WICKET-1919 at 11/6/08 7:02 AM:
----------------------------------------------------------------

In the attachment(src.zip) you can find simple test case

      was (Author: xsergey):
    In the attachment [^src.zip] you can find simple test case
  
> MarkupContainer.setEnabled() doesn't enable/disable child components
> --------------------------------------------------------------------
>
>                 Key: WICKET-1919
>                 URL: https://issues.apache.org/jira/browse/WICKET-1919
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.3, 1.4-M3
>            Reporter: Sergey Derugo
>             Fix For: 1.4-RC2
>
>         Attachments: src.zip
>
>
> 1. Create any components that is derived from MarkupContainer, for example, create Panel. 
> 2. Put some components to the Panel, for example, TextInput, Label etc.
> 3. Call panel.setEnabled(false) 
> Result: all controls on panel are still enabled.
> Notes: after some investigation I found that MarkupContainer doesn't override setEnabled and therefore it cannot enable/disable components stored in the container. 
> Workaround: manually disable all components that are displayed on the panel, for example:
> public void setEnabledForChildren(boolean enabled) {
>         setEnabledRecursive(this, enabled);
>     }
>     private void setEnabledRecursive(MarkupContainer container, boolean enabled) {
>         Iterator<? extends Component> iterator = container.iterator();
>         while (iterator.hasNext()) {
>             Component component = iterator.next();
>             component.setEnabled(enabled);
>             if (component instanceof MarkupContainer) {
>                 setEnabledRecursive((MarkupContainer) component, enabled);
>             }
>         }
>     }
> I think that MarkupContainer must be responsible for disabling/enabling child components.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.