001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.cocoon.faces.taglib.html;
018:
019: import org.apache.cocoon.faces.FacesUtils;
020: import org.apache.cocoon.faces.taglib.UIComponentTag;
021:
022: import javax.faces.FacesException;
023: import javax.faces.component.UIComponent;
024: import javax.faces.component.UIGraphic;
025:
026: /**
027: * @version CVS $Id: GraphicImageTag.java 433543 2006-08-22 06:22:54Z crossley $
028: */
029: public class GraphicImageTag extends UIComponentTag {
030:
031: private String url;
032: private String value;
033: private String alt;
034: private String dir;
035: private String height;
036: private String ismap;
037: private String lang;
038: private String longdesc;
039: private String onclick;
040: private String ondblclick;
041: private String onkeydown;
042: private String onkeypress;
043: private String onkeyup;
044: private String onmousedown;
045: private String onmousemove;
046: private String onmouseout;
047: private String onmouseover;
048: private String onmouseup;
049: private String style;
050: private String styleClass;
051: private String title;
052: private String usemap;
053: private String width;
054:
055: public void setUrl(String url) {
056: this .url = url;
057: }
058:
059: public void setValue(String value) {
060: this .value = value;
061: }
062:
063: public void setAlt(String alt) {
064: this .alt = alt;
065: }
066:
067: public void setDir(String dir) {
068: this .dir = dir;
069: }
070:
071: public void setHeight(String height) {
072: this .height = height;
073: }
074:
075: public void setIsmap(String ismap) {
076: this .ismap = ismap;
077: }
078:
079: public void setLang(String lang) {
080: this .lang = lang;
081: }
082:
083: public void setLongdesc(String longdesc) {
084: this .longdesc = longdesc;
085: }
086:
087: public void setOnclick(String onclick) {
088: this .onclick = onclick;
089: }
090:
091: public void setOndblclick(String ondblclick) {
092: this .ondblclick = ondblclick;
093: }
094:
095: public void setOnkeydown(String onkeydown) {
096: this .onkeydown = onkeydown;
097: }
098:
099: 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: public String getRendererType() {
148: return "javax.faces.Image";
149: }
150:
151: public String getComponentType() {
152: return "javax.faces.HtmlGraphicImage";
153: }
154:
155: protected void setProperties(UIComponent component) {
156: super .setProperties(component);
157:
158: UIGraphic graphic = null;
159: try {
160: graphic = (UIGraphic) component;
161: } catch (ClassCastException cce) {
162: throw new FacesException("Tag <" + getClass().getName()
163: + "> expected UIGraphic. " + "Got <"
164: + component.getClass().getName() + ">");
165: }
166:
167: if (url != null) {
168: if (FacesUtils.isExpression(url)) {
169: graphic.setValueBinding("url", createValueBinding(url));
170: } else {
171: graphic.setUrl(url);
172: }
173: }
174:
175: if (value != null) {
176: if (FacesUtils.isExpression(value)) {
177: graphic.setValueBinding("value",
178: 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: }
|