myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (JIRA)" <...@myfaces.apache.org>
Subject [jira] [Resolved] (MYFACES-3096) Attached object pointing to the same component twice add one of them twice
Date Sat, 26 Mar 2011 21:38:05 GMT

     [ https://issues.apache.org/jira/browse/MYFACES-3096?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Leonardo Uribe resolved MYFACES-3096.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.5-SNAPSHOT

> Attached object pointing to the same component twice add one of them twice
> --------------------------------------------------------------------------
>
>                 Key: MYFACES-3096
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3096
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.4
>            Reporter: Leonardo Uribe
>            Assignee: Leonardo Uribe
>             Fix For: 2.0.5-SNAPSHOT
>
>
> In this example:
>                 <testComposite:compositeActionTargetAttributeName id="cc1">
>                     <f:actionListener for="submitButton" binding="#{bean.submitActionListener}"/>
>                     <f:actionListener for="cancelButton" binding="#{bean.cancelActionListener}"/>
>                 </testComposite:compositeActionTargetAttributeName>
> compositeActionTargetAttributeName
> <cc:interface>
>   <cc:actionSource name="submitButton" targets="submitCancelButton"/>
>   <cc:actionSource name="cancelButton" targets="submitCancelButton"/>
> </cc:interface>
> <cc:implementation>
>   <testComposite:actionTargetAttributeName id="submitCancelButton"/>
> </cc:implementation>
> actionTargetAttributeName
> <cc:interface>
>   <cc:actionSource name="submitButton"/>
>   <cc:actionSource name="cancelButton" targets="cancelAction"/>
> </cc:interface>
> <cc:implementation>
>   <h:commandButton id="submitButton" value="Submit Button"/>
>   <h:commandButton id="cancelAction" value="Cancel Button"/>
> </cc:implementation>
> for one of the buttons a f:actionListener is added twice. The problem resides in this
code:
>                         if (UIComponent.isCompositeComponent(component))
>                         {
>                             // How we obtain the list of AttachedObjectHandler for
>                             // the current composite component? It should be a component
>                             // attribute or retrieved by a key inside component.getAttributes
>                             // map. Since api does not specify any attribute, we suppose
>                             // this is an implementation detail and it should be retrieved
>                             // from component attribute map.
>                             // But this is only the point of the iceberg, because we
should
>                             // define how we register attached object handlers in this
list.
>                             // ANS: see CompositeComponentResourceTagHandler.
>                             // The current handler should be added to the list, to be
chained.
>                             // Note that the inner component should have a target with
the same name
>                             // as "for" attribute
>                             mctx.addAttachedObjectHandler(component, currentHandler);
>                             
>                             List<AttachedObjectHandler> handlers = mctx.getAttachedObjectHandlers(component);
>                             
>                             retargetAttachedObjects(context, component, handlers);
>                         }
> The next time it is called call again retargetAttachedObjects, but for the other attached
object, the previous one is still on the list. In CompositeComponentResourceTagHandler all
handlers are removed to prevent apply them twice, but in this special case, it is necessary
to remove it manually adding some code like this:
>                             
>                             handlers.remove(currentHandler);

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message