Coverage Report - org.apache.myfaces.view.facelets.component.RepeatRenderer
 
Classes in this File Line Coverage Branch Coverage Complexity
RepeatRenderer
0%
0/24
0%
0/14
2.4
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *   http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing,
 13  
  * software distributed under the License is distributed on an
 14  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15  
  * KIND, either express or implied.  See the License for the
 16  
  * specific language governing permissions and limitations
 17  
  * under the License.
 18  
  */
 19  
 package org.apache.myfaces.view.facelets.component;
 20  
 
 21  
 import java.io.IOException;
 22  
 import java.util.Map;
 23  
 
 24  
 import javax.faces.component.UIComponent;
 25  
 import javax.faces.context.FacesContext;
 26  
 import javax.faces.context.ResponseWriter;
 27  
 import javax.faces.render.Renderer;
 28  
 
 29  
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFRenderer;
 30  
 
 31  
 @JSFRenderer(family="facelets",
 32  
         renderKitId="HTML_BASIC",
 33  
         type="facelets.ui.Repeat")
 34  
 public class RepeatRenderer extends Renderer
 35  
 {
 36  
 
 37  
     public RepeatRenderer()
 38  
     {
 39  0
         super();
 40  0
     }
 41  
 
 42  
     @Override
 43  
     public void encodeBegin(FacesContext context, UIComponent component) throws IOException
 44  
     {
 45  
 
 46  0
     }
 47  
 
 48  
     @Override
 49  
     public void encodeChildren(FacesContext context, UIComponent component) throws IOException
 50  
     {
 51  0
         if (component.getChildCount() > 0)
 52  
         {
 53  0
             Map<String, Object> a = component.getAttributes();
 54  0
             String tag = (String) a.get("alias.element");
 55  0
             if (tag != null)
 56  
             {
 57  0
                 ResponseWriter out = context.getResponseWriter();
 58  0
                 out.startElement(tag, component);
 59  0
                 String[] attrs = (String[]) a.get("alias.attributes");
 60  
                 String attr;
 61  0
                 if (attrs != null)
 62  
                 {
 63  0
                     for (int i = 0; i < attrs.length; i++)
 64  
                     {
 65  0
                         attr = attrs[i];
 66  0
                         if ("styleClass".equals(attr))
 67  
                         {
 68  0
                             attr = "class";
 69  
                         }
 70  0
                         out.writeAttribute(attr, a.get(attrs[i]), attrs[i]);
 71  
                     }
 72  
                 }
 73  
             }
 74  
             
 75  0
             for (int i = 0, childCount = component.getChildCount(); i < childCount; i++)
 76  
             {
 77  0
                 UIComponent child = component.getChildren().get(i);
 78  0
                 child.encodeAll(context);
 79  
             }
 80  
 
 81  0
             if (tag != null)
 82  
             {
 83  0
                 context.getResponseWriter().endElement(tag);
 84  
             }
 85  
         }
 86  0
     }
 87  
 
 88  
     @Override
 89  
     public void encodeEnd(FacesContext context, UIComponent component) throws IOException
 90  
     {
 91  
         
 92  0
     }
 93  
 
 94  
     @Override
 95  
     public boolean getRendersChildren()
 96  
     {
 97  0
         return true;
 98  
     }
 99  
 
 100  
 }