myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pau...@apache.org
Subject svn commit: r491561 - /myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/utils/TestUtils.java
Date Mon, 01 Jan 2007 12:41:53 GMT
Author: paulsp
Date: Mon Jan  1 04:41:53 2007
New Revision: 491561

URL: http://svn.apache.org/viewvc?view=rev&rev=491561
Log:
Add helper method to render a component.

Modified:
    myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/utils/TestUtils.java

Modified: myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/utils/TestUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/utils/TestUtils.java?view=diff&rev=491561&r1=491560&r2=491561
==============================================================================
--- myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/utils/TestUtils.java
(original)
+++ myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/utils/TestUtils.java
Mon Jan  1 04:41:53 2007
@@ -18,7 +18,10 @@
  */
 package org.apache.myfaces.test.utils;
 
+import java.io.IOException;
+
 import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.render.RenderKit;
 import javax.faces.render.Renderer;
@@ -483,5 +486,22 @@
             log.error(e.getMessage(), e);
             throw new FacesException(e);
         }
+    }
+
+    /**
+     * Renderered a component and it's children.
+     * 
+     * @param context Faces Context
+     * @param component Component to be rendered.
+     * @throws IOException Thrown while rendering.
+     */
+    public static void renderComponent(FacesContext context,
+            UIComponent component) throws IOException
+    {
+        Renderer renderer = context.getRenderKit().getRenderer(
+                component.getFamily(), component.getRendererType());
+        renderer.encodeBegin(context, component);
+        renderer.encodeChildren(context, component);
+        renderer.encodeEnd(context, component);
     }
 }



Mime
View raw message