You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2011/03/22 11:19:09 UTC

svn commit: r1084124 - /myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java

Author: lofwyr
Date: Tue Mar 22 10:19:09 2011
New Revision: 1084124

URL: http://svn.apache.org/viewvc?rev=1084124&view=rev
Log:
TOBAGO-983: ComponentUtils.findDescendant returns the wrong component

Modified:
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java?rev=1084124&r1=1084123&r2=1084124&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java (original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/component/ComponentUtil.java Tue Mar 22 10:19:09 2011
@@ -261,11 +261,14 @@ public class ComponentUtil {
     }
   }
 
+  /**
+   * Searches the component tree beneath the component and return the first component matching the type.
+   */
   public static <T extends UIComponent> T findDescendant(UIComponent component, Class<T> type) {
 
     for (UIComponent child : (List<UIComponent>) component.getChildren()) {
       if (child.getClass().equals(type)) {
-        return (T) component;
+        return (T) child;
       }
       final T descendant = findDescendant(child, type);
       if (descendant != null) {