Coverage Report - org.apache.myfaces.view.facelets.compiler.UILiteralTextHandler
 
Classes in this File Line Coverage Branch Coverage Complexity
UILiteralTextHandler
0%
0/15
0%
0/6
1.75
 
 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  
 
 23  
 import javax.el.ELException;
 24  
 import javax.faces.FacesException;
 25  
 import javax.faces.component.UIComponent;
 26  
 import javax.faces.component.UniqueIdVendor;
 27  
 import javax.faces.view.facelets.FaceletContext;
 28  
 import javax.faces.view.facelets.FaceletException;
 29  
 
 30  
 import org.apache.myfaces.view.facelets.FaceletCompositionContext;
 31  
 import org.apache.myfaces.view.facelets.tag.jsf.ComponentSupport;
 32  
 
 33  
 final class UILiteralTextHandler extends AbstractUIHandler
 34  
 {
 35  
 
 36  
     protected final String txtString;
 37  
 
 38  
     public UILiteralTextHandler(String txtString)
 39  0
     {
 40  0
         this.txtString = txtString;
 41  0
     }
 42  
 
 43  
     public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
 44  
             ELException
 45  
     {
 46  0
         if (parent != null)
 47  
         {
 48  0
             UIComponent c = new UILiteralText(this.txtString);
 49  0
             UniqueIdVendor uniqueIdVendor
 50  
                     = FaceletCompositionContext.getCurrentInstance(ctx).getUniqueIdVendorFromStack();
 51  0
             if (uniqueIdVendor == null)
 52  
             {
 53  0
                 uniqueIdVendor = ComponentSupport.getViewRoot(ctx, parent);
 54  
             }
 55  0
             if (uniqueIdVendor != null)
 56  
             {
 57  
                 // UIViewRoot implements UniqueIdVendor, so there is no need to cast to UIViewRoot
 58  
                 // and call createUniqueId()
 59  0
                 String uid = uniqueIdVendor.createUniqueId(ctx.getFacesContext(), null);
 60  0
                 c.setId(uid);
 61  
             }
 62  0
             this.addComponent(ctx, parent, c);
 63  
         }
 64  0
     }
 65  
 
 66  
     public String getText()
 67  
     {
 68  0
         return this.txtString;
 69  
     }
 70  
 
 71  
     public String getText(FaceletContext ctx)
 72  
     {
 73  0
         return this.txtString;
 74  
     }
 75  
 }