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

Leonardo Uribe updated MYFACES-2774:
------------------------------------

           Status: Resolved  (was: Patch Available)
         Assignee: Leonardo Uribe
    Fix Version/s: 2.0.2-SNAPSHOT
       Resolution: Fixed

After checking in deep this patch, I found that the most expensive operation is 
finalizeForDeletion, because per each component it traverse all components in 
the previous level just to found it and remove it.

Instead, it is better to use a List<Map<String, UIComponent>> for several 
reasons:

 - It is possible to reuse the map on each level (use an ArrayList is better 
over LinkedList).
 - In this case we need random access for finalizeForDeletion, and use a Map 
works best.
 - the key could be MARK_CREATED attribute, because all components with a 
facelet taghandler has it, and if a component does not have it there is no 
problem.

Also, I think the included methods on FaceletCompositionContext are too tied to 
the implementation detail of the algorithm. Instead, it is better to add just 
two methods:

public abstract void markForDeletion(UIComponent component)
public abstract void finalizeForDeletion(UIComponent component)

and the remaining methods call them in a private way.

I also solved a bug when more that one component is added to a facet:

<h:form id="form">
    <f:facet name="header">
       <c:if test="#{employee.management}">
             <h:commandButton id="button1" action="test" rendered="#{true}"/>
             <h:commandButton id="button2" action="test" rendered="#{true}"/>
       </c:if>
    </f:facet>
</h:form>

That notation was invalid on facelets 1.1.x but on jsf 2.0, with the 
introduction of f:metadata, which it is a facet that could contain many 
components, the previous code becomes valid and should be handled properly.

Thanks to Marius Petoi for its help with this issue. It was very hard to solve 
it.

> Remove MARK_DELETED attribute from the component
> ------------------------------------------------
>
>                 Key: MYFACES-2774
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2774
>             Project: MyFaces Core
>          Issue Type: Improvement
>          Components: General, JSR-314
>    Affects Versions: 2.0.0
>            Reporter: Marius Petoi
>            Assignee: Leonardo Uribe
>            Priority: Minor
>             Fix For: 2.0.2-SNAPSHOT
>
>         Attachments: markDeletedFaceletContext.patch, 
> markDeletedFaceletContext11.patch, markDeletedFaceletContext2.patch, 
> markDeletedFaceletContext3.patch, markDeletedFaceletContext4.patch, 
> markDeletedFaceletContext5.patch, markDeletedFaceletContext6.patch, 
> markDeletedFaceletContext7.patch, markDeletedFaceletContext8.patch, 
> markDeletedFaceletContext9.patch
>
>
> The ComponentSupport.MARK_DELETED attribute is used only inside one request. 
> It doesn't need to be saved in the state. It should be removed from the 
> attributes of the component. Instead a list of components marked for deletion 
> should be included in the FaceletContext.

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