[
https://issues.apache.org/jira/browse/MYFACES-2483?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806226#action_12806226
]
Leonardo Uribe commented on MYFACES-2483:
-----------------------------------------
Provided another prototype. It works but still is pending how to deal with c:if
inside UIViewRoot directly and how to remove
PostBuildComponentTreeOnRestoreViewEvent, to enhance compatibility.
The strategy applied is:
1. Mark the parent component containing c:if or any tag that causes component
addition based on the application model to not save it partially.
2. Handle the changes for composite:insertChildren/composite:insertFacet using
the algorithm on MYFACES-2502
3. At the end of apply the facelet in vdl.buildView, do not force publish
PreRemoveFromViewEvent - PostAddToViewEvent, instead use
PostBuildComponentTreeOnRestoreViewEvent (Maybe we have to change this name to
something more descriptive). This is necessary because otherwise the listener
DefaultFaceletsStateManagementStrategy.PostAddPreRemoveFromViewListener
register all components to be saved and restored.
The idea is create a param called
org.apache.myfaces.PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS.
This param only works when partial state saving is enabled. If we do the
example proposed in MYFACES-2502, the algorithm when this param is true will be:
First Request:
- There is a call to ViewDeclarationLanguage.buildView from
RenderResponseExecutor.execute that cause the UIViewRoot instance to be filled
for first time calling to f.apply().
- The view is rendered.
- Save the state for all non transient components found on the view that has
delta or was added after build. This does not include the structure, because
all state is just saved on a big Map<String,Object> where the keys are the
clientId for each component.
Postback (The user send his name and do a submit):
- StateManagementStrategy.restoreView calls ViewDeclarationLanguage.buildView
passing an empty UIViewRoot to be filled for first time calling to f.apply().
- Restore the component state for all saved components. Note the tree
structure now is already provided.
- All lifecycle phases continues until before renderView
- On RenderResponseExecutor.execute there is a call to buildView, and this one
causes all transient components like facelets UIInstructions to be added to the
tree. ComponentHandler first try to detect if the component is on the view
before create it, and if that is true do not create it, instead it takes this
instance and continue apply the taghandles and it remove and add it from tree,
to give the chance to other transient components to be created and added
correctly.
- The view is rendered.
- Save the state for all non transient components found on the view that has
delta or was added after build. This does not include the structure, because
all state is just saved on a big Map<String,Object> where the keys are the
clientId for each component.
> Find a way to allow c:if work with partial state saving enabled
> ---------------------------------------------------------------
>
> Key: MYFACES-2483
> URL: https://issues.apache.org/jira/browse/MYFACES-2483
> Project: MyFaces Core
> Issue Type: Task
> Components: JSR-314
> Reporter: Leonardo Uribe
> Assignee: Leonardo Uribe
> Attachments: fixPSSIf2009JAN-10.patch, fixPSSIf2009JAN-7.patch
>
>
> This one is difficult to solve but I still think it is possible.
> It was explored trying to solve MYFACES-2428, and it seems ri is trying to do
> something about it too on:
> https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1408
> and
> https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1313
> One strategy to solve this one is this:
> 1. Mark the parent component containing c:if to not save it partially.
> 2. Do not execute c:if on postback and partial state saving enabled.
> In theory, the parent component should be restored fully from saved state.
> Note that things like:
> <c:if>....
> <p>Some markup</p>
> <c:if>
> is just invalid. It is expected that c:if only contains components with state.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.