You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by im...@apache.org on 2006/04/06 15:57:23 UTC

svn commit: r391986 - /myfaces/core/trunk/api/src/main/java/javax/faces/webapp/UIComponentTag.java

Author: imario
Date: Thu Apr  6 06:57:21 2006
New Revision: 391986

URL: http://svn.apache.org/viewcvs?rev=391986&view=rev
Log:
changed the way how to determine if a facet has more than one child. not it will be checked indirect by checking if the facet is already associated to a parent. The old style (compare by id) didnt work as the id might be change later by e.g the component (as the tree2 do).

Modified:
    myfaces/core/trunk/api/src/main/java/javax/faces/webapp/UIComponentTag.java

Modified: myfaces/core/trunk/api/src/main/java/javax/faces/webapp/UIComponentTag.java
URL: http://svn.apache.org/viewcvs/myfaces/core/trunk/api/src/main/java/javax/faces/webapp/UIComponentTag.java?rev=391986&r1=391985&r2=391986&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/java/javax/faces/webapp/UIComponentTag.java (original)
+++ myfaces/core/trunk/api/src/main/java/javax/faces/webapp/UIComponentTag.java Thu Apr  6 06:57:21 2006
@@ -555,9 +555,10 @@
             }
             else
             {
-            	if (!id.equals(_componentInstance.getId()))
+            	if (checkFacetNameOoParentExists(parentTag, facetName))
             	{
-            		throw new IllegalStateException("facet already has a child associated. current component id: " + _componentInstance.getClientId(context));
+            		throw new IllegalStateException("facet '" + facetName + "' already has a child associated. current associated component id: "
+            			+ _componentInstance.getClientId(context) + " class: " + _componentInstance.getClass().getName());
             	}
             }
             
@@ -761,6 +762,14 @@
         parentTag._childrenAdded.add(id);
     }
 
+    /**
+     * check if the facet is already added to the parent
+     */
+    private boolean checkFacetNameOoParentExists(UIComponentTag parentTag, String facetName)
+    {
+        return parentTag._facetsAdded != null && parentTag._facetsAdded.contains(facetName); 
+    }
+    
     /**
      * Notify the enclosing JSP tag of the id of this facet's id. The parent
      * tag will later delete any existing view facets that were not seen