myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r990498 - /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentTagHandlerDelegate.java
Date Sun, 29 Aug 2010 06:13:09 GMT
Author: lu4242
Date: Sun Aug 29 06:13:09 2010
New Revision: 990498

URL: http://svn.apache.org/viewvc?rev=990498&view=rev
Log:
MYFACES-2888 Wrapping ComponentHandler in TagHandlerDelegateFactory conflicts with implementation


Modified:
    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/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=990498&r1=990497&r2=990498&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
Sun Aug 29 06:13:09 2010
@@ -26,6 +26,7 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javax.el.ValueExpression;
+import javax.faces.FacesWrapper;
 import javax.faces.application.Application;
 import javax.faces.application.ProjectStage;
 import javax.faces.component.ActionSource;
@@ -75,10 +76,40 @@ public class ComponentTagHandlerDelegate
     private final TagAttribute _id;
 
     private final String _rendererType;
+    
+    private final ComponentBuilderHandler _componentBuilderHandlerDelegate;
 
+    @SuppressWarnings("unchecked")
     public ComponentTagHandlerDelegate(ComponentHandler delegate)
     {
         _delegate = delegate;
+        
+        ComponentHandler handler = _delegate;
+        boolean found = false;
+        while(handler != null && !found)
+        {
+            if (handler instanceof ComponentBuilderHandler)
+            {
+                found = true;
+            }
+            else if (handler instanceof FacesWrapper)
+            {
+                handler = ((FacesWrapper<? extends ComponentHandler>)handler).getWrapped();
+            }
+            else
+            {
+                handler = null;
+            }
+        }
+        if (found)
+        {
+            _componentBuilderHandlerDelegate = (ComponentBuilderHandler) handler;
+        }
+        else
+        {
+            _componentBuilderHandlerDelegate = null;
+        }
+        
         ComponentConfig delegateComponentConfig = delegate.getComponentConfig();
         _componentType = delegateComponentConfig.getComponentType();
         _rendererType = delegateComponentConfig.getRendererType();
@@ -426,11 +457,11 @@ public class ComponentTagHandlerDelegate
      */
     protected UIComponent createComponent(FaceletContext ctx)
     {
-        if (_delegate instanceof ComponentBuilderHandler)
+        if (_componentBuilderHandlerDelegate != null)
         {
             // the call to Application.createComponent(FacesContext, Resource)
             // is delegated because we don't have here the required Resource instance
-            return ((ComponentBuilderHandler) _delegate).createComponent(ctx);
+            return _componentBuilderHandlerDelegate.createComponent(ctx);
         }
         UIComponent c = null;
         FacesContext faces = ctx.getFacesContext();



Mime
View raw message