Coverage Report - javax.faces.webapp.UIComponentELTag
 
Classes in this File Line Coverage Branch Coverage Complexity
UIComponentELTag
0%
0/30
0%
0/10
1.571
 
 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 javax.faces.webapp;
 20  
 
 21  
 import javax.el.ValueExpression;
 22  
 import javax.faces.application.Application;
 23  
 import javax.faces.component.UIComponent;
 24  
 import javax.faces.context.FacesContext;
 25  
 import javax.servlet.jsp.JspException;
 26  
 import javax.servlet.jsp.tagext.Tag;
 27  
 
 28  
 /**
 29  
  * Base class for all JSP tags that represent a JSF UIComponent.
 30  
  * <p>
 31  
  * <i>Disclaimer</i>: The official definition for the behaviour of
 32  
  * this class is the JSF specification but for legal reasons the
 33  
  * specification cannot be replicated here. Any javadoc present on this
 34  
  * class therefore describes the current implementation rather than the
 35  
  * officially required behaviour, though it is believed that this class
 36  
  * does comply with the specification.
 37  
  *
 38  
  * see Javadoc of <a href="http://java.sun.com/j2ee/javaserverfaces/1.2/docs/api/index.html">JSF Specification</a> for more.
 39  
  *
 40  
  * @author Bruno Aranda (latest modification by $Author: skitching $)
 41  
  * @author Manfred Geiler
 42  
  * @version $Revision: 676298 $ $Date: 2008-07-13 05:31:48 -0500 (Sun, 13 Jul 2008) $
 43  
  *
 44  
  * @since 1.2
 45  
  */
 46  
 public abstract class UIComponentELTag extends UIComponentClassicTagBase
 47  
         implements Tag
 48  
 {
 49  
 
 50  0
     private ValueExpression _binding = null;
 51  0
     private ValueExpression _rendered = null;
 52  
 
 53  
     public UIComponentELTag()
 54  0
     {
 55  
 
 56  0
     }
 57  
 
 58  
     public void release()
 59  
     {
 60  0
         super.release();
 61  0
         _binding = null;
 62  0
         _rendered = null;
 63  0
     }
 64  
 
 65  
 
 66  
     protected void setProperties(UIComponent component)
 67  
     {
 68  0
         if (getRendererType() != null)
 69  
         {
 70  0
             component.setRendererType(getRendererType());
 71  
         }
 72  
 
 73  0
         if (_rendered != null)
 74  
         {
 75  0
             if (_rendered.isLiteralText())
 76  
             {
 77  0
                 boolean b = Boolean.valueOf(_rendered.getExpressionString()).booleanValue();
 78  0
                 component.setRendered(b);
 79  0
             }
 80  
             else
 81  
             {
 82  0
                 component.setValueExpression("rendered", _rendered);
 83  
             }
 84  
         }
 85  0
     }
 86  
 
 87  
     protected UIComponent createComponent(FacesContext context, String newId) throws JspException
 88  
     {
 89  
         UIComponent component;
 90  0
         Application application = context.getApplication();
 91  
 
 92  0
         if (_binding != null)
 93  
         {
 94  0
             component = application.createComponent(_binding, context, getComponentType());
 95  0
             component.setValueExpression("binding", _binding);
 96  
         }
 97  
         else
 98  
         {
 99  0
             component = application.createComponent(getComponentType());
 100  
         }
 101  
 
 102  0
         component.setId(newId);
 103  0
         setProperties(component);
 104  
 
 105  0
         return component;
 106  
     }
 107  
     
 108  
     public void setBinding(ValueExpression binding) throws JspException
 109  
     {
 110  0
         _binding = binding;
 111  0
     }
 112  
     
 113  
     protected boolean hasBinding()
 114  
     {
 115  0
         return _binding != null;
 116  
     }
 117  
     
 118  
     public void setRendered(ValueExpression rendered)
 119  
     {
 120  0
         _rendered = rendered;
 121  0
     }
 122  
 }