Coverage Report - org.apache.myfaces.view.facelets.compiler.CompilationUnit
 
Classes in this File Line Coverage Branch Coverage Complexity
CompilationUnit
0%
0/17
0%
0/10
2.167
CompilationUnit$1
0%
0/3
N/A
2.167
 
 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.compiler;
 20  
 
 21  
 import java.io.IOException;
 22  
 import java.util.ArrayList;
 23  
 import java.util.List;
 24  
 
 25  
 import javax.el.ELException;
 26  
 import javax.faces.FacesException;
 27  
 import javax.faces.component.UIComponent;
 28  
 import javax.faces.view.facelets.FaceletContext;
 29  
 import javax.faces.view.facelets.FaceletException;
 30  
 import javax.faces.view.facelets.FaceletHandler;
 31  
 
 32  
 /**
 33  
  * 
 34  
  * @author Jacob Hookom
 35  
  * @version $Id$
 36  
  */
 37  
 class CompilationUnit
 38  
 {
 39  
 
 40  0
     protected final static FaceletHandler LEAF = new FaceletHandler()
 41  0
     {
 42  
         public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
 43  
                 ELException
 44  
         {
 45  0
         }
 46  
 
 47  
         public String toString()
 48  
         {
 49  0
             return "FaceletHandler Tail";
 50  
         }
 51  
     };
 52  
 
 53  
     private List<CompilationUnit> children;
 54  
 
 55  
     public CompilationUnit()
 56  0
     {
 57  0
     }
 58  
 
 59  
     public void addChild(CompilationUnit unit)
 60  
     {
 61  0
         if (this.children == null)
 62  
         {
 63  0
             this.children = new ArrayList<CompilationUnit>();
 64  
         }
 65  0
         this.children.add(unit);
 66  0
     }
 67  
 
 68  
     public FaceletHandler createFaceletHandler()
 69  
     {
 70  0
         return this.getNextFaceletHandler();
 71  
     }
 72  
 
 73  
     protected final FaceletHandler getNextFaceletHandler()
 74  
     {
 75  0
         if (this.children == null || this.children.size() == 0)
 76  
         {
 77  0
             return LEAF;
 78  
         }
 79  0
         if (this.children.size() == 1)
 80  
         {
 81  0
             CompilationUnit u = (CompilationUnit) this.children.get(0);
 82  0
             return u.createFaceletHandler();
 83  
         }
 84  0
         FaceletHandler[] fh = new FaceletHandler[this.children.size()];
 85  0
         for (int i = 0; i < fh.length; i++)
 86  
         {
 87  0
             fh[i] = ((CompilationUnit) this.children.get(i)).createFaceletHandler();
 88  
         }
 89  0
         return new javax.faces.view.facelets.CompositeFaceletHandler(fh);
 90  
     }
 91  
 
 92  
 }