1 16 package org.apache.cocoon.faces.taglib.html; 17 18 import org.apache.cocoon.faces.FacesUtils; 19 import org.apache.cocoon.faces.taglib.UIComponentTag; 20 21 import javax.faces.FacesException; 22 import javax.faces.component.UIComponent; 23 import javax.faces.component.UIGraphic; 24 25 28 public class GraphicImageTag extends UIComponentTag { 29 30 private String url; 31 private String value; 32 private String alt; 33 private String dir; 34 private String height; 35 private String ismap; 36 private String lang; 37 private String longdesc; 38 private String onclick; 39 private String ondblclick; 40 private String onkeydown; 41 private String onkeypress; 42 private String onkeyup; 43 private String onmousedown; 44 private String onmousemove; 45 private String onmouseout; 46 private String onmouseover; 47 private String onmouseup; 48 private String style; 49 private String styleClass; 50 private String title; 51 private String usemap; 52 private String width; 53 54 55 public void setUrl(String url) { 56 this.url = url; 57 } 58 59 public void setValue(String value) { 60 this.value = value; 61 } 62 63 public void setAlt(String alt) { 64 this.alt = alt; 65 } 66 67 public void setDir(String dir) { 68 this.dir = dir; 69 } 70 71 public void setHeight(String height) { 72 this.height = height; 73 } 74 75 public void setIsmap(String ismap) { 76 this.ismap = ismap; 77 } 78 79 public void setLang(String lang) { 80 this.lang = lang; 81 } 82 83 public void setLongdesc(String longdesc) { 84 this.longdesc = longdesc; 85 } 86 87 public void setOnclick(String onclick) { 88 this.onclick = onclick; 89 } 90 91 public void setOndblclick(String ondblclick) { 92 this.ondblclick = ondblclick; 93 } 94 95 public void setOnkeydown(String onkeydown) { 96 this.onkeydown = onkeydown; 97 } 98 99 public void setOnkeypress(String onkeypress) { 100 this.onkeypress = onkeypress; 101 } 102 103 public void setOnkeyup(String onkeyup) { 104 this.onkeyup = onkeyup; 105 } 106 107 public void setOnmousedown(String onmousedown) { 108 this.onmousedown = onmousedown; 109 } 110 111 public void setOnmousemove(String onmousemove) { 112 this.onmousemove = onmousemove; 113 } 114 115 public void setOnmouseout(String onmouseout) { 116 this.onmouseout = onmouseout; 117 } 118 119 public void setOnmouseover(String onmouseover) { 120 this.onmouseover = onmouseover; 121 } 122 123 public void setOnmouseup(String onmouseup) { 124 this.onmouseup = onmouseup; 125 } 126 127 public void setStyle(String style) { 128 this.style = style; 129 } 130 131 public void setStyleClass(String styleClass) { 132 this.styleClass = styleClass; 133 } 134 135 public void setTitle(String title) { 136 this.title = title; 137 } 138 139 public void setUsemap(String usemap) { 140 this.usemap = usemap; 141 } 142 143 public void setWidth(String width) { 144 this.width = width; 145 } 146 147 148 public String getRendererType() { 149 return "javax.faces.Image"; 150 } 151 152 public String getComponentType() { 153 return "javax.faces.HtmlGraphicImage"; 154 } 155 156 157 protected void setProperties(UIComponent component) { 158 super.setProperties(component); 159 160 UIGraphic graphic = null; 161 try { 162 graphic = (UIGraphic) component; 163 } catch (ClassCastException cce) { 164 throw new FacesException("Tag <" + getClass().getName() + "> expected UIGraphic. " + 165 "Got <" + component.getClass().getName() + ">"); 166 } 167 168 if (url != null) { 169 if (FacesUtils.isExpression(url)) { 170 graphic.setValueBinding("url", createValueBinding(url)); 171 } else { 172 graphic.setUrl(url); 173 } 174 } 175 176 if (value != null) { 177 if (FacesUtils.isExpression(value)) { 178 graphic.setValueBinding("value", createValueBinding(value)); 179 } else { 180 graphic.setValue(value); 181 } 182 } 183 184 setProperty(component, "alt", alt); 185 setProperty(component, "dir", dir); 186 setProperty(component, "height", height); 187 188 setBooleanProperty(component, "ismap", ismap); 189 190 setProperty(component, "lang", lang); 191 setProperty(component, "longdesc", longdesc); 192 setProperty(component, "onclick", onclick); 193 setProperty(component, "ondblclick", ondblclick); 194 setProperty(component, "onkeydown", onkeydown); 195 setProperty(component, "onkeypress", onkeypress); 196 setProperty(component, "onkeyup", onkeyup); 197 setProperty(component, "onmousedown", onmousedown); 198 setProperty(component, "onmousemove", onmousemove); 199 setProperty(component, "onmouseout", onmouseout); 200 setProperty(component, "onmouseover", onmouseover); 201 setProperty(component, "onmouseup", onmouseup); 202 203 setProperty(component, "style", style); 204 setProperty(component, "styleClass", styleClass); 205 setProperty(component, "title", title); 206 setProperty(component, "usemap", usemap); 207 setProperty(component, "width", width); 208 } 209 210 public void recycle() { 211 super.recycle(); 212 url = null; 213 value = null; 214 alt = null; 215 dir = null; 216 height = null; 217 ismap = null; 218 lang = null; 219 longdesc = null; 220 onclick = null; 221 ondblclick = null; 222 onkeydown = null; 223 onkeypress = null; 224 onkeyup = null; 225 onmousedown = null; 226 onmousemove = null; 227 onmouseout = null; 228 onmouseover = null; 229 onmouseup = null; 230 style = null; 231 styleClass = null; 232 title = null; 233 usemap = null; 234 width = null; 235 } 236 } 237 | Popular Tags |