[ https://issues.apache.org/jira/browse/WICKET-1919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Igor Vaynberg reassigned WICKET-1919: ------------------------------------- Assignee: Igor Vaynberg > 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 > Assignee: Igor Vaynberg > 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.