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