You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2010/08/12 15:46:21 UTC
svn commit: r984772 -
/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java
Author: lofwyr
Date: Thu Aug 12 13:46:20 2010
New Revision: 984772
URL: http://svn.apache.org/viewvc?rev=984772&view=rev
Log:
using a filter to only encode components of a specific type
Modified:
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java?rev=984772&r1=984771&r2=984772&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java Thu Aug 12 13:46:20 2010
@@ -92,6 +92,17 @@ public class RenderUtils {
}
public static void encode(FacesContext facesContext, UIComponent component) throws IOException {
+ encode(facesContext, component, null);
+ }
+
+ public static void encode(
+ FacesContext facesContext, UIComponent component, List<? extends Class<? extends UIComponent>> only)
+ throws IOException {
+
+ if (only != null && ! matchFilter(component, only)) {
+ return;
+ }
+
if (component.isRendered()) {
if (LOG.isDebugEnabled()) {
LOG.debug("rendering " + component.getRendererType() + " " + component);
@@ -102,13 +113,22 @@ public class RenderUtils {
} else {
for (Object o : component.getChildren()) {
UIComponent kid = (UIComponent) o;
- encode(facesContext, kid);
+ encode(facesContext, kid, only);
}
}
component.encodeEnd(facesContext);
}
}
+ private static boolean matchFilter(UIComponent component, List<? extends Class<? extends UIComponent>> only) {
+ for (Class clazz : only) {
+ if (clazz.isAssignableFrom(component.getClass())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public static void prepareRendererAll(FacesContext facesContext, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;