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