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 2012/06/19 11:48:55 UTC
svn commit: r1351625 [1/2] - in /myfaces/core/trunk/impl/src:
main/java/org/apache/myfaces/el/unified/resolver/
main/java/org/apache/myfaces/el/unified/resolver/implicitobject/
main/java/org/apache/myfaces/view/facelets/
main/java/org/apache/myfaces/vi...
Author: lu4242
Date: Tue Jun 19 09:48:54 2012
New Revision: 1351625
URL: http://svn.apache.org/viewvc?rev=1351625&view=rev
Log:
MYFACES-3383 Self nested Composite Component leads to EL Stack Overflow
Added:
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentNestedCCTestCase.java
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentCCRefTestCase.java
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC1.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC1_1.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC1_2.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC2.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC3.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC4.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC5.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC5_1.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC5_2.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC6.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC7.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC8.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeNestedCC1.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeNestedCC2.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeNestedCC3.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeNestedCC3_1.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeNestedCC3_2.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeNestedCC4.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeNestedCC5.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeNestedCC6.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeNestedCC7.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeNestedCC7_1.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeNestedCC7_2.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeInsertChildren6.xhtml
myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeNestedCC8.xhtml
- copied, changed from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testCompositeInsertChildren6.xhtml
Modified:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceResolver.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/CompositeComponentImplicitObject.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletCompositionContext.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/ELText.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationMethodExpression.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationValueExpression.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationValueExpressionUEL.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCompositionContextImpl.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentDefinitionTagHandler.java
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceResolver.java?rev=1351625&r1=1351624&r2=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceResolver.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceResolver.java Tue Jun 19 09:48:54 2012
@@ -105,6 +105,11 @@ public final class ResourceResolver exte
if (CC_LIBRARY_THIS.equals(libraryName))
{
+ // note in this case we don't need to resolve to an specific
+ // composite component, instead we need to find the libraryName of the
+ // composite component associated with the Location. For any composite component
+ // instance that is created under the same facelet it will be the same,
+ // so it is enought to get the first one matching the Location object.
FacesContext facesContext = facesContext(context);
Location location = ResourceELUtils.getResourceLocationForResolver(facesContext);
UIComponent cc = CompositeComponentELUtils.
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/CompositeComponentImplicitObject.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/CompositeComponentImplicitObject.java?rev=1351625&r1=1351624&r2=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/CompositeComponentImplicitObject.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/unified/resolver/implicitobject/CompositeComponentImplicitObject.java Tue Jun 19 09:48:54 2012
@@ -19,6 +19,7 @@
package org.apache.myfaces.el.unified.resolver.implicitobject;
import java.beans.FeatureDescriptor;
+import java.util.List;
import javax.el.ELContext;
import javax.faces.component.UIComponent;
@@ -49,8 +50,15 @@ public class CompositeComponentImplicitO
// Look for the attribute set by LocationValueExpression
// or LocationMethodExpression on the FacesContext
- UIComponent cc = (UIComponent) facesContext.getAttributes()
+ List<UIComponent> list = (List<UIComponent>) facesContext.getAttributes()
.get(CompositeComponentELUtils.CURRENT_COMPOSITE_COMPONENT_KEY);
+
+ UIComponent cc = null;
+
+ if (list != null && !list.isEmpty())
+ {
+ cc = list.get(list.size()-1);
+ }
if (cc == null)
{
// take the composite component from the stack
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletCompositionContext.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletCompositionContext.java?rev=1351625&r1=1351624&r2=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletCompositionContext.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletCompositionContext.java Tue Jun 19 09:48:54 2012
@@ -585,4 +585,15 @@ abstract public class FaceletComposition
{
return new StringBuilder();
}
+
+ /**
+ * Returns the current nesting level of composite components found. If
+ * no composite component has been used returns 0.
+ *
+ * @since 2.1.9, 2.0.15
+ */
+ public int getCompositeComponentLevel()
+ {
+ return 0;
+ }
}
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java?rev=1351625&r1=1351624&r2=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguage.java Tue Jun 19 09:48:54 2012
@@ -1746,7 +1746,8 @@ public class FaceletViewDeclarationLangu
return new LocationMethodExpression(
((LocationValueExpression) originalValueExpression).getLocation(),
reWrapMethodExpression(createdMethodExpression,
- ((LocationValueExpression) originalValueExpression).getWrapped()));
+ ((LocationValueExpression) originalValueExpression).getWrapped()),
+ ((LocationValueExpression) originalValueExpression).getCCLevel());
}
else if (originalValueExpression instanceof FacesWrapper &&
((FacesWrapper) originalValueExpression).getWrapped() instanceof ValueExpression)
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java?rev=1351625&r1=1351624&r2=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java Tue Jun 19 09:48:54 2012
@@ -18,6 +18,8 @@
*/
package org.apache.myfaces.view.facelets.el;
+import java.util.ArrayList;
+import java.util.List;
import java.util.regex.Pattern;
import javax.faces.component.UIComponent;
@@ -50,6 +52,12 @@ public final class CompositeComponentELU
* in the attributes map of the component by InterfaceHandler.
*/
public static final String LOCATION_KEY = "org.apache.myfaces.compositecomponent.location";
+
+ /**
+ * Indicates the nesting level where the composite component was created, working as reference
+ * point to all EL expressions created in that point from Facelets engine.
+ */
+ public static final String LEVEL_KEY = "oam.cc.ccLevel";
/**
* A regular expression used to determine if cc is used in an expression String.
@@ -233,6 +241,170 @@ public final class CompositeComponentELU
currentComponent.pushComponentToEL(facesContext, currentComponent);
}
}
+
+ private static int getCCLevel(UIComponent component)
+ {
+ Integer ccLevel = (Integer) component.getAttributes().get(LEVEL_KEY);
+ if (ccLevel == null)
+ {
+ return 0;
+ }
+ return ccLevel.intValue();
+ }
+
+ /**
+ * Same as getCompositeComponentBasedOnLocation(final FacesContext facesContext, final Location location),
+ * but takes into account the ccLevel to resolve the composite component.
+ *
+ * @param facesContext
+ * @param location
+ * @param ccLevel
+ * @return
+ */
+ public static UIComponent getCompositeComponentBasedOnLocation(final FacesContext facesContext,
+ final Location location, int ccLevel)
+ {
+ //1 Use getCurrentComponent and getCurrentCompositeComponent to look on the component stack
+ UIComponent currentComponent = UIComponent.getCurrentComponent(facesContext);
+
+ if (currentComponent == null)
+ {
+ // Cannot found any component, because we don't have any reference!
+ return null;
+ }
+
+ UIComponent currentCompositeComponent = UIComponent.getCurrentCompositeComponent(facesContext);
+
+ //1.1 Use getCurrentCompositeComponent first!
+ if (currentCompositeComponent != null)
+ {
+ Location componentLocation = (Location) currentCompositeComponent.getAttributes().get(LOCATION_KEY);
+ if (componentLocation != null
+ && componentLocation.getPath().equals(location.getPath()) &&
+ (ccLevel == getCCLevel(currentCompositeComponent)) )
+ {
+ return currentCompositeComponent;
+ }
+ }
+
+ //2. Look on the stack using a recursive algorithm.
+ UIComponent matchingCompositeComponent
+ = lookForCompositeComponentOnStack(facesContext, location, ccLevel, currentComponent);
+
+ if (matchingCompositeComponent != null)
+ {
+ return matchingCompositeComponent;
+ }
+
+ //2. Try to find it using UIComponent.getCurrentCompositeComponent().
+ // This one will look the direct parent hierarchy of the component,
+ // to see if the composite component can be found.
+ if (currentCompositeComponent != null)
+ {
+ currentComponent = currentCompositeComponent;
+ }
+ else
+ {
+ //Try to find the composite component looking directly the parent
+ //ancestor of the current component
+ //currentComponent = UIComponent.getCurrentComponent(facesContext);
+ boolean found = false;
+ while (currentComponent != null && !found)
+ {
+ String findComponentExpr = (String) currentComponent.getAttributes().get(CC_FIND_COMPONENT_EXPRESSION);
+ if (findComponentExpr != null)
+ {
+ UIComponent foundComponent = facesContext.getViewRoot().findComponent(findComponentExpr);
+ if (foundComponent != null)
+ {
+ Location foundComponentLocation = (Location) currentComponent.getAttributes().get(LOCATION_KEY);
+ if (foundComponentLocation != null
+ && foundComponentLocation.getPath().equals(location.getPath()) &&
+ ccLevel == getCCLevel(foundComponent))
+ {
+ return foundComponent;
+ }
+ else
+ {
+ while (foundComponent != null)
+ {
+ Location componentLocation
+ = (Location) foundComponent.getAttributes().get(LOCATION_KEY);
+ if (componentLocation != null
+ && componentLocation.getPath().equals(location.getPath()) &&
+ ccLevel == getCCLevel(foundComponent))
+ {
+ return foundComponent;
+ }
+ // get the composite component's parent
+ foundComponent = UIComponent.getCompositeComponentParent(foundComponent);
+ }
+ }
+ }
+ }
+
+ if (UIComponent.isCompositeComponent(currentComponent))
+ {
+ found = true;
+ }
+ else
+ {
+ currentComponent = currentComponent.getParent();
+ }
+ }
+ }
+
+ //if currentComponent != null means we have a composite component that we can check
+ //Use UIComponent.getCompositeComponentParent() to traverse here.
+ while (currentComponent != null)
+ {
+ Location componentLocation = (Location) currentComponent.getAttributes().get(LOCATION_KEY);
+ if (componentLocation != null
+ && componentLocation.getPath().equals(location.getPath()) &&
+ ccLevel == getCCLevel(currentComponent))
+ {
+ return currentComponent;
+ }
+ // get the composite component's parent
+ currentComponent = UIComponent.getCompositeComponentParent(currentComponent);
+ }
+
+ // not found
+ return null;
+ }
+
+ private static UIComponent lookForCompositeComponentOnStack(final FacesContext facesContext,
+ final Location location, int ccLevel,
+ UIComponent currentComponent)
+ {
+ if (UIComponent.isCompositeComponent(currentComponent))
+ {
+ Location componentLocation = (Location) currentComponent.getAttributes().get(LOCATION_KEY);
+ if (componentLocation != null
+ && componentLocation.getPath().equals(location.getPath()) &&
+ (ccLevel == getCCLevel(currentComponent)) )
+ {
+ return currentComponent;
+ }
+ }
+ currentComponent.popComponentFromEL(facesContext);
+ try
+ {
+ UIComponent c = UIComponent.getCurrentComponent(facesContext);
+ if (c != null)
+ {
+ return lookForCompositeComponentOnStack( facesContext, location, ccLevel, c);
+ }
+ else
+ {
+ return null;
+ }
+ }
+ finally
+ {
+ currentComponent.pushComponentToEL(facesContext, currentComponent);
+ }
+ }
/**
* Trys to get the composite component using getCompositeComponentBasedOnLocation()
@@ -241,10 +413,18 @@ public final class CompositeComponentELU
* @param facesContext
* @param location
*/
- public static void saveCompositeComponentForResolver(FacesContext facesContext, Location location)
+ public static void saveCompositeComponentForResolver(FacesContext facesContext, Location location, int ccLevel)
{
- UIComponent cc = getCompositeComponentBasedOnLocation(facesContext, location);
- facesContext.getAttributes().put(CURRENT_COMPOSITE_COMPONENT_KEY, cc);
+ UIComponent cc = ccLevel > 0 ? getCompositeComponentBasedOnLocation(facesContext, location, ccLevel)
+ : getCompositeComponentBasedOnLocation(facesContext, location);
+ //facesContext.getAttributes().put(CURRENT_COMPOSITE_COMPONENT_KEY, cc);
+ List<UIComponent> list = (List<UIComponent>) facesContext.getAttributes().get(CURRENT_COMPOSITE_COMPONENT_KEY);
+ if (list == null)
+ {
+ list = new ArrayList<UIComponent>();
+ facesContext.getAttributes().put(CURRENT_COMPOSITE_COMPONENT_KEY, list);
+ }
+ list.add(cc);
}
/**
@@ -254,6 +434,11 @@ public final class CompositeComponentELU
public static void removeCompositeComponentForResolver(FacesContext facesContext)
{
facesContext.getAttributes().remove(CURRENT_COMPOSITE_COMPONENT_KEY);
+ List<UIComponent> list = (List<UIComponent>) facesContext.getAttributes().get(CURRENT_COMPOSITE_COMPONENT_KEY);
+ if (list != null)
+ {
+ list.remove(list.size()-1);
+ }
}
/**
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/ELText.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/ELText.java?rev=1351625&r1=1351624&r2=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/ELText.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/ELText.java Tue Jun 19 09:48:54 2012
@@ -258,6 +258,19 @@ public class ELText
if (actx.isAllowCacheELExpressions() && cached != null)
{
+ // In TagAttributeImpl.getValueExpression(), it is necessary to do an
+ // special logic to detect the cases where #{cc} is included into the
+ // EL expression and set the proper ccLevel. In this case, it is usual
+ // the parent composite component is always on top, but it is possible to
+ // write a nesting case with <composite:insertChildren>, and
+ // pass a flat EL expression over itself. So, it is necessary to update
+ // the ccLevel to make possible to find the right parent where this
+ // expression belongs to.
+ if ((this.capabilities & EL_CC) != 0)
+ {
+ return new ELTextVariable(((LocationValueExpression)cached.ve).apply(
+ actx.getFaceletCompositionContext().getCompositeComponentLevel()));
+ }
return cached;
}
@@ -277,11 +290,13 @@ public class ELText
{
if (ExternalSpecifications.isUnifiedELAvailable())
{
- valueExpression = new LocationValueExpressionUEL(location, valueExpression);
+ valueExpression = new LocationValueExpressionUEL(location, valueExpression,
+ actx.getFaceletCompositionContext().getCompositeComponentLevel());
}
else
{
- valueExpression = new LocationValueExpression(location, valueExpression);
+ valueExpression = new LocationValueExpression(location, valueExpression,
+ actx.getFaceletCompositionContext().getCompositeComponentLevel());
}
}
}
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationMethodExpression.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationMethodExpression.java?rev=1351625&r1=1351624&r2=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationMethodExpression.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationMethodExpression.java Tue Jun 19 09:48:54 2012
@@ -53,6 +53,7 @@ public class LocationMethodExpression ex
private Location location;
private MethodExpression delegate;
+ int ccLevel;
public LocationMethodExpression()
{
@@ -63,18 +64,38 @@ public class LocationMethodExpression ex
{
this.location = location;
this.delegate = delegate;
+ this.ccLevel = 0;
}
-
+
+ public LocationMethodExpression(Location location, MethodExpression delegate, int ccLevel)
+ {
+ this.location = location;
+ this.delegate = delegate;
+ this.ccLevel = ccLevel;
+ }
+
public Location getLocation()
{
return location;
}
+ public LocationMethodExpression apply(int newCCLevel)
+ {
+ if(this.ccLevel == newCCLevel)
+ {
+ return this;
+ }
+ else
+ {
+ return new LocationMethodExpression(this.location, this.delegate, newCCLevel);
+ }
+ }
+
@Override
public MethodInfo getMethodInfo(ELContext context)
{
FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class);
- CompositeComponentELUtils.saveCompositeComponentForResolver(facesContext, location);
+ CompositeComponentELUtils.saveCompositeComponentForResolver(facesContext, location, ccLevel);
try
{
return delegate.getMethodInfo(context);
@@ -89,7 +110,7 @@ public class LocationMethodExpression ex
public Object invoke(ELContext context, Object[] params)
{
FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class);
- CompositeComponentELUtils.saveCompositeComponentForResolver(facesContext, location);
+ CompositeComponentELUtils.saveCompositeComponentForResolver(facesContext, location, ccLevel);
try
{
return delegate.invoke(context, params);
@@ -133,12 +154,14 @@ public class LocationMethodExpression ex
{
this.delegate = (MethodExpression) in.readObject();
this.location = (Location) in.readObject();
+ this.ccLevel = in.readInt();
}
public void writeExternal(ObjectOutput out) throws IOException
{
out.writeObject(this.delegate);
out.writeObject(this.location);
+ out.writeInt(this.ccLevel);
}
}
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationValueExpression.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationValueExpression.java?rev=1351625&r1=1351624&r2=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationValueExpression.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationValueExpression.java Tue Jun 19 09:48:54 2012
@@ -53,6 +53,7 @@ public class LocationValueExpression ext
// location and delegate need to be available in LocationValueExpressionUEL
Location location;
ValueExpression delegate;
+ int ccLevel;
public LocationValueExpression()
{
@@ -63,6 +64,14 @@ public class LocationValueExpression ext
{
this.location = location;
this.delegate = delegate;
+ this.ccLevel = 0;
+ }
+
+ public LocationValueExpression(Location location, ValueExpression delegate, int ccLevel)
+ {
+ this.location = location;
+ this.delegate = delegate;
+ this.ccLevel = ccLevel;
}
public Location getLocation()
@@ -70,6 +79,23 @@ public class LocationValueExpression ext
return location;
}
+ public int getCCLevel()
+ {
+ return ccLevel;
+ }
+
+ public LocationValueExpression apply(int newCCLevel)
+ {
+ if(this.ccLevel == newCCLevel)
+ {
+ return this;
+ }
+ else
+ {
+ return new LocationValueExpression(this.location, this.delegate, newCCLevel);
+ }
+ }
+
@Override
public Class<?> getExpectedType()
{
@@ -80,7 +106,7 @@ public class LocationValueExpression ext
public Class<?> getType(ELContext context)
{
FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class);
- CompositeComponentELUtils.saveCompositeComponentForResolver(facesContext, location);
+ CompositeComponentELUtils.saveCompositeComponentForResolver(facesContext, location, ccLevel);
try
{
return delegate.getType(context);
@@ -95,7 +121,7 @@ public class LocationValueExpression ext
public Object getValue(ELContext context)
{
FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class);
- CompositeComponentELUtils.saveCompositeComponentForResolver(facesContext, location);
+ CompositeComponentELUtils.saveCompositeComponentForResolver(facesContext, location, ccLevel);
try
{
return delegate.getValue(context);
@@ -110,7 +136,7 @@ public class LocationValueExpression ext
public boolean isReadOnly(ELContext context)
{
FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class);
- CompositeComponentELUtils.saveCompositeComponentForResolver(facesContext, location);
+ CompositeComponentELUtils.saveCompositeComponentForResolver(facesContext, location, ccLevel);
try
{
return delegate.isReadOnly(context);
@@ -125,7 +151,7 @@ public class LocationValueExpression ext
public void setValue(ELContext context, Object value)
{
FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class);
- CompositeComponentELUtils.saveCompositeComponentForResolver(facesContext, location);
+ CompositeComponentELUtils.saveCompositeComponentForResolver(facesContext, location, ccLevel);
try
{
delegate.setValue(context, value);
@@ -169,11 +195,13 @@ public class LocationValueExpression ext
{
this.delegate = (ValueExpression) in.readObject();
this.location = (Location) in.readObject();
+ this.ccLevel = in.readInt();
}
public void writeExternal(ObjectOutput out) throws IOException
{
out.writeObject(this.delegate);
out.writeObject(this.location);
+ out.writeInt(this.ccLevel);
}
}
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationValueExpressionUEL.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationValueExpressionUEL.java?rev=1351625&r1=1351624&r2=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationValueExpressionUEL.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/LocationValueExpressionUEL.java Tue Jun 19 09:48:54 2012
@@ -45,11 +45,28 @@ public class LocationValueExpressionUEL
super(location, delegate);
}
+ public LocationValueExpressionUEL(Location location, ValueExpression delegate, int ccLevel)
+ {
+ super(location, delegate, ccLevel);
+ }
+
+ public LocationValueExpression apply(int newCCLevel)
+ {
+ if(this.ccLevel == newCCLevel)
+ {
+ return this;
+ }
+ else
+ {
+ return new LocationValueExpressionUEL(this.location, this.delegate, newCCLevel);
+ }
+ }
+
@Override
public ValueReference getValueReference(ELContext context)
{
FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class);
- CompositeComponentELUtils.saveCompositeComponentForResolver(facesContext, location);
+ CompositeComponentELUtils.saveCompositeComponentForResolver(facesContext, location, ccLevel);
try
{
return delegate.getValueReference(context);
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCompositionContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCompositionContextImpl.java?rev=1351625&r1=1351624&r2=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCompositionContextImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCompositionContextImpl.java Tue Jun 19 09:48:54 2012
@@ -139,6 +139,8 @@ public class FaceletCompositionContextIm
private StringBuilder _sharedStringBuilder;
+ private int _ccLevel;
+
public FaceletCompositionContextImpl(FaceletFactory factory, FacesContext facesContext)
{
super();
@@ -175,6 +177,7 @@ public class FaceletCompositionContextIm
_level = 0;
_isInMetadataSection = 0;
_sharedStringBuilder = null;
+ _ccLevel = 0;
}
@Override
@@ -261,6 +264,7 @@ public class FaceletCompositionContextIm
_compositeComponentStack = new LinkedList<UIComponent>();
}
_compositeComponentStack.addFirst(parent);
+ _ccLevel++;
}
@Override
@@ -270,6 +274,13 @@ public class FaceletCompositionContextIm
{
_compositeComponentStack.removeFirst();
}
+ _ccLevel--;
+ }
+
+ @Override
+ public int getCompositeComponentLevel()
+ {
+ return _ccLevel;
}
@Override
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java?rev=1351625&r1=1351624&r2=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java Tue Jun 19 09:48:54 2012
@@ -217,6 +217,11 @@ public final class TagAttributeImpl exte
(type != null && type.equals(localCachedExpression[(i*3)])) ) &&
(Arrays.equals(paramTypes, (Class[]) localCachedExpression[(i*3)+1])) )
{
+ if ((this.capabilities & EL_CC) != 0)
+ {
+ return ((LocationMethodExpression)localCachedExpression[(i*3)+2]).apply(
+ actx.getFaceletCompositionContext().getCompositeComponentLevel());
+ }
return (MethodExpression) localCachedExpression[(i*3)+2];
}
}
@@ -263,7 +268,8 @@ public final class TagAttributeImpl exte
// (see MYFACES-2561 for details)
if ((this.capabilities & EL_CC) != 0)
{
- methodExpression = new LocationMethodExpression(getLocation(), methodExpression);
+ methodExpression = new LocationMethodExpression(getLocation(), methodExpression,
+ actx.getFaceletCompositionContext().getCompositeComponentLevel());
}
}
@@ -442,10 +448,22 @@ public final class TagAttributeImpl exte
//If the expected type is the same return the cached one
if (localCachedExpression[0] == null && type == null)
{
+ // If #{cc} recalculate the composite component level
+ if ((this.capabilities & EL_CC) != 0)
+ {
+ return ((LocationValueExpression)localCachedExpression[1]).apply(
+ actx.getFaceletCompositionContext().getCompositeComponentLevel());
+ }
return (ValueExpression) localCachedExpression[1];
}
else if (localCachedExpression[0] != null && localCachedExpression[0].equals(type))
{
+ // If #{cc} recalculate the composite component level
+ if ((this.capabilities & EL_CC) != 0)
+ {
+ return ((LocationValueExpression)localCachedExpression[1]).apply(
+ actx.getFaceletCompositionContext().getCompositeComponentLevel());
+ }
return (ValueExpression) localCachedExpression[1];
}
}
@@ -488,11 +506,13 @@ public final class TagAttributeImpl exte
{
if (ExternalSpecifications.isUnifiedELAvailable())
{
- valueExpression = new LocationValueExpressionUEL(getLocation(), valueExpression);
+ valueExpression = new LocationValueExpressionUEL(getLocation(), valueExpression,
+ actx.getFaceletCompositionContext().getCompositeComponentLevel());
}
else
{
- valueExpression = new LocationValueExpression(getLocation(), valueExpression);
+ valueExpression = new LocationValueExpression(getLocation(), valueExpression,
+ actx.getFaceletCompositionContext().getCompositeComponentLevel());
}
}
else if ((this.capabilities & EL_RESOURCE) != 0)
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentDefinitionTagHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentDefinitionTagHandler.java?rev=1351625&r1=1351624&r2=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentDefinitionTagHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentDefinitionTagHandler.java Tue Jun 19 09:48:54 2012
@@ -150,6 +150,13 @@ public final class CompositeComponentDef
try
{
mctx.pushCompositeComponentToStack(compositeBaseParent);
+
+ // Store the ccLevel key here
+ if (!compositeBaseParent.getAttributes().containsKey(CompositeComponentELUtils.LEVEL_KEY))
+ {
+ compositeBaseParent.getAttributes()
+ .put(CompositeComponentELUtils.LEVEL_KEY, mctx.getCompositeComponentLevel());
+ }
_nextHandler.apply(ctx, parent);
@@ -195,6 +202,13 @@ public final class CompositeComponentDef
try
{
mctx.pushCompositeComponentToStack(compositeBaseParent);
+
+ // Store the ccLevel key here
+ if (!compositeBaseParent.getAttributes().containsKey(CompositeComponentELUtils.LEVEL_KEY))
+ {
+ compositeBaseParent.getAttributes()
+ .put(CompositeComponentELUtils.LEVEL_KEY, mctx.getCompositeComponentLevel());
+ }
_nextHandler.apply(ctx, parent);
@@ -230,6 +244,13 @@ public final class CompositeComponentDef
try
{
mctx.pushCompositeComponentToStack(compositeBaseParent);
+
+ // Store the ccLevel key here
+ if (!compositeBaseParent.getAttributes().containsKey(CompositeComponentELUtils.LEVEL_KEY))
+ {
+ compositeBaseParent.getAttributes()
+ .put(CompositeComponentELUtils.LEVEL_KEY, mctx.getCompositeComponentLevel());
+ }
_nextHandler.apply(ctx, parent);
}
Copied: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentNestedCCTestCase.java (from r1344644, myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentCCRefTestCase.java)
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentNestedCCTestCase.java?p2=myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentNestedCCTestCase.java&p1=myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentCCRefTestCase.java&r1=1344644&r2=1351625&rev=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentCCRefTestCase.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentNestedCCTestCase.java Tue Jun 19 09:48:54 2012
@@ -25,15 +25,14 @@ import javax.el.ExpressionFactory;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
-import org.apache.myfaces.config.RuntimeConfig;
-import org.apache.myfaces.test.mock.MockExternalContext;
import org.apache.myfaces.test.mock.MockResponseWriter;
+import org.apache.myfaces.view.facelets.ELExpressionCacheMode;
import org.apache.myfaces.view.facelets.FaceletTestCase;
-import org.apache.myfaces.view.facelets.bean.HelloWorld;
+import org.apache.myfaces.view.facelets.impl.FaceletCompositionContextImpl;
import org.junit.Assert;
import org.junit.Test;
-public class CompositeComponentCCRefTestCase extends FaceletTestCase
+public class CompositeComponentNestedCCTestCase extends FaceletTestCase
{
@Override
@@ -49,15 +48,254 @@ public class CompositeComponentCCRefTest
}
@Test
- public void testCCRefOnStylesheet() throws Exception
+ public void testCompositeNestedCC1() throws Exception
{
- HelloWorld helloWorld = new HelloWorld();
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testCompositeNestedCC1.xhtml");
+
+ UIComponent panelGroup1 = root.findComponent("testGroup1");
+ Assert.assertNotNull(panelGroup1);
+
+ StringWriter sw = new StringWriter();
+ MockResponseWriter mrw = new MockResponseWriter(sw);
+ facesContext.setResponseWriter(mrw);
+
+ root.encodeAll(facesContext);
+ sw.flush();
+ Assert.assertTrue(sw.toString().contains("ALFA"));
+ Assert.assertTrue(sw.toString().contains("BETA"));
+ Assert.assertTrue(sw.toString().contains("GAMMA"));
+ }
+
+ /**
+ * The same tests, but with caching enabled. In this case, ccLevel changes
+ * all the time, so the caching logic must take that into account.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCompositeNestedCC1Cache() throws Exception
+ {
+ servletContext.addInitParameter(FaceletCompositionContextImpl.INIT_PARAM_CACHE_EL_EXPRESSIONS,
+ ELExpressionCacheMode.always.toString());
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testCompositeNestedCC1.xhtml");
+
+ UIComponent panelGroup1 = root.findComponent("testGroup1");
+ Assert.assertNotNull(panelGroup1);
+
+ StringWriter sw = new StringWriter();
+ MockResponseWriter mrw = new MockResponseWriter(sw);
+ facesContext.setResponseWriter(mrw);
+
+ root.encodeAll(facesContext);
+ sw.flush();
+ Assert.assertTrue(sw.toString().contains("ALFA"));
+ Assert.assertTrue(sw.toString().contains("BETA"));
+ Assert.assertTrue(sw.toString().contains("GAMMA"));
+ }
+
+ /**
+ * Try a nested reference inside the same composite component
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCompositeNestedCC2() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testCompositeNestedCC2.xhtml");
+
+ UIComponent panelGroup1 = root.findComponent("testGroup1");
+ Assert.assertNotNull(panelGroup1);
+
+ StringWriter sw = new StringWriter();
+ MockResponseWriter mrw = new MockResponseWriter(sw);
+ facesContext.setResponseWriter(mrw);
+
+ root.encodeAll(facesContext);
+ sw.flush();
+ Assert.assertTrue(sw.toString().contains("ALFA"));
+ Assert.assertTrue(sw.toString().contains("BETA"));
+ Assert.assertTrue(sw.toString().contains("GAMMA"));
+ Assert.assertTrue(sw.toString().contains("OMEGA"));
+ }
+
+ /**
+ * Try a nested reference inside the same composite component
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCompositeNestedCC2Cache() throws Exception
+ {
+ servletContext.addInitParameter(FaceletCompositionContextImpl.INIT_PARAM_CACHE_EL_EXPRESSIONS,
+ ELExpressionCacheMode.always.toString());
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testCompositeNestedCC2.xhtml");
+
+ UIComponent panelGroup1 = root.findComponent("testGroup1");
+ Assert.assertNotNull(panelGroup1);
+
+ StringWriter sw = new StringWriter();
+ MockResponseWriter mrw = new MockResponseWriter(sw);
+ facesContext.setResponseWriter(mrw);
+
+ root.encodeAll(facesContext);
+ sw.flush();
+ Assert.assertTrue(sw.toString().contains("ALFA"));
+ Assert.assertTrue(sw.toString().contains("BETA"));
+ Assert.assertTrue(sw.toString().contains("GAMMA"));
+ Assert.assertTrue(sw.toString().contains("OMEGA"));
+ }
+
+ /**
+ * Try what happen when a dynamic ui:include is used inside a composite
+ * component and that include contains a reference to the same composite
+ * component.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCompositeNestedCC3() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testCompositeNestedCC3.xhtml");
+
+ UIComponent panelGroup1 = root.findComponent("testGroup1");
+ Assert.assertNotNull(panelGroup1);
+
+ StringWriter sw = new StringWriter();
+ MockResponseWriter mrw = new MockResponseWriter(sw);
+ facesContext.setResponseWriter(mrw);
+
+ root.encodeAll(facesContext);
+ sw.flush();
+ Assert.assertTrue(sw.toString().contains("ALFA"));
+ Assert.assertTrue(sw.toString().contains("BETA"));
+ Assert.assertTrue(sw.toString().contains("GAMMA"));
+ Assert.assertTrue(sw.toString().contains("OMEGA"));
+ }
+
+ /**
+ * Try what happen when a dynamic ui:include is used inside a composite
+ * component and that include contains a reference to the same composite
+ * component.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCompositeNestedCC3Cache() throws Exception
+ {
+ servletContext.addInitParameter(FaceletCompositionContextImpl.INIT_PARAM_CACHE_EL_EXPRESSIONS,
+ ELExpressionCacheMode.always.toString()); //allowCset
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testCompositeNestedCC3.xhtml");
+
+ UIComponent panelGroup1 = root.findComponent("testGroup1");
+ Assert.assertNotNull(panelGroup1);
+
+ StringWriter sw = new StringWriter();
+ MockResponseWriter mrw = new MockResponseWriter(sw);
+ facesContext.setResponseWriter(mrw);
+
+ root.encodeAll(facesContext);
+ sw.flush();
+ Assert.assertTrue(sw.toString().contains("ALFA"));
+ Assert.assertTrue(sw.toString().contains("BETA"));
+ Assert.assertTrue(sw.toString().contains("GAMMA"));
+ Assert.assertTrue(sw.toString().contains("OMEGA"));
+ }
+
+ /**
+ * Try a nested insertChildren with some conditional inclusions.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCompositeNestedCC4() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testCompositeNestedCC4.xhtml");
+
+ UIComponent panelGroup1 = root.findComponent("testGroup1");
+ Assert.assertNotNull(panelGroup1);
+
+ StringWriter sw = new StringWriter();
+ MockResponseWriter mrw = new MockResponseWriter(sw);
+ facesContext.setResponseWriter(mrw);
+
+ root.encodeAll(facesContext);
+ sw.flush();
+ Assert.assertTrue(sw.toString().contains("ALFA"));
+ Assert.assertTrue(sw.toString().contains("BETA"));
+ Assert.assertTrue(sw.toString().contains("GAMMA"));
+ Assert.assertTrue(sw.toString().contains("OMEGA"));
+ }
+
+ /**
+ * Try a nested insertChildren with some conditional inclusions.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCompositeNestedCC4Cache() throws Exception
+ {
+ servletContext.addInitParameter(FaceletCompositionContextImpl.INIT_PARAM_CACHE_EL_EXPRESSIONS,
+ ELExpressionCacheMode.always.toString());
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testCompositeNestedCC4.xhtml");
+
+ UIComponent panelGroup1 = root.findComponent("testGroup1");
+ Assert.assertNotNull(panelGroup1);
+
+ StringWriter sw = new StringWriter();
+ MockResponseWriter mrw = new MockResponseWriter(sw);
+ facesContext.setResponseWriter(mrw);
- facesContext.getExternalContext().getRequestMap().put("helloWorldBean",
- helloWorld);
+ root.encodeAll(facesContext);
+ sw.flush();
+ Assert.assertTrue(sw.toString().contains("ALFA"));
+ Assert.assertTrue(sw.toString().contains("BETA"));
+ Assert.assertTrue(sw.toString().contains("GAMMA"));
+ Assert.assertTrue(sw.toString().contains("OMEGA"));
+ }
+
+ @Test
+ public void testCompositeNestedCC5() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testCompositeNestedCC5.xhtml");
+
+ UIComponent panelGroup1 = root.findComponent("testGroup1");
+ Assert.assertNotNull(panelGroup1);
+
+ StringWriter sw = new StringWriter();
+ MockResponseWriter mrw = new MockResponseWriter(sw);
+ facesContext.setResponseWriter(mrw);
+ root.encodeAll(facesContext);
+ sw.flush();
+ Assert.assertTrue(sw.toString().contains("ALFA"));
+ Assert.assertTrue(sw.toString().contains("BETA"));
+ Assert.assertTrue(sw.toString().contains("GAMMA"));
+ }
+
+ /**
+ * The same tests, but with caching enabled. In this case, ccLevel changes
+ * all the time, so the caching logic must take that into account.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCompositeNestedCC5Cache() throws Exception
+ {
+ servletContext.addInitParameter(FaceletCompositionContextImpl.INIT_PARAM_CACHE_EL_EXPRESSIONS,
+ ELExpressionCacheMode.always.toString());
UIViewRoot root = facesContext.getViewRoot();
- vdl.buildView(facesContext, root, "testCCRefOnStylesheet.xhtml");
+ vdl.buildView(facesContext, root, "testCompositeNestedCC5.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
Assert.assertNotNull(panelGroup1);
@@ -68,19 +306,163 @@ public class CompositeComponentCCRefTest
root.encodeAll(facesContext);
sw.flush();
- Assert.assertTrue(sw.toString().contains(".myCustomStyle { background:red }"));
+ Assert.assertTrue(sw.toString().contains("ALFA"));
+ Assert.assertTrue(sw.toString().contains("BETA"));
+ Assert.assertTrue(sw.toString().contains("GAMMA"));
}
+ /**
+ * Try a nested reference inside the same composite component
+ *
+ * @throws Exception
+ */
@Test
- public void testCCRefOnScript() throws Exception
+ public void testCompositeNestedCC6() throws Exception
{
- HelloWorld helloWorld = new HelloWorld();
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testCompositeNestedCC6.xhtml");
+
+ UIComponent panelGroup1 = root.findComponent("testGroup1");
+ Assert.assertNotNull(panelGroup1);
+
+ StringWriter sw = new StringWriter();
+ MockResponseWriter mrw = new MockResponseWriter(sw);
+ facesContext.setResponseWriter(mrw);
- facesContext.getExternalContext().getRequestMap().put("helloWorldBean",
- helloWorld);
+ root.encodeAll(facesContext);
+ sw.flush();
+ Assert.assertTrue(sw.toString().contains("ALFA"));
+ Assert.assertTrue(sw.toString().contains("BETA"));
+ Assert.assertTrue(sw.toString().contains("GAMMA"));
+ Assert.assertTrue(sw.toString().contains("OMEGA"));
+ }
+
+ /**
+ * Try a nested reference inside the same composite component
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCompositeNestedCC6Cache() throws Exception
+ {
+ servletContext.addInitParameter(FaceletCompositionContextImpl.INIT_PARAM_CACHE_EL_EXPRESSIONS,
+ ELExpressionCacheMode.always.toString());
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testCompositeNestedCC6.xhtml");
+
+ UIComponent panelGroup1 = root.findComponent("testGroup1");
+ Assert.assertNotNull(panelGroup1);
+
+ StringWriter sw = new StringWriter();
+ MockResponseWriter mrw = new MockResponseWriter(sw);
+ facesContext.setResponseWriter(mrw);
+ root.encodeAll(facesContext);
+ sw.flush();
+ Assert.assertTrue(sw.toString().contains("ALFA"));
+ Assert.assertTrue(sw.toString().contains("BETA"));
+ Assert.assertTrue(sw.toString().contains("GAMMA"));
+ Assert.assertTrue(sw.toString().contains("OMEGA"));
+ }
+
+ /**
+ * Try what happen when a dynamic ui:include is used inside a composite
+ * component and that include contains a reference to the same composite
+ * component.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCompositeNestedCC7() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testCompositeNestedCC7.xhtml");
+
+ UIComponent panelGroup1 = root.findComponent("testGroup1");
+ Assert.assertNotNull(panelGroup1);
+
+ StringWriter sw = new StringWriter();
+ MockResponseWriter mrw = new MockResponseWriter(sw);
+ facesContext.setResponseWriter(mrw);
+
+ root.encodeAll(facesContext);
+ sw.flush();
+ Assert.assertTrue(sw.toString().contains("ALFA"));
+ Assert.assertTrue(sw.toString().contains("BETA"));
+ Assert.assertTrue(sw.toString().contains("GAMMA"));
+ Assert.assertTrue(sw.toString().contains("OMEGA"));
+ }
+
+ /**
+ * Try what happen when a dynamic ui:include is used inside a composite
+ * component and that include contains a reference to the same composite
+ * component.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCompositeNestedCC7Cache() throws Exception
+ {
+ servletContext.addInitParameter(FaceletCompositionContextImpl.INIT_PARAM_CACHE_EL_EXPRESSIONS,
+ ELExpressionCacheMode.always.toString()); //allowCset
+
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testCompositeNestedCC7.xhtml");
+
+ UIComponent panelGroup1 = root.findComponent("testGroup1");
+ Assert.assertNotNull(panelGroup1);
+
+ StringWriter sw = new StringWriter();
+ MockResponseWriter mrw = new MockResponseWriter(sw);
+ facesContext.setResponseWriter(mrw);
+
+ root.encodeAll(facesContext);
+ sw.flush();
+ Assert.assertTrue(sw.toString().contains("ALFA"));
+ Assert.assertTrue(sw.toString().contains("BETA"));
+ Assert.assertTrue(sw.toString().contains("GAMMA"));
+ Assert.assertTrue(sw.toString().contains("OMEGA"));
+ }
+
+ /**
+ * Try a nested insertChildren with some conditional inclusions.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCompositeNestedCC8() throws Exception
+ {
+ UIViewRoot root = facesContext.getViewRoot();
+ vdl.buildView(facesContext, root, "testCompositeNestedCC8.xhtml");
+
+ UIComponent panelGroup1 = root.findComponent("testGroup1");
+ Assert.assertNotNull(panelGroup1);
+
+ StringWriter sw = new StringWriter();
+ MockResponseWriter mrw = new MockResponseWriter(sw);
+ facesContext.setResponseWriter(mrw);
+
+ root.encodeAll(facesContext);
+ sw.flush();
+ Assert.assertTrue(sw.toString().contains("ALFA"));
+ Assert.assertTrue(sw.toString().contains("BETA"));
+ Assert.assertTrue(sw.toString().contains("GAMMA"));
+ Assert.assertTrue(sw.toString().contains("OMEGA"));
+ }
+
+ /**
+ * Try a nested insertChildren with some conditional inclusions.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testCompositeNestedCC8Cache() throws Exception
+ {
+ servletContext.addInitParameter(FaceletCompositionContextImpl.INIT_PARAM_CACHE_EL_EXPRESSIONS,
+ ELExpressionCacheMode.always.toString());
+
UIViewRoot root = facesContext.getViewRoot();
- vdl.buildView(facesContext, root, "testCCRefOnScript.xhtml");
+ vdl.buildView(facesContext, root, "testCompositeNestedCC8.xhtml");
UIComponent panelGroup1 = root.findComponent("testGroup1");
Assert.assertNotNull(panelGroup1);
@@ -91,7 +473,9 @@ public class CompositeComponentCCRefTest
root.encodeAll(facesContext);
sw.flush();
- Assert.assertTrue(sw.toString().contains(".myCustomStyle { background:red }"));
- Assert.assertTrue(sw.toString().contains(".myCustomScript = 'myvalue'"));
+ Assert.assertTrue(sw.toString().contains("ALFA"));
+ Assert.assertTrue(sw.toString().contains("BETA"));
+ Assert.assertTrue(sw.toString().contains("GAMMA"));
+ Assert.assertTrue(sw.toString().contains("OMEGA"));
}
-}
+}
\ No newline at end of file
Copied: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC1.xhtml (from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC1.xhtml?p2=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC1.xhtml&p1=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml&r1=1344644&r2=1351625&rev=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml (original)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC1.xhtml Tue Jun 19 09:48:54 2012
@@ -24,12 +24,14 @@
</head>
<body>
<composite:interface>
+ <composite:attribute name="propa"/>
+ <composite:attribute name="propb"/>
+ <composite:attribute name="propc"/>
</composite:interface>
<composite:implementation>
- <ui:insert name="item">
- <composite:insertChildren/>
- </ui:insert>
- <h:outputText value="GAMMA "/>
+ <h:outputText value="#{cc.attrs.propa}"/>
+ <testComposite:compositeNestedCC1_1 propa="#{cc.attrs.propb}"/>
+ <testComposite:compositeNestedCC1_2 propa="#{cc.attrs.propc}" count="1"/>
</composite:implementation>
</body>
</html>
\ No newline at end of file
Copied: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC1_1.xhtml (from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC1_1.xhtml?p2=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC1_1.xhtml&p1=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml&r1=1344644&r2=1351625&rev=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml (original)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC1_1.xhtml Tue Jun 19 09:48:54 2012
@@ -24,12 +24,10 @@
</head>
<body>
<composite:interface>
+ <composite:attribute name="propa"/>
</composite:interface>
<composite:implementation>
- <ui:insert name="item">
- <composite:insertChildren/>
- </ui:insert>
- <h:outputText value="GAMMA "/>
+ <h:outputText value="#{cc.attrs.propa}"/>
</composite:implementation>
</body>
</html>
\ No newline at end of file
Copied: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC1_2.xhtml (from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC1_2.xhtml?p2=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC1_2.xhtml&p1=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml&r1=1344644&r2=1351625&rev=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml (original)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC1_2.xhtml Tue Jun 19 09:48:54 2012
@@ -18,18 +18,23 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:testComposite="http://java.sun.com/jsf/composite/testComposite">
<head>
</head>
<body>
<composite:interface>
+ <composite:attribute name="propa"/>
+ <composite:attribute name="count" type="java.lang.Integer"/>
</composite:interface>
<composite:implementation>
- <ui:insert name="item">
- <composite:insertChildren/>
- </ui:insert>
- <h:outputText value="GAMMA "/>
+ <c:if test="#{cc.attrs.count == 0}">
+ <h:outputText value="#{cc.attrs.propa}"/>
+ </c:if>
+ <c:if test="#{cc.attrs.count > 0}">
+ <testComposite:compositeNestedCC1_2 propa="#{cc.attrs.propa}" count="#{cc.attrs.count - 1}"/>
+ </c:if>
</composite:implementation>
</body>
</html>
\ No newline at end of file
Copied: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC2.xhtml (from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC2.xhtml?p2=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC2.xhtml&p1=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml&r1=1344644&r2=1351625&rev=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml (original)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC2.xhtml Tue Jun 19 09:48:54 2012
@@ -18,18 +18,27 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:testComposite="http://java.sun.com/jsf/composite/testComposite">
<head>
</head>
<body>
<composite:interface>
+ <composite:attribute name="propa"/>
+ <composite:attribute name="propb"/>
+ <composite:attribute name="propc"/>
+ <composite:attribute name="count" type="java.lang.Integer"/>
</composite:interface>
<composite:implementation>
- <ui:insert name="item">
- <composite:insertChildren/>
- </ui:insert>
- <h:outputText value="GAMMA "/>
+ <h:outputText value="#{cc.attrs.propa} "/>
+ <c:if test="#{cc.attrs.count > 0}">
+ <testComposite:compositeNestedCC2
+ propa="#{cc.attrs.propb}"
+ propb="#{cc.attrs.propc}"
+ propc="#{cc.attrs.propd}"
+ count="#{cc.attrs.count - 1}"/>
+ </c:if>
</composite:implementation>
</body>
</html>
\ No newline at end of file
Copied: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC3.xhtml (from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC3.xhtml?p2=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC3.xhtml&p1=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml&r1=1344644&r2=1351625&rev=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml (original)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC3.xhtml Tue Jun 19 09:48:54 2012
@@ -18,18 +18,21 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:testComposite="http://java.sun.com/jsf/composite/testComposite">
<head>
</head>
<body>
<composite:interface>
+ <composite:attribute name="content"/>
+ <composite:attribute name="propa"/>
</composite:interface>
<composite:implementation>
- <ui:insert name="item">
- <composite:insertChildren/>
- </ui:insert>
- <h:outputText value="GAMMA "/>
+ <h:outputText value="ALFA "/>
+ <ui:include src="#{cc.attrs.content}">
+ <ui:param name="param1" value="#{cc.attrs.propa}" />
+ </ui:include>
</composite:implementation>
</body>
</html>
\ No newline at end of file
Copied: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC4.xhtml (from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC4.xhtml?p2=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC4.xhtml&p1=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml&r1=1344644&r2=1351625&rev=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml (original)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC4.xhtml Tue Jun 19 09:48:54 2012
@@ -18,18 +18,28 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:testComposite="http://java.sun.com/jsf/composite/testComposite">
<head>
</head>
<body>
<composite:interface>
+ <composite:attribute name="propa"/>
+ <composite:attribute name="propb"/>
+ <composite:attribute name="count"/>
</composite:interface>
<composite:implementation>
- <ui:insert name="item">
- <composite:insertChildren/>
- </ui:insert>
- <h:outputText value="GAMMA "/>
+ <c:if test="#{cc.attrs.count > 0}">
+ <testComposite:compositeNestedCC4 propa="#{cc.attrs.propb}" count="#{cc.attrs.count - 1}">
+ <h:outputText value="#{cc.attrs.propa} "/>
+ <composite:insertChildren/>
+ </testComposite:compositeNestedCC4>
+ </c:if>
+ <c:if test="#{cc.attrs.count == 0}">
+ <h:outputText value="#{cc.attrs.propa} "/>
+ <composite:insertChildren/>
+ </c:if>
</composite:implementation>
</body>
</html>
\ No newline at end of file
Copied: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC5.xhtml (from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC5.xhtml?p2=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC5.xhtml&p1=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml&r1=1344644&r2=1351625&rev=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml (original)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC5.xhtml Tue Jun 19 09:48:54 2012
@@ -24,12 +24,14 @@
</head>
<body>
<composite:interface>
+ <composite:attribute name="propa"/>
+ <composite:attribute name="propb"/>
+ <composite:attribute name="propc"/>
</composite:interface>
<composite:implementation>
- <ui:insert name="item">
- <composite:insertChildren/>
- </ui:insert>
- <h:outputText value="GAMMA "/>
+ #{cc.attrs.propa}
+ <testComposite:compositeNestedCC5_1 propa="#{cc.attrs.propb}"/>
+ <testComposite:compositeNestedCC5_2 propa="#{cc.attrs.propc}" count="1"/>
</composite:implementation>
</body>
</html>
\ No newline at end of file
Copied: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC5_1.xhtml (from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC5_1.xhtml?p2=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC5_1.xhtml&p1=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml&r1=1344644&r2=1351625&rev=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml (original)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC5_1.xhtml Tue Jun 19 09:48:54 2012
@@ -24,12 +24,10 @@
</head>
<body>
<composite:interface>
+ <composite:attribute name="propa"/>
</composite:interface>
<composite:implementation>
- <ui:insert name="item">
- <composite:insertChildren/>
- </ui:insert>
- <h:outputText value="GAMMA "/>
+ #{cc.attrs.propa}"
</composite:implementation>
</body>
</html>
\ No newline at end of file
Copied: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC5_2.xhtml (from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC5_2.xhtml?p2=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC5_2.xhtml&p1=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml&r1=1344644&r2=1351625&rev=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml (original)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC5_2.xhtml Tue Jun 19 09:48:54 2012
@@ -18,18 +18,23 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:testComposite="http://java.sun.com/jsf/composite/testComposite">
<head>
</head>
<body>
<composite:interface>
+ <composite:attribute name="propa"/>
+ <composite:attribute name="count" type="java.lang.Integer"/>
</composite:interface>
<composite:implementation>
- <ui:insert name="item">
- <composite:insertChildren/>
- </ui:insert>
- <h:outputText value="GAMMA "/>
+ <c:if test="#{cc.attrs.count == 0}">
+ #{cc.attrs.propa}
+ </c:if>
+ <c:if test="#{cc.attrs.count > 0}">
+ <testComposite:compositeNestedCC5_2 propa="#{cc.attrs.propa}" count="#{cc.attrs.count - 1}"/>
+ </c:if>
</composite:implementation>
</body>
</html>
\ No newline at end of file
Copied: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC6.xhtml (from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC6.xhtml?p2=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC6.xhtml&p1=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml&r1=1344644&r2=1351625&rev=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml (original)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC6.xhtml Tue Jun 19 09:48:54 2012
@@ -18,18 +18,27 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:testComposite="http://java.sun.com/jsf/composite/testComposite">
<head>
</head>
<body>
<composite:interface>
+ <composite:attribute name="propa"/>
+ <composite:attribute name="propb"/>
+ <composite:attribute name="propc"/>
+ <composite:attribute name="count" type="java.lang.Integer"/>
</composite:interface>
<composite:implementation>
- <ui:insert name="item">
- <composite:insertChildren/>
- </ui:insert>
- <h:outputText value="GAMMA "/>
+ #{cc.attrs.propa}
+ <c:if test="#{cc.attrs.count > 0}">
+ <testComposite:compositeNestedCC6
+ propa="#{cc.attrs.propb}"
+ propb="#{cc.attrs.propc}"
+ propc="#{cc.attrs.propd}"
+ count="#{cc.attrs.count - 1}"/>
+ </c:if>
</composite:implementation>
</body>
</html>
\ No newline at end of file
Copied: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC7.xhtml (from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC7.xhtml?p2=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC7.xhtml&p1=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml&r1=1344644&r2=1351625&rev=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml (original)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC7.xhtml Tue Jun 19 09:48:54 2012
@@ -18,18 +18,21 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:testComposite="http://java.sun.com/jsf/composite/testComposite">
<head>
</head>
<body>
<composite:interface>
+ <composite:attribute name="content"/>
+ <composite:attribute name="propa"/>
</composite:interface>
<composite:implementation>
- <ui:insert name="item">
- <composite:insertChildren/>
- </ui:insert>
- <h:outputText value="GAMMA "/>
+ ALFA
+ <ui:include src="#{cc.attrs.content}">
+ <ui:param name="param1" value="#{cc.attrs.propa}" />
+ </ui:include>
</composite:implementation>
</body>
</html>
\ No newline at end of file
Copied: myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC8.xhtml (from r1344644, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC8.xhtml?p2=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC8.xhtml&p1=myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml&r1=1344644&r2=1351625&rev=1351625&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeInsertChildren6.xhtml (original)
+++ myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/compositeNestedCC8.xhtml Tue Jun 19 09:48:54 2012
@@ -18,18 +18,28 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:testComposite="http://java.sun.com/jsf/composite/testComposite">
<head>
</head>
<body>
<composite:interface>
+ <composite:attribute name="propa"/>
+ <composite:attribute name="propb"/>
+ <composite:attribute name="count"/>
</composite:interface>
<composite:implementation>
- <ui:insert name="item">
- <composite:insertChildren/>
- </ui:insert>
- <h:outputText value="GAMMA "/>
+ <c:if test="#{cc.attrs.count > 0}">
+ <testComposite:compositeNestedCC8 propa="#{cc.attrs.propb}" count="#{cc.attrs.count - 1}">
+ #{cc.attrs.propa}
+ <composite:insertChildren/>
+ </testComposite:compositeNestedCC8>
+ </c:if>
+ <c:if test="#{cc.attrs.count == 0}">
+ #{cc.attrs.propa}
+ <composite:insertChildren/>
+ </c:if>
</composite:implementation>
</body>
</html>
\ No newline at end of file