Coverage Report - javax.faces.internal.RenderPreparableUtil
 
Classes in this File Line Coverage Branch Coverage Complexity
RenderPreparableUtil
0%
0/29
0%
0/20
3.25
 
 1  
 /*
 2  
  * Copyright 2004-2011 the Seasar Foundation and the Others.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 13  
  * either express or implied. See the License for the specific language
 14  
  * governing permissions and limitations under the License.
 15  
  */
 16  
 package javax.faces.internal;
 17  
 
 18  
 import java.io.IOException;
 19  
 import java.util.Iterator;
 20  
 
 21  
 import javax.faces.component.UIComponent;
 22  
 import javax.faces.context.FacesContext;
 23  
 import javax.faces.render.Renderer;
 24  
 
 25  
 import org.seasar.framework.util.AssertionUtil;
 26  
 import org.seasar.teeda.core.render.RenderPreparableRenderer;
 27  
 
 28  
 /**
 29  
  * @author higa
 30  
  *
 31  
  */
 32  
 public abstract class RenderPreparableUtil {
 33  
 
 34  0
     protected RenderPreparableUtil() {
 35  0
     }
 36  
 
 37  
     public static void encodeBeforeForRenderer(FacesContext context,
 38  
             UIComponent component) throws IOException {
 39  0
         AssertionUtil.assertNotNull("context", context);
 40  0
         AssertionUtil.assertNotNull("component", component);
 41  0
         Renderer renderer = UIComponentUtil.getRenderer(context, component);
 42  0
         if (renderer != null && renderer instanceof RenderPreparableRenderer) {
 43  0
             ((RenderPreparableRenderer) renderer).encodeBefore(context,
 44  
                     component);
 45  
         }
 46  0
     }
 47  
 
 48  
     public static void encodeBeforeForComponent(FacesContext context,
 49  
             UIComponent component) throws IOException {
 50  0
         AssertionUtil.assertNotNull("context", context);
 51  0
         AssertionUtil.assertNotNull("component", component);
 52  0
         final String componentName = component.getClass().getName();
 53  
         //TEEDA-264
 54  0
         if (!(componentName.endsWith("TCondition")) && !component.isRendered()) {
 55  0
             return;
 56  
         }
 57  0
         if ((component instanceof RenderPreparable)) {
 58  0
             ((RenderPreparable) component).preEncodeBegin(context);
 59  
         }
 60  0
         if (component.getChildCount() > 0) {
 61  0
             for (Iterator it = component.getChildren().iterator(); it.hasNext();) {
 62  0
                 UIComponent child = (UIComponent) it.next();
 63  0
                 encodeBeforeForComponent(context, child);
 64  
             }
 65  
         }
 66  0
     }
 67  
 
 68  
     public static void encodeAfterForComponent(final FacesContext context,
 69  
             final UIComponent component) throws IOException {
 70  0
         AssertionUtil.assertNotNull("context", context);
 71  0
         AssertionUtil.assertNotNull("component", component);
 72  0
         if (component.getChildCount() > 0) {
 73  0
             for (Iterator it = component.getChildren().iterator(); it.hasNext();) {
 74  0
                 UIComponent child = (UIComponent) it.next();
 75  0
                 encodeAfterForComponent(context, child);
 76  
             }
 77  
         }
 78  0
         if ((component instanceof RenderPreparable)) {
 79  0
             ((RenderPreparable) component).postEncodeEnd(context);
 80  
         }
 81  0
     }
 82  
 }