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 2009/09/01 07:14:30 UTC

svn commit: r809817 - /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java

Author: lu4242
Date: Tue Sep  1 05:14:30 2009
New Revision: 809817

URL: http://svn.apache.org/viewvc?rev=809817&view=rev
Log:
small fix generate id for create facet panel

Modified:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java?rev=809817&r1=809816&r2=809817&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java Tue Sep  1 05:14:30 2009
@@ -32,6 +32,8 @@
 import javax.faces.component.EditableValueHolder;
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIPanel;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.UniqueIdVendor;
 import javax.faces.component.ValueHolder;
 import javax.faces.context.FacesContext;
 import javax.faces.view.AttachedObjectHandler;
@@ -48,6 +50,7 @@
 import org.apache.myfaces.view.facelets.el.VariableMapperWrapper;
 import org.apache.myfaces.view.facelets.tag.jsf.ActionSourceRule;
 import org.apache.myfaces.view.facelets.tag.jsf.ComponentBuilderHandler;
+import org.apache.myfaces.view.facelets.tag.jsf.ComponentSupport;
 import org.apache.myfaces.view.facelets.tag.jsf.EditableValueHolderRule;
 import org.apache.myfaces.view.facelets.tag.jsf.ValueHolderRule;
 
@@ -180,6 +183,18 @@
             faceletContext.getFacesContext().getApplication().createComponent(UIPanel.COMPONENT_TYPE);
         compositeComponentBase.getFacets().put(UIComponent.COMPOSITE_FACET_NAME, compositeFacetPanel);
         
+        // Set an id to the created facet component, to prevent id generation and make
+        // partial state saving work without problem.
+        UniqueIdVendor root = ComponentSupport.getClosestUniqueIdVendor(faceletContext.getFacesContext(), compositeFacetPanel);
+        if (root != null)
+        {
+            String uid = (root instanceof UIViewRoot) ?
+                    ((UIViewRoot)root).createUniqueId() :
+                        root.createUniqueId(faceletContext.getFacesContext(),
+                                faceletContext.generateUniqueId(this.getTagId()));
+            compositeFacetPanel.setId(uid);
+        }
+        
         VariableMapper orig = faceletContext.getVariableMapper();
         AbstractFaceletContext actx = (AbstractFaceletContext) faceletContext;
         try