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

svn commit: r633411 - /myfaces/core/trunk_1.2.x/api/src/main/java/javax/faces/webapp/UIComponentTag.java

Author: skitching
Date: Tue Mar  4 02:15:06 2008
New Revision: 633411

URL: http://svn.apache.org/viewvc?rev=633411&view=rev
Log:
Fix MYFACES-1831 - make tag classes written for JSF1.1 work correctly on JSF12. In particular, this fixes t:updateActionListener.

Modified:
    myfaces/core/trunk_1.2.x/api/src/main/java/javax/faces/webapp/UIComponentTag.java

Modified: myfaces/core/trunk_1.2.x/api/src/main/java/javax/faces/webapp/UIComponentTag.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk_1.2.x/api/src/main/java/javax/faces/webapp/UIComponentTag.java?rev=633411&r1=633410&r2=633411&view=diff
==============================================================================
--- myfaces/core/trunk_1.2.x/api/src/main/java/javax/faces/webapp/UIComponentTag.java (original)
+++ myfaces/core/trunk_1.2.x/api/src/main/java/javax/faces/webapp/UIComponentTag.java Tue Mar  4 02:15:06 2008
@@ -21,6 +21,7 @@
 import javax.faces.el.ValueBinding;
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.tagext.Tag;
 
 /**
  * Base class for all JSP tags that represent a JSF UIComponent.
@@ -232,33 +233,123 @@
     }
 
     /**
-     * Class used to create an UIComponentTag from a UIComponentClassicTagBase
+     * Class used to create an UIComponentTag from a UIComponentClassicTagBase.
+     * <p>
+     * This is a standard use of the decorator pattern, to make the logic of the JSF12
+     * UIComponentClassicTagBase class available via the old JSF11 UIComponentTag
+     * api.
      */
     private static class UIComponentTagWrapper extends UIComponentTag
     {
-        public UIComponentTagWrapper(UIComponentClassicTagBase classicTag)
+    	private UIComponentClassicTagBase target;
+
+    	public UIComponentTagWrapper(UIComponentClassicTagBase classicTag)
         {
-            setId(classicTag.getId());
-            setJspId(classicTag.getJspId());
-            setParent(classicTag.getParent());
+    		target = classicTag;
         }
 
+    	// -----------------------------------------------------------
+    	// Methods that can reasonably be called on a parent tag object
+    	// -----------------------------------------------------------
+
+    	@Override
         public String getComponentType()
         {
-            return null;
+        	return target.getComponentType();
         }
 
+        @Override
         public String getRendererType()
         {
-            return null;
+        	return target.getRendererType();
+        }
+
+        @Override
+        public boolean getCreated()
+        {
+        	return target.getCreated();
+        }
+
+        @Override
+        public String getId()
+        {
+        	return target.getId();
+        }
+
+        @Override
+        public UIComponent getComponentInstance()
+        {
+        	return target.getComponentInstance();
+        }
+
+        @Override
+        public Tag getParent()
+        {
+            return target.getParent();
+        }
+
+        // -----------------------------------------------------------
+    	// Methods that should never be called on a parent tag object
+    	// -----------------------------------------------------------
+
+        @Override
+        public void release()
+        {
+        	throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void setBinding(String binding) throws JspException
+        {
+        	throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void setId(String id)
+        {
+        	throw new UnsupportedOperationException();
         }
 
+        @Override
+        public void setRendered(String state)
+        {
+        	throw new UnsupportedOperationException();
+        }
+
+        @Override
         protected UIComponent createComponent(FacesContext context, String newId)
         {
-            return null;
+        	throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void setPageContext(PageContext context)
+        {
+        	throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public void setParent(Tag parent)
+        {
+        	throw new UnsupportedOperationException();
+        }
+
+        @Override
+        protected UIComponent findComponent(FacesContext context) throws JspException
+        {
+        	throw new UnsupportedOperationException();
         }
 
+        @Override
+        protected FacesContext getFacesContext()
+        {
+        	throw new UnsupportedOperationException();
+        }
 
+        // Methods that no sane user of this class would call, so we do not need to override here:
+        //   doStartTag, doEndTag, getDoStartValue, getDoEndValue, isSupressed
+        //   encodeBegin, encodeChildren, encodeEnd, getFacetName
+        //   setProperties, setupResponseWriter
     }
 
     @Override
@@ -266,5 +357,4 @@
     {
         return _binding != null;
     }
-
 }