You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sven Meier (JIRA)" <ji...@apache.org> on 2015/01/20 22:26:34 UTC

[jira] [Commented] (WICKET-4551) Enable components underneath disabled components

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

Sven Meier commented on WICKET-4551:
------------------------------------

Here's my proposal:

- revert commit 9d62cefb5007111b91c9f21afa4077452d2083bc
- add a setter to Component (and corresponding getter):

{code:java}
    /**
     * If true the component will not take the enabling of its parent into account.
     *
     * @param ignore
     *            If true, the component's enabling will not depend on its parent
     * @return This
     * @see #isEnabledInHierarchy()
     */
    public final Component setIgnoreParentEnabling(final boolean ignore);
{code}

- change #isEnabledInHierarchy() 

{code:java}
	final boolean state;
	Component parent = getParent();
	if (getIgnoreParentEnabling() == false && parent != null && parent.isEnabledInHierarchy() == false)
	{
		state = false;
	}
	else
	{
		state = isEnabled() && isEnableAllowed();
	}
{code}

Advantages:
- no conflict with #setEnabled() and #getEnabled()
- simple to use, just call the setter to opt-out from the enabling hierarchy
- no additional changes needed
- works for all Components; a Panel can choose to opt-out for itself and all its children

Suggestions for a better naming are most welcome.

> Enable components underneath disabled components
> ------------------------------------------------
>
>                 Key: WICKET-4551
>                 URL: https://issues.apache.org/jira/browse/WICKET-4551
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>            Reporter: J. Lind
>            Assignee: Sven Meier
>            Priority: Minor
>             Fix For: 7.0.0-M3
>
>         Attachments: AlwaysOnAjaxLink.java, quickstart.zip
>
>
> I would like to force some child components to be enabled regardless of the state of the parent component. For example, I would like to have an ajax link within a form that is enabled allthough the form itself is disabled. A suggested solution to override org.apache.wicket.markup.html.link.AbstractLink#isLinkEnabled() and
> org.apache.wicket.Component#canCallListenerInterface(Method) did not work (see quickstart). Method Component#isEnabledInhierarchy might do the trick but is marked final.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)