Coverage Report - org.apache.myfaces.shared_impl.taglib.UIComponentELTagBase
 
Classes in this File Line Coverage Branch Coverage Complexity
UIComponentELTagBase
0%
0/73
0%
0/6
0
 
 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.shared_impl.taglib;
 20  
 
 21  
 import org.apache.myfaces.shared_impl.renderkit.JSFAttr;
 22  
 
 23  
 import javax.el.MethodExpression;
 24  
 import javax.el.ValueExpression;
 25  
 import javax.faces.component.UIComponent;
 26  
 import javax.faces.webapp.UIComponentELTag;
 27  
 
 28  
 /**
 29  
  * @author Manfred Geiler (latest modification by $Author: matzew $)
 30  
  * @author Bruno Aranda (JSR-252)
 31  
  * @version $Revision: 557350 $ $Date: 2007-07-18 13:19:50 -0500 (Wed, 18 Jul 2007) $
 32  
  */
 33  0
 public abstract class UIComponentELTagBase
 34  
         extends UIComponentELTag
 35  
 {
 36  
     //private static final Log log = LogFactory.getLog(UIComponentTagBase.class);
 37  
 
 38  
     //UIComponent attributes
 39  
     private ValueExpression _forceId;
 40  
 
 41  
     private ValueExpression _forceIdIndex;
 42  0
     private static final Boolean DEFAULT_FORCE_ID_INDEX_VALUE = Boolean.TRUE;
 43  
 
 44  
     private ValueExpression _javascriptLocation;
 45  
     private ValueExpression _imageLocation;
 46  
     private ValueExpression _styleLocation;
 47  
 
 48  
     //Special UIComponent attributes (ValueHolder, ConvertibleValueHolder)
 49  
     private ValueExpression _value;
 50  
     private ValueExpression _converter;
 51  
     //attributes id, rendered and binding are handled by UIComponentTag
 52  
 
 53  
     public void release() {
 54  0
         super.release();
 55  
 
 56  0
         _forceId = null;
 57  0
         _forceIdIndex = null;
 58  
 
 59  0
         _value=null;
 60  0
         _converter=null;
 61  
 
 62  0
         _javascriptLocation = null;
 63  0
         _imageLocation = null;
 64  0
         _styleLocation = null;
 65  0
     }
 66  
 
 67  
     protected void setProperties(UIComponent component)
 68  
     {
 69  0
         super.setProperties(component);
 70  
 
 71  0
         setBooleanProperty(component, org.apache.myfaces.shared_impl.renderkit.JSFAttr.FORCE_ID_ATTR, _forceId);
 72  0
         setBooleanProperty(component, org.apache.myfaces.shared_impl.renderkit.JSFAttr.FORCE_ID_INDEX_ATTR, _forceIdIndex, DEFAULT_FORCE_ID_INDEX_VALUE);
 73  0
         if (_javascriptLocation != null) setStringProperty(component, JSFAttr.JAVASCRIPT_LOCATION, _javascriptLocation);
 74  0
         if (_imageLocation != null) setStringProperty(component, JSFAttr.IMAGE_LOCATION, _imageLocation);
 75  0
         if (_styleLocation != null) setStringProperty(component, JSFAttr.STYLE_LOCATION, _styleLocation);
 76  
 
 77  
         //rendererType already handled by UIComponentTag
 78  
 
 79  0
         setValueProperty(component, _value);
 80  0
         setConverterProperty(component, _converter);
 81  0
     }
 82  
 
 83  
     /**
 84  
      * Sets the forceId attribute of the tag.  NOTE: Not every tag that extends this class will
 85  
      * actually make use of this attribute.  Check the TLD to see which components actually
 86  
      * implement it.
 87  
      *
 88  
      * @param aForceId The value of the forceId attribute.
 89  
      */
 90  
     public void setForceId(ValueExpression aForceId)
 91  
     {
 92  0
         _forceId = aForceId;
 93  0
     }
 94  
 
 95  
     /**
 96  
      * Sets the forceIdIndex attribute of the tag.  NOTE: Not every tag that extends this class will
 97  
      * actually make use of this attribute.  Check the TLD to see which components actually implement it.
 98  
      *
 99  
      * @param aForceIdIndex The value of the forceIdIndex attribute.
 100  
      */
 101  
     public void setForceIdIndex(ValueExpression aForceIdIndex)
 102  
     {
 103  0
         _forceIdIndex = aForceIdIndex;
 104  0
     }
 105  
 
 106  
     public void setValue(ValueExpression value)
 107  
     {
 108  0
         _value = value;
 109  0
     }
 110  
 
 111  
     public void setConverter(ValueExpression converter)
 112  
     {
 113  0
         _converter = converter;
 114  0
     }
 115  
 
 116  
 
 117  
     /**
 118  
      * Sets the javascript location attribute of the tag.  NOTE: Not every tag that extends this class will
 119  
      * actually make use of this attribute.  Check the TLD to see which components actually implement it.
 120  
      *
 121  
      * @param aJavascriptLocation The alternate javascript location to use.
 122  
      */
 123  
     public void setJavascriptLocation(ValueExpression aJavascriptLocation)
 124  
     {
 125  0
         _javascriptLocation = aJavascriptLocation;
 126  0
     }
 127  
 
 128  
     /**
 129  
      * Sets the image location attribute of the tag.  NOTE: Not every tag that extends this class will
 130  
      * actually make use of this attribute.  Check the TLD to see which components actually implement it.
 131  
      *
 132  
      * @param aImageLocation The alternate image location to use.
 133  
      */
 134  
     public void setImageLocation(ValueExpression aImageLocation)
 135  
     {
 136  0
         _imageLocation = aImageLocation;
 137  0
     }
 138  
 
 139  
     /**
 140  
      * Sets the style location attribute of the tag.  NOTE: Not every tag that extends this class will
 141  
      * actually make use of this attribute.  Check the TLD to see which components actually implement it.
 142  
      *
 143  
      * @param aStyleLocation The alternate style location to use.
 144  
      */
 145  
     public void setStyleLocation(ValueExpression aStyleLocation)
 146  
     {
 147  0
         _styleLocation = aStyleLocation;
 148  0
     }
 149  
 
 150  
     // sub class helpers
 151  
 
 152  
     protected void setIntegerProperty(UIComponent component, String propName, ValueExpression value)
 153  
     {
 154  0
         UIComponentELTagUtils.setIntegerProperty(component, propName, value);
 155  0
     }
 156  
 
 157  
     protected void setIntegerProperty(UIComponent component, String propName, ValueExpression value, Integer defaultValue)
 158  
     {
 159  0
         UIComponentELTagUtils.setIntegerProperty(component, propName, value, defaultValue);
 160  0
     }
 161  
 
 162  
     protected void setLongProperty(UIComponent component, String propName, ValueExpression value)
 163  
     {
 164  0
         UIComponentELTagUtils.setLongProperty(component, propName, value);
 165  0
     }
 166  
 
 167  
     protected void setLongProperty(UIComponent component, String propName, ValueExpression value, Long defaultValue)
 168  
     {
 169  0
         UIComponentELTagUtils.setLongProperty(component, propName, value, defaultValue);
 170  0
     }
 171  
 
 172  
     @Deprecated
 173  
     protected void setStringProperty(UIComponent component, String propName, String value)
 174  
     {
 175  0
         UIComponentTagUtils.setStringProperty(getFacesContext(), component, propName, value);
 176  0
     }
 177  
 
 178  
     protected void setStringProperty(UIComponent component, String propName, ValueExpression value)
 179  
     {
 180  0
         UIComponentELTagUtils.setStringProperty(component, propName, value);
 181  0
     }
 182  
 
 183  
     protected void setStringProperty(UIComponent component, String propName, ValueExpression value, String defaultValue)
 184  
     {
 185  0
         UIComponentELTagUtils.setStringProperty(component, propName, value, defaultValue);
 186  0
     }
 187  
 
 188  
     @Deprecated
 189  
     protected void setBooleanProperty(UIComponent component, String propName, String value)
 190  
     {
 191  0
         UIComponentTagUtils.setBooleanProperty(getFacesContext(), component, propName, value);
 192  0
     }
 193  
 
 194  
     protected void setBooleanProperty(UIComponent component, String propName, ValueExpression value)
 195  
     {
 196  0
         UIComponentELTagUtils.setBooleanProperty(component, propName, value);
 197  0
     }
 198  
 
 199  
     protected void setBooleanProperty(UIComponent component, String propName, ValueExpression value, Boolean defaultValue)
 200  
     {
 201  0
         UIComponentELTagUtils.setBooleanProperty(component, propName, value, defaultValue);
 202  0
     }
 203  
 
 204  
     private void setValueProperty(UIComponent component, ValueExpression value)
 205  
     {
 206  0
         UIComponentELTagUtils.setValueProperty(getFacesContext(), component, value);
 207  0
     }
 208  
 
 209  
     private void setConverterProperty(UIComponent component, ValueExpression value)
 210  
     {
 211  0
         UIComponentELTagUtils.setConverterProperty(getFacesContext(), component, value);
 212  0
     }
 213  
 
 214  
     protected void addValidatorProperty(UIComponent component, MethodExpression value)
 215  
     {
 216  0
         UIComponentELTagUtils.addValidatorProperty(getFacesContext(), component, value);
 217  0
     }
 218  
 
 219  
     @Deprecated
 220  
     protected void setActionProperty(UIComponent component, String action)
 221  
     {
 222  0
         UIComponentTagUtils.setActionProperty(getFacesContext(), component, action);
 223  0
     }
 224  
 
 225  
     protected void setActionProperty(UIComponent component, MethodExpression action)
 226  
     {
 227  0
         UIComponentELTagUtils.setActionProperty(getFacesContext(), component, action);
 228  0
     }
 229  
 
 230  
     @Deprecated
 231  
     protected void setActionListenerProperty(UIComponent component, String actionListener)
 232  
     {
 233  0
         UIComponentTagUtils.setActionListenerProperty(getFacesContext(), component, actionListener);
 234  0
     }
 235  
 
 236  
     protected void setActionListenerProperty(UIComponent component, MethodExpression actionListener)
 237  
     {
 238  0
         UIComponentELTagUtils.addActionListenerProperty(getFacesContext(), component, actionListener);
 239  0
     }
 240  
 
 241  
     protected void addValueChangedListenerProperty(UIComponent component, MethodExpression valueChangedListener)
 242  
     {
 243  0
         UIComponentELTagUtils.addValueChangedListenerProperty(getFacesContext(), component, valueChangedListener);
 244  0
     }
 245  
 
 246  
     protected void setValueBinding(UIComponent component,
 247  
                                    String propName,
 248  
                                    ValueExpression value)
 249  
     {
 250  0
         UIComponentELTagUtils.setValueBinding(getFacesContext(), component, propName, value);
 251  0
     }
 252  
     
 253  
     protected Object evaluateValueExpression(ValueExpression expression)
 254  
     {
 255  0
         return UIComponentELTagUtils.evaluateValueExpression(getFacesContext().getELContext(), expression);
 256  
     }
 257  
 
 258  
 
 259  
 }