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/28 17:43:44 UTC

svn commit: r1355051 - /myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java

Author: lu4242
Date: Thu Jun 28 15:43:43 2012
New Revision: 1355051

URL: http://svn.apache.org/viewvc?rev=1355051&view=rev
Log:
small improvement in loop for find components 

Modified:
    myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java

Modified: myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java?rev=1355051&r1=1355050&r2=1355051&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java (original)
+++ myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java Thu Jun 28 15:43:43 2012
@@ -146,10 +146,9 @@ public final class ComponentSupport
         Iterator<UIComponent> itr = null;
         if (parent.getChildCount() > 0)
         {
-            itr = parent.getChildren().iterator();
-            while (itr.hasNext())
+            for (int i = 0, childCount = parent.getChildCount(); i < childCount; i ++)
             {
-                UIComponent child = itr.next();
+                UIComponent child = parent.getChildren().get(i);
                 if (id.equals(child.getAttributes().get(MARK_CREATED)))
                 {
                     return child;
@@ -167,13 +166,27 @@ public final class ComponentSupport
                              .get(FACET_CREATED_UIPANEL_MARKER)))
                 {
                     // only check the children and facets of the panel
-                    Iterator<UIComponent> itr2 = facet.getFacetsAndChildren();
-                    while (itr2.hasNext())
+                    if (facet.getChildCount() > 0)
+                    {
+                        for (int i = 0, childCount = facet.getChildCount(); i < childCount; i ++)
+                        {
+                            UIComponent child = facet.getChildren().get(i);
+                            if (id.equals(child.getAttributes().get(MARK_CREATED)))
+                            {
+                                return child;
+                            }
+                        }
+                    }
+                    if (facet.getFacetCount() > 0)
                     {
-                        UIComponent child = itr2.next();
-                        if (id.equals(child.getAttributes().get(MARK_CREATED)))
+                        Iterator<UIComponent> itr2 = facet.getFacets().values().iterator();
+                        while (itr2.hasNext())
                         {
-                            return child;
+                            UIComponent child = itr2.next();
+                            if (id.equals(child.getAttributes().get(MARK_CREATED)))
+                            {
+                                return child;
+                            }
                         }
                     }
                 }