You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by pa...@apache.org on 2007/01/01 13:41:53 UTC
svn commit: r491561 -
/myfaces/tomahawk/trunk/core/src/test/java/org/apache/myfaces/test/utils/TestUtils.java
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);
}
}