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/05/21 03:21:41 UTC

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

Author: lu4242
Date: Fri May 21 01:21:41 2010
New Revision: 946845

URL: http://svn.apache.org/viewvc?rev=946845&view=rev
Log:
Do not try to find component if view is not being refreshed, because it is a waste of time.

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

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/UIInstructionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/UIInstructionHandler.java?rev=946845&r1=946844&r2=946845&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/UIInstructionHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/UIInstructionHandler.java Fri May 21 01:21:41 2010
@@ -30,7 +30,6 @@ import javax.faces.component.UniqueIdVen
 import javax.faces.view.facelets.FaceletContext;
 import javax.faces.view.facelets.FaceletException;
 
-import org.apache.myfaces.view.facelets.AbstractFaceletContext;
 import org.apache.myfaces.view.facelets.FaceletCompositionContext;
 import org.apache.myfaces.view.facelets.el.ELText;
 import org.apache.myfaces.view.facelets.tag.composite.InsertChildrenHandler;
@@ -90,43 +89,47 @@ final class UIInstructionHandler extends
             String id = ctx.generateUniqueId(this.id);
 
             // grab our component
-            UIComponent c = ComponentSupport.findChildByTagId(parent, id);
-            boolean componentFoundInserted = false;
+            UIComponent c = null;
             FaceletCompositionContext mctx= FaceletCompositionContext.getCurrentInstance(ctx);
-            if (c == null && mctx.isRefreshTransientBuildOnPSS() && 
-                    mctx.isRefreshingTransientBuild() && UIComponent.isCompositeComponent(parent))
+            boolean componentFoundInserted = false;
+            if (mctx.isRefreshingTransientBuild())
             {
-                String facetName = this.getFacetName(ctx, parent);
-                if (facetName == null)
+                c = ComponentSupport.findChildByTagId(parent, id);
+                if (c == null && mctx.isRefreshTransientBuildOnPSS() && 
+                        mctx.isRefreshingTransientBuild() && UIComponent.isCompositeComponent(parent))
                 {
-                    String targetClientId = (String) parent.getAttributes().get(InsertChildrenHandler.INSERT_CHILDREN_TARGET_ID);
-                    if (targetClientId != null)
+                    String facetName = this.getFacetName(ctx, parent);
+                    if (facetName == null)
                     {
-                        UIComponent targetComponent = parent.findComponent(targetClientId.substring(parent.getClientId().length()+1));
-                        if (targetComponent != null)
+                        String targetClientId = (String) parent.getAttributes().get(InsertChildrenHandler.INSERT_CHILDREN_TARGET_ID);
+                        if (targetClientId != null)
                         {
-                            c = ComponentSupport.findChildByTagId(targetComponent, id);
+                            UIComponent targetComponent = parent.findComponent(targetClientId.substring(parent.getClientId().length()+1));
+                            if (targetComponent != null)
+                            {
+                                c = ComponentSupport.findChildByTagId(targetComponent, id);
+                            }
+                        }
+                        if (c != null)
+                        {
+                            c.getAttributes().put(InsertChildrenHandler.USES_INSERT_CHILDREN, Boolean.TRUE);
+                            componentFoundInserted = true;
                         }
                     }
-                    if (c != null)
-                    {
-                        c.getAttributes().put(InsertChildrenHandler.USES_INSERT_CHILDREN, Boolean.TRUE);
-                        componentFoundInserted = true;
-                    }
-                }
-                else
-                {
-                    String targetClientId = (String) parent.getAttributes().get(InsertFacetHandler.INSERT_FACET_TARGET_ID+facetName);
-                    if (targetClientId != null)
+                    else
                     {
-                        UIComponent targetComponent = parent.findComponent(targetClientId.substring(parent.getClientId().length()+1));
-                        if (targetComponent != null)
+                        String targetClientId = (String) parent.getAttributes().get(InsertFacetHandler.INSERT_FACET_TARGET_ID+facetName);
+                        if (targetClientId != null)
                         {
-                            c = ComponentSupport.findChildByTagId(targetComponent, id);
-                            if (c != null)
+                            UIComponent targetComponent = parent.findComponent(targetClientId.substring(parent.getClientId().length()+1));
+                            if (targetComponent != null)
                             {
-                                c.getAttributes().put(InsertFacetHandler.USES_INSERT_FACET, Boolean.TRUE);
-                                componentFoundInserted = true;
+                                c = ComponentSupport.findChildByTagId(targetComponent, id);
+                                if (c != null)
+                                {
+                                    c.getAttributes().put(InsertFacetHandler.USES_INSERT_FACET, Boolean.TRUE);
+                                    componentFoundInserted = true;
+                                }
                             }
                         }
                     }

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=946845&r1=946844&r2=946845&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 Fri May 21 01:21:41 2010
@@ -135,51 +135,53 @@ public class ComponentTagHandlerDelegate
                 
         // grab our component
         UIComponent c = null;
-        if (_delegate instanceof RelocatableResourceHandler)
-        {
-            c = ((RelocatableResourceHandler)_delegate).findChildByTagId(ctx, parent, id);
-        }
-        else
-        {
-            c = ComponentSupport.findChildByTagId(parent, id); 
-        }
-
-        // Check if the component was relocated using
-        // composite:insertChildren or composite:insertFacet
         boolean componentFoundInserted = false;
-
-        if (c == null && mctx.isRefreshingTransientBuild() && UIComponent.isCompositeComponent(parent))
+        if (mctx.isRefreshingTransientBuild())
         {
-            if (facetName == null)
+            if (_delegate instanceof RelocatableResourceHandler)
+            {
+                c = ((RelocatableResourceHandler)_delegate).findChildByTagId(ctx, parent, id);
+            }
+            else
             {
-                String targetClientId = (String) parent.getAttributes().get(InsertChildrenHandler.INSERT_CHILDREN_TARGET_ID);
-                if (targetClientId != null)
+                c = ComponentSupport.findChildByTagId(parent, id); 
+            }
+    
+            // Check if the component was relocated using
+            // composite:insertChildren or composite:insertFacet
+            if (c == null && UIComponent.isCompositeComponent(parent))
+            {
+                if (facetName == null)
                 {
-                    UIComponent targetComponent = parent.findComponent(targetClientId.substring(parent.getClientId().length()+1));
-                    if (targetComponent != null)
+                    String targetClientId = (String) parent.getAttributes().get(InsertChildrenHandler.INSERT_CHILDREN_TARGET_ID);
+                    if (targetClientId != null)
                     {
-                        c = ComponentSupport.findChildByTagId(targetComponent, id);
+                        UIComponent targetComponent = parent.findComponent(targetClientId.substring(parent.getClientId().length()+1));
+                        if (targetComponent != null)
+                        {
+                            c = ComponentSupport.findChildByTagId(targetComponent, id);
+                        }
+                    }
+                    if (c != null)
+                    {
+                        c.getAttributes().put(InsertChildrenHandler.USES_INSERT_CHILDREN, Boolean.TRUE);
+                        componentFoundInserted = true;
                     }
                 }
-                if (c != null)
-                {
-                    c.getAttributes().put(InsertChildrenHandler.USES_INSERT_CHILDREN, Boolean.TRUE);
-                    componentFoundInserted = true;
-                }
-            }
-            else
-            {
-                String targetClientId = (String) parent.getAttributes().get(InsertFacetHandler.INSERT_FACET_TARGET_ID+facetName);
-                if (targetClientId != null)
+                else
                 {
-                    UIComponent targetComponent = parent.findComponent(targetClientId.substring(parent.getClientId().length()+1));
-                    if (targetComponent != null)
+                    String targetClientId = (String) parent.getAttributes().get(InsertFacetHandler.INSERT_FACET_TARGET_ID+facetName);
+                    if (targetClientId != null)
                     {
-                        c = ComponentSupport.findChildByTagId(targetComponent, id);
-                        if (c != null)
+                        UIComponent targetComponent = parent.findComponent(targetClientId.substring(parent.getClientId().length()+1));
+                        if (targetComponent != null)
                         {
-                            c.getAttributes().put(InsertFacetHandler.USES_INSERT_FACET, Boolean.TRUE);
-                            componentFoundInserted = true;
+                            c = ComponentSupport.findChildByTagId(targetComponent, id);
+                            if (c != null)
+                            {
+                                c.getAttributes().put(InsertFacetHandler.USES_INSERT_FACET, Boolean.TRUE);
+                                componentFoundInserted = true;
+                            }
                         }
                     }
                 }