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/11/23 03:02:19 UTC

svn commit: r1037967 - in /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf: ComponentTagHandlerDelegate.java core/AjaxHandler.java

Author: lu4242
Date: Tue Nov 23 02:02:19 2010
New Revision: 1037967

URL: http://svn.apache.org/viewvc?rev=1037967&view=rev
Log:
MYFACES-2980 f:ajax wrapped around component(s) does not work as expected

Modified:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/AjaxHandler.java

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java?rev=1037967&r1=1037966&r2=1037967&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java Tue Nov 23 02:02:19 2010
@@ -192,7 +192,7 @@ public class ComponentTagHandlerDelegate
                 
         // grab our component
         UIComponent c = null;
-        boolean componentFoundInserted = false;
+        //boolean componentFoundInserted = false;
         // MYFACES-2924 This optimization does not work as expected when component bindings are used.
         //if (mctx.isRefreshingTransientBuild())
         //{
@@ -329,8 +329,8 @@ public class ComponentTagHandlerDelegate
         {
             mctx.finalizeForDeletion(c);
 
-            if (!componentFoundInserted)
-            {
+            //if (!componentFoundInserted)
+            //{
                 if (mctx.isRefreshingTransientBuild())
                 {
                     facesContext.setProcessingEvents(false); 
@@ -347,7 +347,7 @@ public class ComponentTagHandlerDelegate
                 {
                     facesContext.setProcessingEvents(oldProcessingEvents);
                 }
-            }
+            //}
         }
         
         /*
@@ -390,29 +390,32 @@ public class ComponentTagHandlerDelegate
         }
         */
 
-        if (c instanceof ClientBehaviorHolder && !UIComponent.isCompositeComponent(c))
+        if (!componentFound)
         {
-            Iterator<AjaxHandler> it = ((AbstractFaceletContext) ctx).getAjaxHandlers();
-            if (it != null)
+            if (c instanceof ClientBehaviorHolder && !UIComponent.isCompositeComponent(c))
             {
-                while(it.hasNext())
+                Iterator<AjaxHandler> it = ((AbstractFaceletContext) ctx).getAjaxHandlers();
+                if (it != null)
                 {
-                    it.next().applyAttachedObject(facesContext, c);
+                    while(it.hasNext())
+                    {
+                        it.next().applyAttachedObject(facesContext, c);
+                    }
                 }
             }
-        }
-        
-        if (c instanceof EditableValueHolder)
-        {
-            // add default validators here, because this feature 
-            // is only available in facelets (see MYFACES-2362 for details)
-            addDefaultValidators(mctx, facesContext, (EditableValueHolder) c);
+            
+            if (c instanceof EditableValueHolder)
+            {
+                // add default validators here, because this feature 
+                // is only available in facelets (see MYFACES-2362 for details)
+                addDefaultValidators(mctx, facesContext, (EditableValueHolder) c);
+            }
         }
         
         _delegate.onComponentPopulated(ctx, c, parent);
 
-        if (!componentFoundInserted)
-        {
+        //if (!componentFoundInserted)
+        //{
             // add to the tree afterwards
             // this allows children to determine if it's
             // been part of the tree or not yet
@@ -432,7 +435,7 @@ public class ComponentTagHandlerDelegate
             {
                 facesContext.setProcessingEvents(oldProcessingEvents);
             }
-        }
+        //}
         /*
         else
         {

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/AjaxHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/AjaxHandler.java?rev=1037967&r1=1037966&r2=1037967&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/AjaxHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/AjaxHandler.java Tue Nov 23 02:02:19 2010
@@ -184,6 +184,16 @@ public class AjaxHandler extends TagHand
         //Apply only if we are creating a new component
         if (!ComponentHandler.isNew(parent))
         {
+            if (_wrapMode)
+            {
+                AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
+                // In this case it will be only applied to components inserted by 
+                // c:if or related tags, in other cases, ComponentTagHandlerDelegate should
+                // not reapply ajax tag.
+                actx.pushAjaxHandlerToStack(this);
+                nextHandler.apply(ctx, parent);
+                actx.popAjaxHandlerToStack();
+            }
             return;
         }
         if (_wrapMode)