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