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