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 2010/06/06 04:13:21 UTC

svn commit: r951803 - in /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets: ./ tag/composite/

Author: lu4242
Date: Sun Jun  6 02:13:20 2010
New Revision: 951803

URL: http://svn.apache.org/viewvc?rev=951803&view=rev
Log:
MYFACES-2638 Fix PostAddToViewEvent and PreRemoveFromViewEvent publishing conditions (use composite component stack to retrieve the current one on metadata generation and move the code from ImplementationHandler to CompositeComponentDefinitionTagHandler)

Modified:
    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/tag/composite/AttachedObjectTargetHandler.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/AttributeHandler.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/ClientBehaviorHandler.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentDefinitionTagHandler.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/ImplementationHandler.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InsertChildrenHandler.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InsertFacetHandler.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InterfaceHandler.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/RenderFacetHandler.java

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=951803&r1=951802&r2=951803&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 Sun Jun  6 02:13:20 2010
@@ -500,14 +500,14 @@ public class FaceletViewDeclarationLangu
             
             // Create a temporal tree where all components will be put, but we are only
             // interested in metadata.
-            UINamingContainer parent = (UINamingContainer) context.getApplication().createComponent(UINamingContainer.COMPONENT_TYPE);
+            UINamingContainer compositeComponentBase = (UINamingContainer) context.getApplication().createComponent(UINamingContainer.COMPONENT_TYPE);
             
             // Fill the component resource key, because this information should be available
             // on metadata to recognize which is the component used as composite component base.
             // Since this method is called from Application.createComponent(FacesContext,Resource),
             // and in that specific method this key is updated, this is the best option we
             // have for recognize it (also this key is used by UIComponent.isCompositeComponent)
-            parent.getAttributes().put(Resource.COMPONENT_RESOURCE_KEY, componentResource);
+            compositeComponentBase.getAttributes().put(Resource.COMPONENT_RESOURCE_KEY, componentResource);
             
             // According to UserTagHandler, in this point we need to wrap the facelet
             // VariableMapper, so local changes are applied on "page context", but
@@ -518,14 +518,19 @@ public class FaceletViewDeclarationLangu
             try
             {
                 faceletContext.setVariableMapper(new VariableMapperWrapper(orig));
-                compositeComponentFacelet.apply(context, parent);
+                
+                compositeComponentBase.pushComponentToEL(context, compositeComponentBase);
+                
+                compositeComponentFacelet.apply(context, compositeComponentBase);
+                
+                compositeComponentBase.popComponentFromEL(context);
             }
             finally
             {
                 faceletContext.setVariableMapper(orig);
             }
             
-            beanInfo = (BeanInfo) parent.getAttributes().get(UIComponent.BEANINFO_KEY);
+            beanInfo = (BeanInfo) compositeComponentBase.getAttributes().get(UIComponent.BEANINFO_KEY);
         }
         catch(IOException e)
         {

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/AttachedObjectTargetHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/AttachedObjectTargetHandler.java?rev=951803&r1=951802&r2=951803&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/AttachedObjectTargetHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/AttachedObjectTargetHandler.java Sun Jun  6 02:13:20 2010
@@ -34,6 +34,7 @@ import javax.faces.view.facelets.TagHand
 
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletAttribute;
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag;
+import org.apache.myfaces.view.facelets.FaceletCompositionContext;
 
 /**
  * composite:actionSource, composite:valueHolder and composite:editableValueHolder
@@ -98,8 +99,10 @@ public abstract class AttachedObjectTarg
     public void apply(FaceletContext ctx, UIComponent parent)
             throws IOException
     {
+        UIComponent compositeBaseParent = FaceletCompositionContext.getCurrentInstance(ctx).getCompositeComponentFromStack();
+
         CompositeComponentBeanInfo beanInfo = 
-            (CompositeComponentBeanInfo) parent.getAttributes()
+            (CompositeComponentBeanInfo) compositeBaseParent.getAttributes()
             .get(UIComponent.BEANINFO_KEY);
         
         if (beanInfo == null)

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/AttributeHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/AttributeHandler.java?rev=951803&r1=951802&r2=951803&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/AttributeHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/AttributeHandler.java Sun Jun  6 02:13:20 2010
@@ -34,6 +34,7 @@ import javax.faces.view.facelets.TagHand
 
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletAttribute;
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag;
+import org.apache.myfaces.view.facelets.FaceletCompositionContext;
 
 /**
  * @author Leonardo Uribe (latest modification by $Author$)
@@ -168,8 +169,10 @@ public class AttributeHandler extends Ta
     public void apply(FaceletContext ctx, UIComponent parent)
             throws IOException
     {
+        UIComponent compositeBaseParent = FaceletCompositionContext.getCurrentInstance(ctx).getCompositeComponentFromStack();
+
         CompositeComponentBeanInfo beanInfo = 
-            (CompositeComponentBeanInfo) parent.getAttributes()
+            (CompositeComponentBeanInfo) compositeBaseParent.getAttributes()
             .get(UIComponent.BEANINFO_KEY);
         
         if (beanInfo == null)
@@ -187,13 +190,13 @@ public class AttributeHandler extends Ta
         {
             if (_propertyDescriptor == null)
             {
-                _propertyDescriptor = _createPropertyDescriptor(ctx, parent);
+                _propertyDescriptor = _createPropertyDescriptor(ctx, compositeBaseParent);
             }
             attributeList.add(_propertyDescriptor);
         }
         else
         {
-            PropertyDescriptor attribute = _createPropertyDescriptor(ctx, parent);
+            PropertyDescriptor attribute = _createPropertyDescriptor(ctx, compositeBaseParent);
             attributeList.add(attribute);
         }
         

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/ClientBehaviorHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/ClientBehaviorHandler.java?rev=951803&r1=951802&r2=951803&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/ClientBehaviorHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/ClientBehaviorHandler.java Sun Jun  6 02:13:20 2010
@@ -34,6 +34,7 @@ import javax.faces.view.facelets.TagHand
 
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletAttribute;
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag;
+import org.apache.myfaces.view.facelets.FaceletCompositionContext;
 
 /**
  * @author Leonardo Uribe (latest modification by $Author: lu4242 $)
@@ -125,8 +126,10 @@ public class ClientBehaviorHandler exten
     public void apply(FaceletContext ctx, UIComponent parent)
             throws IOException
     {
+        UIComponent compositeBaseParent = FaceletCompositionContext.getCurrentInstance(ctx).getCompositeComponentFromStack();
+
         CompositeComponentBeanInfo beanInfo = 
-            (CompositeComponentBeanInfo) parent.getAttributes()
+            (CompositeComponentBeanInfo) compositeBaseParent.getAttributes()
             .get(UIComponent.BEANINFO_KEY);
         
         if (beanInfo == null)

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=951803&r1=951802&r2=951803&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 Sun Jun  6 02:13:20 2010
@@ -23,12 +23,12 @@ import java.beans.BeanInfo;
 import java.io.IOException;
 import java.util.Collection;
 
-import javax.faces.application.Resource;
 import javax.faces.component.UIComponent;
 import javax.faces.view.facelets.FaceletContext;
 import javax.faces.view.facelets.FaceletHandler;
 
 import org.apache.myfaces.view.facelets.AbstractFaceletContext;
+import org.apache.myfaces.view.facelets.FaceletCompositionContext;
 import org.apache.myfaces.view.facelets.el.CompositeComponentELUtils;
 import org.apache.myfaces.view.facelets.tag.TagHandlerUtils;
 
@@ -45,7 +45,8 @@ import org.apache.myfaces.view.facelets.
  * <ul>
  * <li>Cache the BeanInfo instance for a composite component</li>
  * <li>Set a Location object to resolve #{cc} correctly</li>
- * <ul>
+ * <li>Push the current composite component on FaceletCompositionContext stack</li>
+ * </ul>
  * @author Leonardo Uribe (latest modification by $Author: lu4242 $)
  * @version $Revision: 945454 $ $Date: 2010-05-17 20:40:21 -0500 (Lun, 17 May 2010) $
  */
@@ -101,85 +102,93 @@ public final class CompositeComponentDef
     public void apply(FaceletContext ctx, UIComponent parent)
             throws IOException
     {
+        FaceletCompositionContext mctx = FaceletCompositionContext.getCurrentInstance(ctx);
+        AbstractFaceletContext actx = (AbstractFaceletContext)ctx;
+        UIComponent compositeBaseParent = actx.isBuildingCompositeComponentMetadata() ? parent : parent.getParent();
+        
         // Store the current Location on the parent (the location is needed
         // to resolve the related composite component via #{cc} properly).
         if (_interfaceHandler != null)
         {
-            UIComponent compositeBaseParent = _getCompositeBaseParent(parent);
-            
             compositeBaseParent.getAttributes()
                 .put(CompositeComponentELUtils.LOCATION_KEY, this._interfaceHandler.getLocation());
         }
         else if (_implementationHandler != null)
         {
-            UIComponent compositeBaseParent = _getCompositeBaseParent(parent);
-            
             compositeBaseParent.getAttributes()
                 .put(CompositeComponentELUtils.LOCATION_KEY, this._implementationHandler.getLocation());
         }
         
         // Only apply if we are building composite component metadata,
         // in other words we are calling ViewDeclarationLanguage.getComponentMetadata
-        if ( ((AbstractFaceletContext)ctx).isBuildingCompositeComponentMetadata() )
+        if ( actx.isBuildingCompositeComponentMetadata() )
         {
             CompositeComponentBeanInfo tempBeanInfo = 
-                (CompositeComponentBeanInfo) parent.getAttributes()
+                (CompositeComponentBeanInfo) compositeBaseParent.getAttributes()
                 .get(UIComponent.BEANINFO_KEY);
             
             if (tempBeanInfo == null)
             {
-                UIComponent compositeBaseParent = _getCompositeBaseParent(parent);
-
                 if (_cacheable)
                 {
                     if (_cachedBeanInfo == null)
                     {
                         _cachedBeanInfo = _createCompositeComponentMetadata(ctx, compositeBaseParent);
-                        parent.getAttributes().put(
+                        compositeBaseParent.getAttributes().put(
                                 UIComponent.BEANINFO_KEY, _cachedBeanInfo);
-                        _nextHandler.apply(ctx, compositeBaseParent);
+                        
+                        try
+                        {
+                            mctx.pushCompositeComponentToStack(compositeBaseParent);
+
+                            _nextHandler.apply(ctx, parent);
+                        }
+                        finally
+                        {
+                            mctx.popCompositeComponentToStack();
+                        }
                     }
                     else
                     {
                         // Put the cached instance, but in that case it is not necessary to call
                         // nextHandler
-                        parent.getAttributes().put(
+                        compositeBaseParent.getAttributes().put(
                                 UIComponent.BEANINFO_KEY, _cachedBeanInfo);
                     }
                 }
                 else
                 {
                     tempBeanInfo = _createCompositeComponentMetadata(ctx, compositeBaseParent);
-                    parent.getAttributes().put(
+                    compositeBaseParent.getAttributes().put(
                             UIComponent.BEANINFO_KEY, tempBeanInfo);
-                    _nextHandler.apply(ctx, compositeBaseParent);
+                    
+                    try
+                    {
+                        mctx.pushCompositeComponentToStack(compositeBaseParent);
+                    
+                        _nextHandler.apply(ctx, parent);
+                        
+                    }
+                    finally
+                    {
+                        mctx.popCompositeComponentToStack();
+                    }
                 }
             }
         }
         else
         {
-            _nextHandler.apply(ctx, parent);
-        }
-    }
-    
-    /**
-     * Get the base component used temporally to hold metadata
-     * information generated by this handler. 
-     * 
-     * @param component
-     * @return
-     */
-    private UIComponent _getCompositeBaseParent(UIComponent component)
-    {
-        if (!component.getAttributes().containsKey(Resource.COMPONENT_RESOURCE_KEY))
-        {
-            UIComponent parent = component.getParent();
-            if (parent != null)
+            try
+            {
+                mctx.pushCompositeComponentToStack(compositeBaseParent);
+            
+                _nextHandler.apply(ctx, parent);
+            }
+            finally
             {
-                return _getCompositeBaseParent(parent);
+                mctx.popCompositeComponentToStack();
             }
         }
-        return component;
     }
     
     private CompositeComponentBeanInfo _createCompositeComponentMetadata(

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/ImplementationHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/ImplementationHandler.java?rev=951803&r1=951802&r2=951803&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/ImplementationHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/ImplementationHandler.java Sun Jun  6 02:13:20 2010
@@ -58,25 +58,20 @@ public class ImplementationHandler exten
     public void apply(FaceletContext ctx, UIComponent parent)
             throws IOException
     {
-        FaceletCompositionContext mctx = FaceletCompositionContext.getCurrentInstance(ctx); 
         if (!((AbstractFaceletContext)ctx).isBuildingCompositeComponentMetadata())
         {
             // If this tag is found in a facelet, the compiler has trimmed all
             // tags outside this one excluding composite:interface, so "parent"
             // is a component used as value for the facet key
             // UIComponent.COMPOSITE_FACET_NAME in a composite component. 
-            
-            mctx.pushCompositeComponentToStack(parent.getParent());
-            
             nextHandler.apply(ctx, parent);
-            
-            mctx.popCompositeComponentToStack();
         }
         else
         {
+            UIComponent compositeBaseParent = FaceletCompositionContext.getCurrentInstance(ctx).getCompositeComponentFromStack();
             // Register the facet UIComponent.COMPOSITE_FACET_NAME
             CompositeComponentBeanInfo beanInfo = 
-                (CompositeComponentBeanInfo) parent.getAttributes()
+                (CompositeComponentBeanInfo) compositeBaseParent.getAttributes()
                 .get(UIComponent.BEANINFO_KEY);
             
             if (beanInfo == null)

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InsertChildrenHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InsertChildrenHandler.java?rev=951803&r1=951802&r2=951803&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InsertChildrenHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InsertChildrenHandler.java Sun Jun  6 02:13:20 2010
@@ -54,10 +54,14 @@ public class InsertChildrenHandler exten
     public void apply(FaceletContext ctx, UIComponent parent)
             throws IOException
     {
-        if (((AbstractFaceletContext)ctx).isBuildingCompositeComponentMetadata())
+        UIComponent parentCompositeComponent = FaceletCompositionContext.getCurrentInstance(ctx).getCompositeComponentFromStack();
+        
+        AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
+
+        if (actx.isBuildingCompositeComponentMetadata())
         {
             CompositeComponentBeanInfo beanInfo = 
-                (CompositeComponentBeanInfo) parent.getAttributes()
+                (CompositeComponentBeanInfo) parentCompositeComponent.getAttributes()
                 .get(UIComponent.BEANINFO_KEY);
             
             if (beanInfo == null)
@@ -73,10 +77,6 @@ public class InsertChildrenHandler exten
         }
         else
         {
-            UIComponent parentCompositeComponent = FaceletCompositionContext.getCurrentInstance(ctx).getCompositeComponentFromStack();
-            
-            AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
-            
             actx.includeCompositeComponentDefinition(parent, null);
             
             parentCompositeComponent.getAttributes().put(INSERT_CHILDREN_USED, Boolean.TRUE);

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InsertFacetHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InsertFacetHandler.java?rev=951803&r1=951802&r2=951803&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InsertFacetHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InsertFacetHandler.java Sun Jun  6 02:13:20 2010
@@ -90,8 +90,11 @@ public class InsertFacetHandler extends 
         if (((AbstractFaceletContext)ctx).isBuildingCompositeComponentMetadata())
         {
             String facetName = _name.getValue(ctx);
+            
+            UIComponent compositeBaseParent = FaceletCompositionContext.getCurrentInstance(ctx).getCompositeComponentFromStack();
+            
             CompositeComponentBeanInfo beanInfo = 
-                (CompositeComponentBeanInfo) parent.getAttributes()
+                (CompositeComponentBeanInfo) compositeBaseParent.getAttributes()
                 .get(UIComponent.BEANINFO_KEY);
             
             if (beanInfo == null)

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InterfaceHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InterfaceHandler.java?rev=951803&r1=951802&r2=951803&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InterfaceHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/InterfaceHandler.java Sun Jun  6 02:13:20 2010
@@ -35,6 +35,7 @@ import javax.faces.view.facelets.TagHand
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletAttribute;
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag;
 import org.apache.myfaces.view.facelets.AbstractFaceletContext;
+import org.apache.myfaces.view.facelets.FaceletCompositionContext;
 import org.apache.myfaces.view.facelets.tag.TagHandlerUtils;
 
 /**
@@ -157,10 +158,10 @@ public class InterfaceHandler extends Ta
         // in other words we are calling ViewDeclarationLanguage.getComponentMetadata
         if ( ((AbstractFaceletContext)ctx).isBuildingCompositeComponentMetadata() )
         {
-            UIComponent compositeBaseParent = _getCompositeBaseParent(parent);
+            UIComponent compositeBaseParent = FaceletCompositionContext.getCurrentInstance(ctx).getCompositeComponentFromStack();
             
             CompositeComponentBeanInfo beanInfo = 
-                (CompositeComponentBeanInfo) parent.getAttributes()
+                (CompositeComponentBeanInfo) compositeBaseParent.getAttributes()
                 .get(UIComponent.BEANINFO_KEY);
             
             if (beanInfo == null)
@@ -203,30 +204,10 @@ public class InterfaceHandler extends Ta
                 descriptor.setShortDescription(_shortDescription.getValue(ctx));
             }
             
-            nextHandler.apply(ctx, compositeBaseParent);
+            nextHandler.apply(ctx, parent);
         }
     }
     
-    /**
-     * Get the base component used temporally to hold metadata
-     * information generated by this handler. 
-     * 
-     * @param component
-     * @return
-     */
-    private UIComponent _getCompositeBaseParent(UIComponent component)
-    {
-        if (!component.getAttributes().containsKey(Resource.COMPONENT_RESOURCE_KEY))
-        {
-            UIComponent parent = component.getParent();
-            if (parent != null)
-            {
-                return _getCompositeBaseParent(parent);
-            }
-        }
-        return component;
-    }
-
     public boolean isCacheable()
     {
         return _cacheable;

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/RenderFacetHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/RenderFacetHandler.java?rev=951803&r1=951802&r2=951803&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/RenderFacetHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/RenderFacetHandler.java Sun Jun  6 02:13:20 2010
@@ -35,6 +35,7 @@ import javax.faces.view.facelets.TagExce
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletAttribute;
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletTag;
 import org.apache.myfaces.view.facelets.AbstractFaceletContext;
+import org.apache.myfaces.view.facelets.FaceletCompositionContext;
 
 /**
  * Render the facet defined on the composite component body to the current location
@@ -82,8 +83,11 @@ public class RenderFacetHandler extends 
         if (((AbstractFaceletContext)ctx).isBuildingCompositeComponentMetadata())
         {
             String facetName = _name.getValue(ctx);
+            
+            UIComponent compositeBaseParent = FaceletCompositionContext.getCurrentInstance(ctx).getCompositeComponentFromStack();
+            
             CompositeComponentBeanInfo beanInfo = 
-                (CompositeComponentBeanInfo) parent.getAttributes()
+                (CompositeComponentBeanInfo) compositeBaseParent.getAttributes()
                 .get(UIComponent.BEANINFO_KEY);
             
             if (beanInfo == null)
@@ -119,7 +123,7 @@ public class RenderFacetHandler extends 
     {
         if (!((AbstractFaceletContext)ctx).isBuildingCompositeComponentMetadata())
         {
-            UIComponent parentCompositeComponent = UIComponent.getCurrentCompositeComponent(ctx.getFacesContext());
+            UIComponent parentCompositeComponent = FaceletCompositionContext.getCurrentInstance(ctx).getCompositeComponentFromStack();
             
             String facetName = _name.getValue(ctx);