Coverage Report - javax.faces.render.Renderer
 
Classes in this File Line Coverage Branch Coverage Complexity
Renderer
97%
30/31
100%
6/6
1.375
 
 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.render;
 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.convert.ConverterException;
 24  
 
 25  
 import org.seasar.framework.util.AssertionUtil;
 26  
 
 27  
 /**
 28  
  * @author shot
 29  
  * @author manhole
 30  
  */
 31  2616
 public abstract class Renderer {
 32  
 
 33  
     public void decode(FacesContext context, UIComponent component) {
 34  35
         AssertionUtil.assertNotNull("context", context);
 35  23
         AssertionUtil.assertNotNull("component", component);
 36  11
     }
 37  
 
 38  
     public void encodeBegin(FacesContext context, UIComponent component)
 39  
             throws IOException {
 40  433
         AssertionUtil.assertNotNull("context", context);
 41  414
         AssertionUtil.assertNotNull("component", component);
 42  395
     }
 43  
 
 44  
     public void encodeChildren(FacesContext context, UIComponent component)
 45  
             throws IOException {
 46  87
         AssertionUtil.assertNotNull("context", context);
 47  64
         AssertionUtil.assertNotNull("component", component);
 48  41
         encodeChildren0(context, component);
 49  41
     }
 50  
 
 51  
     private void encodeChildren0(FacesContext context, UIComponent component)
 52  
             throws IOException {
 53  59
         for (Iterator itr = component.getChildren().iterator(); itr.hasNext();) {
 54  23
             UIComponent child = (UIComponent) itr.next();
 55  23
             child.encodeBegin(context);
 56  23
             if (child.getRendersChildren()) {
 57  5
                 child.encodeChildren(context);
 58  
             } else {
 59  18
                 encodeChildren0(context, child);
 60  
             }
 61  23
             child.encodeEnd(context);
 62  23
             if (context.getResponseComplete()) {
 63  1
                 break;
 64  
             }
 65  
         }
 66  59
     }
 67  
 
 68  
     public void encodeEnd(FacesContext context, UIComponent component)
 69  
             throws IOException {
 70  22
         AssertionUtil.assertNotNull("context", context);
 71  20
         AssertionUtil.assertNotNull("component", component);
 72  18
     }
 73  
 
 74  
     public String convertClientId(FacesContext context, String clientId) {
 75  319
         AssertionUtil.assertNotNull("context", context);
 76  293
         AssertionUtil.assertNotNull("clientId", clientId);
 77  267
         return clientId;
 78  
     }
 79  
 
 80  
     public boolean getRendersChildren() {
 81  403
         return false;
 82  
     }
 83  
 
 84  
     public Object getConvertedValue(FacesContext context,
 85  
             UIComponent component, Object submittedValue)
 86  
             throws ConverterException {
 87  4
         AssertionUtil.assertNotNull("context", context);
 88  2
         AssertionUtil.assertNotNull("component", component);
 89  0
         return submittedValue;
 90  
     }
 91  
 
 92  
 }