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.UIOutput;
025:
026: /**
027: * @version CVS $Id: OutputLabelTag.java 433543 2006-08-22 06:22:54Z crossley $
028: */
029: public class OutputLabelTag extends UIComponentTag {
030:
031: private String converter;
032: private String value;
033: private String accesskey;
034: private String dir;
035: private String _for;
036: private String lang;
037: private String onblur;
038: private String onclick;
039: private String ondblclick;
040: private String onfocus;
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 tabindex;
052: private String title;
053:
054: public void setConverter(String converter) {
055: this .converter = converter;
056: }
057:
058: public void setValue(String value) {
059: this .value = value;
060: }
061:
062: public void setAccesskey(String accesskey) {
063: this .accesskey = accesskey;
064: }
065:
066: public void setDir(String dir) {
067: this .dir = dir;
068: }
069:
070: public void setFor(String _for) {
071: this ._for = _for;
072: }
073:
074: public void setLang(String lang) {
075: this .lang = lang;
076: }
077:
078: public void setOnblur(String onblur) {
079: this .onblur = onblur;
080: }
081:
082: public void setOnclick(String onclick) {
083: this .onclick = onclick;
084: }
085:
086: public void setOndblclick(String ondblclick) {
087: this .ondblclick = ondblclick;
088: }
089:
090: public void setOnfocus(String onfocus) {
091: this .onfocus = onfocus;
092: }
093:
094: public void setOnkeydown(String onkeydown) {
095: this .onkeydown = onkeydown;
096: }
097:
098: public void setOnkeypress(String onkeypress) {
099: this .onkeypress = onkeypress;
100: }
101:
102: public void setOnkeyup(String onkeyup) {
103: this .onkeyup = onkeyup;
104: }
105:
106: public void setOnmousedown(String onmousedown) {
107: this .onmousedown = onmousedown;
108: }
109:
110: public void setOnmousemove(String onmousemove) {
111: this .onmousemove = onmousemove;
112: }
113:
114: public void setOnmouseout(String onmouseout) {
115: this .onmouseout = onmouseout;
116: }
117:
118: public void setOnmouseover(String onmouseover) {
119: this .onmouseover = onmouseover;
120: }
121:
122: public void setOnmouseup(String onmouseup) {
123: this .onmouseup = onmouseup;
124: }
125:
126: public void setStyle(String style) {
127: this .style = style;
128: }
129:
130: public void setStyleClass(String styleClass) {
131: this .styleClass = styleClass;
132: }
133:
134: public void setTabindex(String tabindex) {
135: this .tabindex = tabindex;
136: }
137:
138: public void setTitle(String title) {
139: this .title = title;
140: }
141:
142: public String getRendererType() {
143: return "javax.faces.Text";
144: }
145:
146: public String getComponentType() {
147: return "javax.faces.HtmlOutputText";
148: }
149:
150: protected void setProperties(UIComponent component) {
151: super .setProperties(component);
152:
153: UIOutput output;
154: try {
155: output = (UIOutput) component;
156: } catch (ClassCastException cce) {
157: throw new FacesException("Tag <" + getClass().getName()
158: + "> expected UIOutput. " + "Got <"
159: + component.getClass().getName() + ">");
160: }
161:
162: if (converter != null) {
163: if (FacesUtils.isExpression(converter)) {
164: output.setValueBinding("converter",
165: createValueBinding(converter));
166: } else {
167: output.setConverter(getApplication().createConverter(
168: converter));
169: }
170: }
171:
172: if (value != null) {
173: if (FacesUtils.isExpression(value)) {
174: output.setValueBinding("value",
175: createValueBinding(value));
176: } else {
177: output.setValue(value);
178: }
179: }
180:
181: setProperty(component, "accesskey", accesskey);
182: setProperty(component, "dir", dir);
183: // FIXME: Should it be __for?
184: setProperty(component, "for", _for);
185: setProperty(component, "lang", lang);
186: setProperty(component, "onblur", onblur);
187: setProperty(component, "onclick", onclick);
188: setProperty(component, "ondblclick", ondblclick);
189: setProperty(component, "onfocus", onfocus);
190: setProperty(component, "onkeydown", onkeydown);
191: setProperty(component, "onkeypress", onkeypress);
192: setProperty(component, "onkeyup", onkeyup);
193: setProperty(component, "onmousedown", onmousedown);
194: setProperty(component, "onmousemove", onmousemove);
195: setProperty(component, "onmouseout", onmouseout);
196: setProperty(component, "onmouseover", onmouseover);
197: setProperty(component, "onmouseup", onmouseup);
198:
199: setProperty(component, "style", style);
200: setProperty(component, "styleClass", styleClass);
201: setProperty(component, "tabindex", tabindex);
202: setProperty(component, "title", title);
203: }
204:
205: public void recycle() {
206: super.recycle();
207: converter = null;
208: value = null;
209: accesskey = null;
210: dir = null;
211: _for = null;
212: lang = null;
213: onblur = null;
214: onclick = null;
215: ondblclick = null;
216: onfocus = null;
217: onkeydown = null;
218: onkeypress = null;
219: onkeyup = null;
220: onmousedown = null;
221: onmousemove = null;
222: onmouseout = null;
223: onmouseover = null;
224: onmouseup = null;
225: style = null;
226: styleClass = null;
227: tabindex = null;
228: title = null;
229: }
230: }
|