Coverage Report - javax.faces.component.html.HtmlInputFile
 
Classes in this File Line Coverage Branch Coverage Complexity
HtmlInputFile
0%
0/163
0%
0/32
1.358
HtmlInputFile$PropertyKeys
0%
0/30
N/A
1.358
 
 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.component.html;
 20  
 
 21  
 import javax.faces.el.ValueBinding;
 22  
 import javax.el.ValueExpression;
 23  
 import javax.faces.context.FacesContext;
 24  
 import javax.faces.component.UIComponent;
 25  
 import javax.faces.convert.Converter;
 26  
 import javax.faces.el.MethodBinding;
 27  
 
 28  
 
 29  
 // Generated from class javax.faces.component.html._HtmlInputFile.
 30  
 //
 31  
 // WARNING: This file was automatically generated. Do not edit it directly,
 32  
 //          or you will lose your changes.
 33  
 public class HtmlInputFile extends javax.faces.component.UIInput
 34  
     implements javax.faces.component.behavior.ClientBehaviorHolder
 35  
 {
 36  
 
 37  
     static public final String COMPONENT_FAMILY =
 38  
         "javax.faces.Input";
 39  
     static public final String COMPONENT_TYPE =
 40  
         "javax.faces.HtmlInputFile";
 41  
 
 42  
     //BEGIN CODE COPIED FROM javax.faces.component.html._HtmlInputFile 
 43  
     protected void validateValue(javax.faces.context.FacesContext context, java.lang.Object convertedValue)
 44  
     {
 45  0
         if (!isValid())
 46  
         {
 47  0
             return;
 48  
         }
 49  
 
 50  
         // If our value is empty, check the required property
 51  0
         boolean isEmpty = isEmptyValue(convertedValue); 
 52  
 
 53  0
         if (isRequired() && isEmpty)
 54  
         {
 55  0
             if (getRequiredMessage() != null)
 56  
             {
 57  0
                 String requiredMessage = getRequiredMessage();
 58  0
                 context.addMessage(this.getClientId(context), new javax.faces.application.FacesMessage(
 59  
                         javax.faces.application.FacesMessage.SEVERITY_ERROR,
 60  
                     requiredMessage, requiredMessage));
 61  0
             }
 62  
             else
 63  
             {
 64  0
                 _MessageUtils.addErrorMessage(context, this, REQUIRED_MESSAGE_ID,
 65  
                     new Object[] { _MessageUtils.getLabel(context, this) });
 66  
             }
 67  0
             setValid(false);
 68  0
             return;
 69  
         }
 70  
 
 71  0
         if (!isEmpty)
 72  
         {
 73  0
             super.validateValue(context, convertedValue);
 74  
         }
 75  0
     }
 76  
 
 77  
     private static boolean isEmptyValue(java.lang.Object value)
 78  
     {
 79  0
         if (value == null)
 80  
         {
 81  0
             return true;
 82  
         }
 83  0
         else if (value instanceof String)
 84  
         {
 85  0
             if ( ((String)value).trim().length() <= 0 )
 86  
             {
 87  0
                 return true;
 88  
             }
 89  
         }
 90  0
         else if (value instanceof java.util.Collection)
 91  
         {
 92  0
             if ( ((java.util.Collection)value).isEmpty())
 93  
             {
 94  0
                 return true;
 95  
             }
 96  
         }
 97  0
         else if (value.getClass().isArray())
 98  
         {
 99  0
             if (java.lang.reflect.Array.getLength(value) <= 0)
 100  
             {
 101  0
                 return true;
 102  
             }
 103  
         }
 104  0
         else if (value instanceof java.util.Map)
 105  
         {
 106  0
             if ( ((java.util.Map)value).isEmpty())
 107  
             {
 108  0
                 return true;
 109  
             }
 110  
         }
 111  0
         else if (value instanceof javax.servlet.http.Part) 
 112  
         {
 113  0
             if (((javax.servlet.http.Part)value).getSize() <= 0) 
 114  
             {
 115  0
                 return true;
 116  
             }
 117  
         }
 118  0
         return false;
 119  
     }
 120  
 
 121  
 
 122  
     //END CODE COPIED FROM javax.faces.component.html._HtmlInputFile
 123  
 
 124  
     public HtmlInputFile()
 125  0
     {
 126  0
         setRendererType("javax.faces.File");
 127  0
     }
 128  
 
 129  
     @Override    
 130  
     public String getFamily()
 131  
     {
 132  0
         return COMPONENT_FAMILY;
 133  
     }
 134  
 
 135  
 
 136  0
     static private final java.util.Collection<String> CLIENT_EVENTS_LIST = 
 137  
         java.util.Collections.unmodifiableCollection(
 138  
             java.util.Arrays.asList(
 139  
              "blur"
 140  
             , "focus"
 141  
             , "click"
 142  
             , "dblclick"
 143  
             , "keydown"
 144  
             , "keypress"
 145  
             , "keyup"
 146  
             , "mousedown"
 147  
             , "mousemove"
 148  
             , "mouseout"
 149  
             , "mouseover"
 150  
             , "mouseup"
 151  
             , "change"
 152  
             , "select"
 153  
             , "valueChange"
 154  
         ));
 155  
 
 156  
     public java.util.Collection<String> getEventNames()
 157  
     {
 158  0
         return CLIENT_EVENTS_LIST;
 159  
     }
 160  
 
 161  
     @Override
 162  
     public void addClientBehavior(String eventName, javax.faces.component.behavior.ClientBehavior behavior)
 163  
     {
 164  0
         super.addClientBehavior(eventName, behavior);
 165  0
         _CommonEventConstants.markEvent(this, eventName);
 166  0
     }
 167  
 
 168  
     //ClientBehaviorHolder default: valueChange
 169  
     public String getDefaultEventName()
 170  
     {
 171  0
         return "valueChange";
 172  
     }
 173  
 
 174  
     
 175  
     // Property: maxlength
 176  
 
 177  
     public int getMaxlength()
 178  
     {
 179  0
         return (Integer) getStateHelper().eval(PropertyKeys.maxlength, Integer.MIN_VALUE);
 180  
     }
 181  
     
 182  
     public void setMaxlength(int maxlength)
 183  
     {
 184  0
         getStateHelper().put(PropertyKeys.maxlength, maxlength ); 
 185  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.MAXLENGTH_PROP);
 186  0
     }
 187  
     // Property: size
 188  
 
 189  
     public int getSize()
 190  
     {
 191  0
         return (Integer) getStateHelper().eval(PropertyKeys.size, Integer.MIN_VALUE);
 192  
     }
 193  
     
 194  
     public void setSize(int size)
 195  
     {
 196  0
         getStateHelper().put(PropertyKeys.size, size ); 
 197  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.SIZE_PROP);
 198  0
     }
 199  
     // Property: autocomplete
 200  
 
 201  
     public String getAutocomplete()
 202  
     {
 203  0
         return (String) getStateHelper().eval(PropertyKeys.autocomplete);
 204  
     }
 205  
     
 206  
     public void setAutocomplete(String autocomplete)
 207  
     {
 208  0
         getStateHelper().put(PropertyKeys.autocomplete, autocomplete ); 
 209  0
     }
 210  
     // Property: label
 211  
 
 212  
     public String getLabel()
 213  
     {
 214  0
         return (String) getStateHelper().eval(PropertyKeys.label);
 215  
     }
 216  
     
 217  
     public void setLabel(String label)
 218  
     {
 219  0
         getStateHelper().put(PropertyKeys.label, label ); 
 220  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.LABEL_PROP);
 221  0
     }
 222  
     // Property: style
 223  
 
 224  
     public String getStyle()
 225  
     {
 226  0
         return (String) getStateHelper().eval(PropertyKeys.style);
 227  
     }
 228  
     
 229  
     public void setStyle(String style)
 230  
     {
 231  0
         getStateHelper().put(PropertyKeys.style, style ); 
 232  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.STYLE_PROP);
 233  0
     }
 234  
     // Property: styleClass
 235  
 
 236  
     public String getStyleClass()
 237  
     {
 238  0
         return (String) getStateHelper().eval(PropertyKeys.styleClass);
 239  
     }
 240  
     
 241  
     public void setStyleClass(String styleClass)
 242  
     {
 243  0
         getStateHelper().put(PropertyKeys.styleClass, styleClass ); 
 244  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.STYLECLASS_PROP);
 245  0
     }
 246  
     // Property: alt
 247  
 
 248  
     public String getAlt()
 249  
     {
 250  0
         return (String) getStateHelper().eval(PropertyKeys.alt);
 251  
     }
 252  
     
 253  
     public void setAlt(String alt)
 254  
     {
 255  0
         getStateHelper().put(PropertyKeys.alt, alt ); 
 256  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ALT_PROP);
 257  0
     }
 258  
     // Property: tabindex
 259  
 
 260  
     public String getTabindex()
 261  
     {
 262  0
         return (String) getStateHelper().eval(PropertyKeys.tabindex);
 263  
     }
 264  
     
 265  
     public void setTabindex(String tabindex)
 266  
     {
 267  0
         getStateHelper().put(PropertyKeys.tabindex, tabindex ); 
 268  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.TABINDEX_PROP);
 269  0
     }
 270  
     // Property: onblur
 271  
 
 272  
     public String getOnblur()
 273  
     {
 274  0
         return (String) getStateHelper().eval(PropertyKeys.onblur);
 275  
     }
 276  
     
 277  
     public void setOnblur(String onblur)
 278  
     {
 279  0
         getStateHelper().put(PropertyKeys.onblur, onblur ); 
 280  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONBLUR_PROP);
 281  0
     }
 282  
     // Property: onfocus
 283  
 
 284  
     public String getOnfocus()
 285  
     {
 286  0
         return (String) getStateHelper().eval(PropertyKeys.onfocus);
 287  
     }
 288  
     
 289  
     public void setOnfocus(String onfocus)
 290  
     {
 291  0
         getStateHelper().put(PropertyKeys.onfocus, onfocus ); 
 292  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONFOCUS_PROP);
 293  0
     }
 294  
     // Property: accesskey
 295  
 
 296  
     public String getAccesskey()
 297  
     {
 298  0
         return (String) getStateHelper().eval(PropertyKeys.accesskey);
 299  
     }
 300  
     
 301  
     public void setAccesskey(String accesskey)
 302  
     {
 303  0
         getStateHelper().put(PropertyKeys.accesskey, accesskey ); 
 304  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ACCESSKEY_PROP);
 305  0
     }
 306  
     // Property: role
 307  
 
 308  
     public String getRole()
 309  
     {
 310  0
         return (String) getStateHelper().eval(PropertyKeys.role);
 311  
     }
 312  
     
 313  
     public void setRole(String role)
 314  
     {
 315  0
         getStateHelper().put(PropertyKeys.role, role ); 
 316  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ROLE_PROP);
 317  0
     }
 318  
     // Property: onclick
 319  
 
 320  
     public String getOnclick()
 321  
     {
 322  0
         return (String) getStateHelper().eval(PropertyKeys.onclick);
 323  
     }
 324  
     
 325  
     public void setOnclick(String onclick)
 326  
     {
 327  0
         getStateHelper().put(PropertyKeys.onclick, onclick ); 
 328  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONCLICK_PROP);
 329  0
     }
 330  
     // Property: ondblclick
 331  
 
 332  
     public String getOndblclick()
 333  
     {
 334  0
         return (String) getStateHelper().eval(PropertyKeys.ondblclick);
 335  
     }
 336  
     
 337  
     public void setOndblclick(String ondblclick)
 338  
     {
 339  0
         getStateHelper().put(PropertyKeys.ondblclick, ondblclick ); 
 340  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONDBLCLICK_PROP);
 341  0
     }
 342  
     // Property: onkeydown
 343  
 
 344  
     public String getOnkeydown()
 345  
     {
 346  0
         return (String) getStateHelper().eval(PropertyKeys.onkeydown);
 347  
     }
 348  
     
 349  
     public void setOnkeydown(String onkeydown)
 350  
     {
 351  0
         getStateHelper().put(PropertyKeys.onkeydown, onkeydown ); 
 352  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONKEYDOWN_PROP);
 353  0
     }
 354  
     // Property: onkeypress
 355  
 
 356  
     public String getOnkeypress()
 357  
     {
 358  0
         return (String) getStateHelper().eval(PropertyKeys.onkeypress);
 359  
     }
 360  
     
 361  
     public void setOnkeypress(String onkeypress)
 362  
     {
 363  0
         getStateHelper().put(PropertyKeys.onkeypress, onkeypress ); 
 364  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONKEYPRESS_PROP);
 365  0
     }
 366  
     // Property: onkeyup
 367  
 
 368  
     public String getOnkeyup()
 369  
     {
 370  0
         return (String) getStateHelper().eval(PropertyKeys.onkeyup);
 371  
     }
 372  
     
 373  
     public void setOnkeyup(String onkeyup)
 374  
     {
 375  0
         getStateHelper().put(PropertyKeys.onkeyup, onkeyup ); 
 376  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONKEYUP_PROP);
 377  0
     }
 378  
     // Property: onmousedown
 379  
 
 380  
     public String getOnmousedown()
 381  
     {
 382  0
         return (String) getStateHelper().eval(PropertyKeys.onmousedown);
 383  
     }
 384  
     
 385  
     public void setOnmousedown(String onmousedown)
 386  
     {
 387  0
         getStateHelper().put(PropertyKeys.onmousedown, onmousedown ); 
 388  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONMOUSEDOWN_PROP);
 389  0
     }
 390  
     // Property: onmousemove
 391  
 
 392  
     public String getOnmousemove()
 393  
     {
 394  0
         return (String) getStateHelper().eval(PropertyKeys.onmousemove);
 395  
     }
 396  
     
 397  
     public void setOnmousemove(String onmousemove)
 398  
     {
 399  0
         getStateHelper().put(PropertyKeys.onmousemove, onmousemove ); 
 400  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONMOUSEMOVE_PROP);
 401  0
     }
 402  
     // Property: onmouseout
 403  
 
 404  
     public String getOnmouseout()
 405  
     {
 406  0
         return (String) getStateHelper().eval(PropertyKeys.onmouseout);
 407  
     }
 408  
     
 409  
     public void setOnmouseout(String onmouseout)
 410  
     {
 411  0
         getStateHelper().put(PropertyKeys.onmouseout, onmouseout ); 
 412  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONMOUSEOUT_PROP);
 413  0
     }
 414  
     // Property: onmouseover
 415  
 
 416  
     public String getOnmouseover()
 417  
     {
 418  0
         return (String) getStateHelper().eval(PropertyKeys.onmouseover);
 419  
     }
 420  
     
 421  
     public void setOnmouseover(String onmouseover)
 422  
     {
 423  0
         getStateHelper().put(PropertyKeys.onmouseover, onmouseover ); 
 424  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONMOUSEOVER_PROP);
 425  0
     }
 426  
     // Property: onmouseup
 427  
 
 428  
     public String getOnmouseup()
 429  
     {
 430  0
         return (String) getStateHelper().eval(PropertyKeys.onmouseup);
 431  
     }
 432  
     
 433  
     public void setOnmouseup(String onmouseup)
 434  
     {
 435  0
         getStateHelper().put(PropertyKeys.onmouseup, onmouseup ); 
 436  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONMOUSEUP_PROP);
 437  0
     }
 438  
     // Property: onchange
 439  
 
 440  
     public String getOnchange()
 441  
     {
 442  0
         return (String) getStateHelper().eval(PropertyKeys.onchange);
 443  
     }
 444  
     
 445  
     public void setOnchange(String onchange)
 446  
     {
 447  0
         getStateHelper().put(PropertyKeys.onchange, onchange ); 
 448  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONCHANGE_PROP);
 449  0
     }
 450  
     // Property: onselect
 451  
 
 452  
     public String getOnselect()
 453  
     {
 454  0
         return (String) getStateHelper().eval(PropertyKeys.onselect);
 455  
     }
 456  
     
 457  
     public void setOnselect(String onselect)
 458  
     {
 459  0
         getStateHelper().put(PropertyKeys.onselect, onselect ); 
 460  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.ONSELECT_PROP);
 461  0
     }
 462  
     // Property: dir
 463  
 
 464  
     public String getDir()
 465  
     {
 466  0
         return (String) getStateHelper().eval(PropertyKeys.dir);
 467  
     }
 468  
     
 469  
     public void setDir(String dir)
 470  
     {
 471  0
         getStateHelper().put(PropertyKeys.dir, dir ); 
 472  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.DIR_PROP);
 473  0
     }
 474  
     // Property: lang
 475  
 
 476  
     public String getLang()
 477  
     {
 478  0
         return (String) getStateHelper().eval(PropertyKeys.lang);
 479  
     }
 480  
     
 481  
     public void setLang(String lang)
 482  
     {
 483  0
         getStateHelper().put(PropertyKeys.lang, lang ); 
 484  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.LANG_PROP);
 485  0
     }
 486  
     // Property: title
 487  
 
 488  
     public String getTitle()
 489  
     {
 490  0
         return (String) getStateHelper().eval(PropertyKeys.title);
 491  
     }
 492  
     
 493  
     public void setTitle(String title)
 494  
     {
 495  0
         getStateHelper().put(PropertyKeys.title, title ); 
 496  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.TITLE_PROP);
 497  0
     }
 498  
     // Property: disabled
 499  
 
 500  
     public boolean isDisabled()
 501  
     {
 502  0
         return (Boolean) getStateHelper().eval(PropertyKeys.disabled, false);
 503  
     }
 504  
     
 505  
     public void setDisabled(boolean disabled)
 506  
     {
 507  0
         getStateHelper().put(PropertyKeys.disabled, disabled ); 
 508  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.DISABLED_PROP);
 509  0
     }
 510  
     // Property: readonly
 511  
 
 512  
     public boolean isReadonly()
 513  
     {
 514  0
         return (Boolean) getStateHelper().eval(PropertyKeys.readonly, false);
 515  
     }
 516  
     
 517  
     public void setReadonly(boolean readonly)
 518  
     {
 519  0
         getStateHelper().put(PropertyKeys.readonly, readonly ); 
 520  0
         _CommonPropertyConstants.markProperty(this, _CommonPropertyConstants.READONLY_PROP);
 521  0
     }
 522  
 
 523  
     public void setValueBinding(String name, ValueBinding binding)
 524  
     {
 525  0
         super.setValueBinding(name, binding);
 526  0
         _CommonPropertyConstants.markProperty(this, name);
 527  0
     }
 528  
 
 529  
     public void setValueExpression(String name, ValueExpression expression)
 530  
     {
 531  0
         super.setValueExpression(name, expression);
 532  0
         _CommonPropertyConstants.markProperty(this, name);
 533  0
     }
 534  
 
 535  0
     protected enum PropertyKeys
 536  
     {
 537  0
          maxlength
 538  0
         , size
 539  0
         , autocomplete
 540  0
         , label
 541  0
         , style
 542  0
         , styleClass
 543  0
         , alt
 544  0
         , tabindex
 545  0
         , onblur
 546  0
         , onfocus
 547  0
         , accesskey
 548  0
         , role
 549  0
         , onclick
 550  0
         , ondblclick
 551  0
         , onkeydown
 552  0
         , onkeypress
 553  0
         , onkeyup
 554  0
         , onmousedown
 555  0
         , onmousemove
 556  0
         , onmouseout
 557  0
         , onmouseover
 558  0
         , onmouseup
 559  0
         , onchange
 560  0
         , onselect
 561  0
         , dir
 562  0
         , lang
 563  0
         , title
 564  0
         , disabled
 565  0
         , readonly
 566  
     }
 567  
 
 568  
  }