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