You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/10/15 00:24:16 UTC
svn commit: r1183529 - in
/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces:
application/TreeStructureManager.java
view/facelets/DefaultFaceletsStateManagementStrategy.java
Author: lu4242
Date: Fri Oct 14 22:24:16 2011
New Revision: 1183529
URL: http://svn.apache.org/viewvc?rev=1183529&view=rev
Log:
MYFACES-3360 DefaultFaceletsStateManagementStrategy.PostAddPreRemoveFromViewListener can now register changes on the view when refreshing occur (and fix no pss state saving does not set UIViewRoot as soon as is restored on the structure)
Modified:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java?rev=1183529&r1=1183528&r2=1183529&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java Fri Oct 14 22:24:16 2011
@@ -22,6 +22,8 @@ import org.apache.myfaces.shared.util.Cl
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@@ -98,7 +100,7 @@ public class TreeStructureManager
{
if (treeStructRoot instanceof TreeStructComponent)
{
- return (UIViewRoot)internalRestoreTreeStructure((TreeStructComponent)treeStructRoot);
+ return (UIViewRoot)internalRestoreTreeStructure((TreeStructComponent)treeStructRoot, true);
}
@@ -107,13 +109,17 @@ public class TreeStructureManager
}
- private UIComponent internalRestoreTreeStructure(TreeStructComponent treeStructComp)
+ private UIComponent internalRestoreTreeStructure(TreeStructComponent treeStructComp, boolean checkViewRoot)
{
String compClass = treeStructComp.getComponentClass();
String compId = treeStructComp.getComponentId();
UIComponent component = (UIComponent)ClassUtils.newInstance(compClass);
component.setId(compId);
+ if (checkViewRoot && component instanceof UIViewRoot)
+ {
+ FacesContext.getCurrentInstance().setViewRoot((UIViewRoot) component);
+ }
//children
TreeStructComponent[] childArray = treeStructComp.getChildren();
if (childArray != null)
@@ -121,7 +127,7 @@ public class TreeStructureManager
List<UIComponent> childList = component.getChildren();
for (int i = 0, len = childArray.length; i < len; i++)
{
- UIComponent child = internalRestoreTreeStructure(childArray[i]);
+ UIComponent child = internalRestoreTreeStructure(childArray[i], false);
childList.add(child);
}
}
@@ -136,7 +142,7 @@ public class TreeStructureManager
Object[] tuple = (Object[])facetArray[i];
String facetName = (String)tuple[0];
TreeStructComponent structChild = (TreeStructComponent)tuple[1];
- UIComponent child = internalRestoreTreeStructure(structChild);
+ UIComponent child = internalRestoreTreeStructure(structChild, false);
facetMap.put(facetName, child);
}
}
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java?rev=1183529&r1=1183528&r2=1183529&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java Fri Oct 14 22:24:16 2011
@@ -1081,11 +1081,11 @@ public class DefaultFaceletsStateManagem
return;
}
- FacesContext facesContext = FacesContext.getCurrentInstance();
- if (FaceletViewDeclarationLanguage.isRefreshingTransientBuild(facesContext))
- {
- return;
- }
+ //FacesContext facesContext = FacesContext.getCurrentInstance();
+ //if (FaceletViewDeclarationLanguage.isRefreshingTransientBuild(facesContext))
+ //{
+ // return;
+ //}
if (event instanceof PostAddToViewEvent)
{
@@ -1094,6 +1094,7 @@ public class DefaultFaceletsStateManagem
}
else
{
+ FacesContext facesContext = FacesContext.getCurrentInstance();
// In this case if we are removing components on build, it is not necessary to register
// again the current id, and its more, it could cause a concurrent exception. But note
// we need to propagate PreRemoveFromViewEvent, otherwise the view will not be restored