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