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

Johan Compagner commented on WICKET-2064:
-----------------------------------------

how much time is isEnabledInHierarchy called for a specific component?

I dont think that overhead is really a big problem. If i would change something 
i would change this:

                        state = isEnabled() && isEnableAllowed();
                        if (state)
                        {
                                Component parent = getParent();
                                if (parent != null)
                                {
                                        state = state && 
parent.isEnabledInHierarchy();
                                }
                        }
                        setMetaData(ENABLED_IN_HIERARCHY_CACHE_KEY, state);


into this:

                        state = isEnabled() && isEnableAllowed();
                        if (state)
                        {
                                Component parent = getParent();
                                while (parent != null)
                                {
                                        state = state && parent.isEnabled() && 
parent.isEnableAllowed();
                                        parent = parent.getParent();
                                }
                        }
                        setMetaData(ENABLED_IN_HIERARCHY_CACHE_KEY, state);

This way not the whole hierarchy is calculated and get and stored in the meta 
data 
Or is it called for the all the parents also always? (then it guess the current 
one is even better)

I would also not make it a Boolean (so the object boolean) for a component
That is an extra reference for all the components on a page. So for me this 
issue can be closed with wont fix.



> Make Component.ENABLED_IN_HIERARCHY_CACHE_KEY a instance variable rather than 
> a MetaDataKey
> -------------------------------------------------------------------------------------------
>
>                 Key: WICKET-2064
>                 URL: https://issues.apache.org/jira/browse/WICKET-2064
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.4-RC1
>            Reporter: Juergen Donnerstag
>            Priority: Minor
>
> Component.ENABLED_IN_HIERARCHY_CACHE_KEY currently is a MetaDataKey which get 
> added to each Component if isEnableInHierarchy is invoked. That basically 
> happens all the time. In contrast the concept of MetaData has been introduced 
> to allow rarely used data to be attached to Components (with java 1.5 in a 
> typesafe manner). Since MetaData introduce some overhead, and for simplicity 
> reasons, I'd suggest to convert Component.ENABLED_IN_HIERARCHY_CACHE_KEY into 
> a Boolean instance variable.

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