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