Coverage Report - javax.faces.component.html.HtmlInputText
 
Classes in this File Line Coverage Branch Coverage Complexity
HtmlInputText
100%
240/240
100%
72/72
1.949
 
 1  
 /*
 2  
  * Copyright 2004-2011 the Seasar Foundation and the Others.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 13  
  * either express or implied. See the License for the specific language
 14  
  * governing permissions and limitations under the License.
 15  
  */
 16  
 package javax.faces.component.html;
 17  
 
 18  
 import javax.faces.component.ComponentUtil_;
 19  
 import javax.faces.component.UIInput;
 20  
 import javax.faces.context.FacesContext;
 21  
 import javax.faces.el.ValueBinding;
 22  
 import javax.faces.internal.UIDefaultAttribute;
 23  
 
 24  
 import org.seasar.teeda.core.JsfConstants;
 25  
 
 26  
 /**
 27  
  * @author shot
 28  
  */
 29  
 public class HtmlInputText extends UIInput {
 30  
 
 31  
     public static final String COMPONENT_TYPE = "javax.faces.HtmlInputText";
 32  
 
 33  
     private static final String DEFAULT_RENDERER_TYPE = "javax.faces.Text";
 34  
 
 35  
     private static final boolean DEFAULT_DISABLED = UIDefaultAttribute.DEFAULT_BOOLEAN;
 36  
 
 37  
     private static final int DEFAULT_MAXLENGTH = UIDefaultAttribute.DEFAULT_INT;
 38  
 
 39  
     private static final boolean DEFAULT_READONLY = UIDefaultAttribute.DEFAULT_BOOLEAN;
 40  
 
 41  
     private static final int DEFAULT_SIZE = UIDefaultAttribute.DEFAULT_INT;
 42  
 
 43  211
     private String accesskey = null;
 44  
 
 45  211
     private String alt = null;
 46  
 
 47  211
     private String dir = null;
 48  
 
 49  211
     private Boolean disabled = null;
 50  
 
 51  211
     private String lang = null;
 52  
 
 53  211
     private Integer maxlength = null;
 54  
 
 55  211
     private String onblur = null;
 56  
 
 57  211
     private String onchange = null;
 58  
 
 59  211
     private String onclick = null;
 60  
 
 61  211
     private String ondblclick = null;
 62  
 
 63  211
     private String onfocus = null;
 64  
 
 65  211
     private String onkeydown = null;
 66  
 
 67  211
     private String onkeypress = null;
 68  
 
 69  211
     private String onkeyup = null;
 70  
 
 71  211
     private String onmousedown = null;
 72  
 
 73  211
     private String onmousemove = null;
 74  
 
 75  211
     private String onmouseout = null;
 76  
 
 77  211
     private String onmouseover = null;
 78  
 
 79  211
     private String onmouseup = null;
 80  
 
 81  211
     private String onselect = null;
 82  
 
 83  211
     private Boolean readonly = null;
 84  
 
 85  211
     private Integer size = null;
 86  
 
 87  211
     private String style = null;
 88  
 
 89  211
     private String styleClass = null;
 90  
 
 91  211
     private String tabindex = null;
 92  
 
 93  211
     private String title = null;
 94  
 
 95  211
     private String label = null;
 96  
 
 97  
     private String autocomplete;
 98  
 
 99  211
     public HtmlInputText() {
 100  211
         setRendererType(DEFAULT_RENDERER_TYPE);
 101  211
     }
 102  
 
 103  
     public void setAccesskey(String accesskey) {
 104  3
         this.accesskey = accesskey;
 105  3
     }
 106  
 
 107  
     public String getAccesskey() {
 108  12
         if (accesskey != null) {
 109  3
             return accesskey;
 110  
         }
 111  9
         return ComponentUtil_.getValueBindingValueAsString(this,
 112  
                 JsfConstants.ACCESSKEY_ATTR);
 113  
     }
 114  
 
 115  
     public void setAlt(String alt) {
 116  4
         this.alt = alt;
 117  4
     }
 118  
 
 119  
     public String getAlt() {
 120  12
         if (alt != null) {
 121  3
             return alt;
 122  
         }
 123  9
         return ComponentUtil_.getValueBindingValueAsString(this,
 124  
                 JsfConstants.ALT_ATTR);
 125  
     }
 126  
 
 127  
     public void setDir(String dir) {
 128  3
         this.dir = dir;
 129  3
     }
 130  
 
 131  
     public String getDir() {
 132  12
         if (dir != null) {
 133  3
             return dir;
 134  
         }
 135  9
         return ComponentUtil_.getValueBindingValueAsString(this,
 136  
                 JsfConstants.DIR_ATTR);
 137  
     }
 138  
 
 139  
     public void setDisabled(boolean disabled) {
 140  6
         this.disabled = Boolean.valueOf(disabled);
 141  6
     }
 142  
 
 143  
     public boolean isDisabled() {
 144  16
         if (disabled != null) {
 145  6
             return disabled.booleanValue();
 146  
         }
 147  10
         ValueBinding vb = getValueBinding(JsfConstants.DISABLED_ATTR);
 148  10
         Boolean v = vb != null ? (Boolean) vb.getValue(getFacesContext())
 149  
                 : null;
 150  10
         return v != null ? v.booleanValue() : DEFAULT_DISABLED;
 151  
     }
 152  
 
 153  
     public void setLang(String lang) {
 154  3
         this.lang = lang;
 155  3
     }
 156  
 
 157  
     public String getLang() {
 158  12
         if (lang != null) {
 159  3
             return lang;
 160  
         }
 161  9
         return ComponentUtil_.getValueBindingValueAsString(this,
 162  
                 JsfConstants.LANG_ATTR);
 163  
     }
 164  
 
 165  
     public void setMaxlength(int maxlength) {
 166  4
         this.maxlength = new Integer(maxlength);
 167  4
     }
 168  
 
 169  
     public int getMaxlength() {
 170  12
         if (maxlength != null) {
 171  3
             return maxlength.intValue();
 172  
         }
 173  9
         ValueBinding vb = getValueBinding(JsfConstants.MAXLENGTH_ATTR);
 174  9
         Integer v = vb != null ? (Integer) vb.getValue(getFacesContext())
 175  
                 : null;
 176  9
         return v != null ? v.intValue() : DEFAULT_MAXLENGTH;
 177  
     }
 178  
 
 179  
     public void setOnblur(String onblur) {
 180  4
         this.onblur = onblur;
 181  4
     }
 182  
 
 183  
     public String getOnblur() {
 184  14
         if (onblur != null) {
 185  4
             return onblur;
 186  
         }
 187  10
         return ComponentUtil_.getValueBindingValueAsString(this,
 188  
                 JsfConstants.ONBLUR_ATTR);
 189  
     }
 190  
 
 191  
     public void setOnchange(String onchange) {
 192  4
         this.onchange = onchange;
 193  4
     }
 194  
 
 195  
     public String getOnchange() {
 196  12
         if (onchange != null) {
 197  3
             return onchange;
 198  
         }
 199  9
         return ComponentUtil_.getValueBindingValueAsString(this,
 200  
                 JsfConstants.ONCHANGE_ATTR);
 201  
     }
 202  
 
 203  
     public void setOnclick(String onclick) {
 204  3
         this.onclick = onclick;
 205  3
     }
 206  
 
 207  
     public String getOnclick() {
 208  12
         if (onclick != null) {
 209  3
             return onclick;
 210  
         }
 211  9
         return ComponentUtil_.getValueBindingValueAsString(this,
 212  
                 JsfConstants.ONCLICK_ATTR);
 213  
     }
 214  
 
 215  
     public void setOndblclick(String ondblclick) {
 216  3
         this.ondblclick = ondblclick;
 217  3
     }
 218  
 
 219  
     public String getOndblclick() {
 220  12
         if (ondblclick != null) {
 221  3
             return ondblclick;
 222  
         }
 223  9
         return ComponentUtil_.getValueBindingValueAsString(this,
 224  
                 JsfConstants.ONDBLCLICK_ATTR);
 225  
     }
 226  
 
 227  
     public void setOnfocus(String onfocus) {
 228  3
         this.onfocus = onfocus;
 229  3
     }
 230  
 
 231  
     public String getOnfocus() {
 232  12
         if (onfocus != null) {
 233  3
             return onfocus;
 234  
         }
 235  9
         return ComponentUtil_.getValueBindingValueAsString(this,
 236  
                 JsfConstants.ONFOCUS_ATTR);
 237  
     }
 238  
 
 239  
     public void setOnkeydown(String onkeydown) {
 240  3
         this.onkeydown = onkeydown;
 241  3
     }
 242  
 
 243  
     public String getOnkeydown() {
 244  12
         if (onkeydown != null) {
 245  3
             return onkeydown;
 246  
         }
 247  9
         return ComponentUtil_.getValueBindingValueAsString(this,
 248  
                 JsfConstants.ONKEYDOWN_ATTR);
 249  
     }
 250  
 
 251  
     public void setOnkeypress(String onkeypress) {
 252  3
         this.onkeypress = onkeypress;
 253  3
     }
 254  
 
 255  
     public String getOnkeypress() {
 256  12
         if (onkeypress != null) {
 257  3
             return onkeypress;
 258  
         }
 259  9
         return ComponentUtil_.getValueBindingValueAsString(this,
 260  
                 JsfConstants.ONKEYPRESS_ATTR);
 261  
     }
 262  
 
 263  
     public void setOnkeyup(String onkeyup) {
 264  3
         this.onkeyup = onkeyup;
 265  3
     }
 266  
 
 267  
     public String getOnkeyup() {
 268  12
         if (onkeyup != null) {
 269  3
             return onkeyup;
 270  
         }
 271  9
         return ComponentUtil_.getValueBindingValueAsString(this,
 272  
                 JsfConstants.ONKEYUP_ATTR);
 273  
     }
 274  
 
 275  
     public void setOnmousedown(String onmousedown) {
 276  3
         this.onmousedown = onmousedown;
 277  3
     }
 278  
 
 279  
     public String getOnmousedown() {
 280  12
         if (onmousedown != null) {
 281  3
             return onmousedown;
 282  
         }
 283  9
         return ComponentUtil_.getValueBindingValueAsString(this,
 284  
                 JsfConstants.ONMOUSEDOWN_ATTR);
 285  
     }
 286  
 
 287  
     public void setOnmousemove(String onmousemove) {
 288  3
         this.onmousemove = onmousemove;
 289  3
     }
 290  
 
 291  
     public String getOnmousemove() {
 292  12
         if (onmousemove != null) {
 293  3
             return onmousemove;
 294  
         }
 295  9
         return ComponentUtil_.getValueBindingValueAsString(this,
 296  
                 JsfConstants.ONMOUSEMOVE_ATTR);
 297  
     }
 298  
 
 299  
     public void setOnmouseout(String onmouseout) {
 300  3
         this.onmouseout = onmouseout;
 301  3
     }
 302  
 
 303  
     public String getOnmouseout() {
 304  12
         if (onmouseout != null) {
 305  3
             return onmouseout;
 306  
         }
 307  9
         return ComponentUtil_.getValueBindingValueAsString(this,
 308  
                 JsfConstants.ONMOUSEOUT_ATTR);
 309  
     }
 310  
 
 311  
     public void setOnmouseover(String onmouseover) {
 312  3
         this.onmouseover = onmouseover;
 313  3
     }
 314  
 
 315  
     public String getOnmouseover() {
 316  12
         if (onmouseover != null) {
 317  3
             return onmouseover;
 318  
         }
 319  9
         return ComponentUtil_.getValueBindingValueAsString(this,
 320  
                 JsfConstants.ONMOUSEOVER_ATTR);
 321  
     }
 322  
 
 323  
     public void setOnmouseup(String onmouseup) {
 324  3
         this.onmouseup = onmouseup;
 325  3
     }
 326  
 
 327  
     public String getOnmouseup() {
 328  12
         if (onmouseup != null) {
 329  3
             return onmouseup;
 330  
         }
 331  9
         return ComponentUtil_.getValueBindingValueAsString(this,
 332  
                 JsfConstants.ONMOUSEUP_ATTR);
 333  
     }
 334  
 
 335  
     public void setOnselect(String onselect) {
 336  4
         this.onselect = onselect;
 337  4
     }
 338  
 
 339  
     public String getOnselect() {
 340  12
         if (onselect != null) {
 341  3
             return onselect;
 342  
         }
 343  9
         return ComponentUtil_.getValueBindingValueAsString(this,
 344  
                 JsfConstants.ONSELECT_ATTR);
 345  
     }
 346  
 
 347  
     public void setReadonly(boolean readonly) {
 348  5
         this.readonly = Boolean.valueOf(readonly);
 349  5
     }
 350  
 
 351  
     public boolean isReadonly() {
 352  14
         if (readonly != null) {
 353  4
             return readonly.booleanValue();
 354  
         }
 355  10
         ValueBinding vb = getValueBinding("readonly");
 356  10
         Boolean v = vb != null ? (Boolean) vb.getValue(getFacesContext())
 357  
                 : null;
 358  10
         return v != null ? v.booleanValue() : DEFAULT_READONLY;
 359  
     }
 360  
 
 361  
     public void setSize(int size) {
 362  5
         this.size = new Integer(size);
 363  5
     }
 364  
 
 365  
     public int getSize() {
 366  14
         if (size != null) {
 367  4
             return size.intValue();
 368  
         }
 369  10
         ValueBinding vb = getValueBinding("size");
 370  10
         Integer v = vb != null ? (Integer) vb.getValue(getFacesContext())
 371  
                 : null;
 372  10
         return v != null ? v.intValue() : DEFAULT_SIZE;
 373  
     }
 374  
 
 375  
     public void setStyle(String style) {
 376  3
         this.style = style;
 377  3
     }
 378  
 
 379  
     public String getStyle() {
 380  12
         if (style != null) {
 381  3
             return style;
 382  
         }
 383  9
         return ComponentUtil_.getValueBindingValueAsString(this,
 384  
                 JsfConstants.STYLE_ATTR);
 385  
     }
 386  
 
 387  
     public void setStyleClass(String styleClass) {
 388  3
         this.styleClass = styleClass;
 389  3
     }
 390  
 
 391  
     public String getStyleClass() {
 392  12
         if (styleClass != null) {
 393  3
             return styleClass;
 394  
         }
 395  9
         return ComponentUtil_.getValueBindingValueAsString(this,
 396  
                 JsfConstants.STYLE_CLASS_ATTR);
 397  
     }
 398  
 
 399  
     public void setTabindex(String tabindex) {
 400  3
         this.tabindex = tabindex;
 401  3
     }
 402  
 
 403  
     public String getTabindex() {
 404  13
         if (tabindex != null) {
 405  3
             return tabindex;
 406  
         }
 407  10
         return ComponentUtil_.getValueBindingValueAsString(this,
 408  
                 JsfConstants.TABINDEX_ATTR);
 409  
     }
 410  
 
 411  
     public void setTitle(String title) {
 412  3
         this.title = title;
 413  3
     }
 414  
 
 415  
     public String getTitle() {
 416  13
         if (title != null) {
 417  3
             return title;
 418  
         }
 419  10
         return ComponentUtil_.getValueBindingValueAsString(this,
 420  
                 JsfConstants.TITLE_ATTR);
 421  
     }
 422  
 
 423  
     public void setLabel(String label) {
 424  8
         this.label = label;
 425  8
     }
 426  
 
 427  
     public String getLabel() {
 428  20
         if (label != null) {
 429  8
             return label;
 430  
         }
 431  12
         return ComponentUtil_.getValueBindingValueAsString(this,
 432  
                 JsfConstants.LABEL_ATTR);
 433  
     }
 434  
 
 435  
     public void setAutocomplete(String autocomplete) {
 436  2
         this.autocomplete = autocomplete;
 437  2
     }
 438  
 
 439  
     public String getAutocomplete() {
 440  10
         if (autocomplete != null) {
 441  2
             return autocomplete;
 442  
         }
 443  8
         return ComponentUtil_.getValueBindingValueAsString(this,
 444  
                 JsfConstants.AUTOCOMPLETE_ATTR);
 445  
     }
 446  
 
 447  
     public Object saveState(FacesContext context) {
 448  5
         Object values[] = new Object[29];
 449  5
         values[0] = super.saveState(context);
 450  5
         values[1] = accesskey;
 451  5
         values[2] = alt;
 452  5
         values[3] = dir;
 453  5
         values[4] = disabled;
 454  5
         values[5] = lang;
 455  5
         values[6] = maxlength;
 456  5
         values[7] = onblur;
 457  5
         values[8] = onchange;
 458  5
         values[9] = onclick;
 459  5
         values[10] = ondblclick;
 460  5
         values[11] = onfocus;
 461  5
         values[12] = onkeydown;
 462  5
         values[13] = onkeypress;
 463  5
         values[14] = onkeyup;
 464  5
         values[15] = onmousedown;
 465  5
         values[16] = onmousemove;
 466  5
         values[17] = onmouseout;
 467  5
         values[18] = onmouseover;
 468  5
         values[19] = onmouseup;
 469  5
         values[20] = onselect;
 470  5
         values[21] = readonly;
 471  5
         values[22] = size;
 472  5
         values[23] = style;
 473  5
         values[24] = styleClass;
 474  5
         values[25] = tabindex;
 475  5
         values[26] = title;
 476  5
         values[27] = label;
 477  5
         values[28] = autocomplete;
 478  5
         return ((Object) (values));
 479  
     }
 480  
 
 481  
     public void restoreState(FacesContext context, Object state) {
 482  4
         Object values[] = (Object[]) state;
 483  4
         super.restoreState(context, values[0]);
 484  4
         accesskey = (String) values[1];
 485  4
         alt = (String) values[2];
 486  4
         dir = (String) values[3];
 487  4
         disabled = (Boolean) values[4];
 488  4
         lang = (String) values[5];
 489  4
         maxlength = (Integer) values[6];
 490  4
         onblur = (String) values[7];
 491  4
         onchange = (String) values[8];
 492  4
         onclick = (String) values[9];
 493  4
         ondblclick = (String) values[10];
 494  4
         onfocus = (String) values[11];
 495  4
         onkeydown = (String) values[12];
 496  4
         onkeypress = (String) values[13];
 497  4
         onkeyup = (String) values[14];
 498  4
         onmousedown = (String) values[15];
 499  4
         onmousemove = (String) values[16];
 500  4
         onmouseout = (String) values[17];
 501  4
         onmouseover = (String) values[18];
 502  4
         onmouseup = (String) values[19];
 503  4
         onselect = (String) values[20];
 504  4
         readonly = (Boolean) values[21];
 505  4
         size = (Integer) values[22];
 506  4
         style = (String) values[23];
 507  4
         styleClass = (String) values[24];
 508  4
         tabindex = (String) values[25];
 509  4
         title = (String) values[26];
 510  4
         label = (String) values[27];
 511  4
         autocomplete = (String) values[28];
 512  4
     }
 513  
 
 514  
 }