KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > faces > taglib > html > OutputLabelTag


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
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, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

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.UIOutput;
24
25 /**
26  * @version CVS $Id: OutputLabelTag.java 46253 2004-09-17 14:36:29Z vgritsenko $
27  */

28 public class OutputLabelTag extends UIComponentTag {
29
30     private String JavaDoc converter;
31     private String JavaDoc value;
32     private String JavaDoc accesskey;
33     private String JavaDoc dir;
34     private String JavaDoc _for;
35     private String JavaDoc lang;
36     private String JavaDoc onblur;
37     private String JavaDoc onclick;
38     private String JavaDoc ondblclick;
39     private String JavaDoc onfocus;
40     private String JavaDoc onkeydown;
41     private String JavaDoc onkeypress;
42     private String JavaDoc onkeyup;
43     private String JavaDoc onmousedown;
44     private String JavaDoc onmousemove;
45     private String JavaDoc onmouseout;
46     private String JavaDoc onmouseover;
47     private String JavaDoc onmouseup;
48     private String JavaDoc style;
49     private String JavaDoc styleClass;
50     private String JavaDoc tabindex;
51     private String JavaDoc title;
52
53
54     public void setConverter(String JavaDoc converter) {
55         this.converter = converter;
56     }
57
58     public void setValue(String JavaDoc value) {
59         this.value = value;
60     }
61
62     public void setAccesskey(String JavaDoc accesskey) {
63         this.accesskey = accesskey;
64     }
65
66     public void setDir(String JavaDoc dir) {
67         this.dir = dir;
68     }
69
70     public void setFor(String JavaDoc _for) {
71         this._for = _for;
72     }
73     public void setLang(String JavaDoc lang) {
74         this.lang = lang;
75     }
76
77     public void setOnblur(String JavaDoc onblur) {
78         this.onblur = onblur;
79     }
80
81     public void setOnclick(String JavaDoc onclick) {
82         this.onclick = onclick;
83     }
84
85     public void setOndblclick(String JavaDoc ondblclick) {
86         this.ondblclick = ondblclick;
87     }
88
89     public void setOnfocus(String JavaDoc onfocus) {
90         this.onfocus = onfocus;
91     }
92
93     public void setOnkeydown(String JavaDoc onkeydown) {
94         this.onkeydown = onkeydown;
95     }
96
97     public void setOnkeypress(String JavaDoc onkeypress) {
98         this.onkeypress = onkeypress;
99     }
100
101     public void setOnkeyup(String JavaDoc onkeyup) {
102         this.onkeyup = onkeyup;
103     }
104
105     public void setOnmousedown(String JavaDoc onmousedown) {
106         this.onmousedown = onmousedown;
107     }
108
109     public void setOnmousemove(String JavaDoc onmousemove) {
110         this.onmousemove = onmousemove;
111     }
112
113     public void setOnmouseout(String JavaDoc onmouseout) {
114         this.onmouseout = onmouseout;
115     }
116
117     public void setOnmouseover(String JavaDoc onmouseover) {
118         this.onmouseover = onmouseover;
119     }
120
121     public void setOnmouseup(String JavaDoc onmouseup) {
122         this.onmouseup = onmouseup;
123     }
124
125     public void setStyle(String JavaDoc style) {
126         this.style = style;
127     }
128
129     public void setStyleClass(String JavaDoc styleClass) {
130         this.styleClass = styleClass;
131     }
132
133     public void setTabindex(String JavaDoc tabindex) {
134         this.tabindex = tabindex;
135     }
136
137     public void setTitle(String JavaDoc title) {
138         this.title = title;
139     }
140
141
142     public String JavaDoc getRendererType() {
143         return "javax.faces.Text";
144     }
145
146     public String JavaDoc getComponentType() {
147         return "javax.faces.HtmlOutputText";
148     }
149
150
151     protected void setProperties(UIComponent component) {
152         super.setProperties(component);
153
154         UIOutput output;
155         try {
156             output = (UIOutput) component;
157         } catch (ClassCastException JavaDoc cce) {
158             throw new FacesException("Tag <" + getClass().getName() + "> expected UIOutput. " +
159                                      "Got <" + component.getClass().getName() + ">");
160         }
161
162         if (converter != null) {
163             if (FacesUtils.isExpression(converter)) {
164                 output.setValueBinding("converter", createValueBinding(converter));
165             } else {
166                 output.setConverter(getApplication().createConverter(converter));
167             }
168         }
169
170         if (value != null) {
171             if (FacesUtils.isExpression(value)) {
172                 output.setValueBinding("value", createValueBinding(value));
173             } else {
174                 output.setValue(value);
175             }
176         }
177
178         setProperty(component, "accesskey", accesskey);
179         setProperty(component, "dir", dir);
180         // FIXME: Should it be __for?
181
setProperty(component, "for", _for);
182         setProperty(component, "lang", lang);
183         setProperty(component, "onblur", onblur);
184         setProperty(component, "onclick", onclick);
185         setProperty(component, "ondblclick", ondblclick);
186         setProperty(component, "onfocus", onfocus);
187         setProperty(component, "onkeydown", onkeydown);
188         setProperty(component, "onkeypress", onkeypress);
189         setProperty(component, "onkeyup", onkeyup);
190         setProperty(component, "onmousedown", onmousedown);
191         setProperty(component, "onmousemove", onmousemove);
192         setProperty(component, "onmouseout", onmouseout);
193         setProperty(component, "onmouseover", onmouseover);
194         setProperty(component, "onmouseup", onmouseup);
195
196         setProperty(component, "style", style);
197         setProperty(component, "styleClass", styleClass);
198         setProperty(component, "tabindex", tabindex);
199         setProperty(component, "title", title);
200     }
201
202     public void recycle() {
203         super.recycle();
204         converter = null;
205         value = null;
206         accesskey = null;
207         dir = null;
208         _for = null;
209         lang = null;
210         onblur = null;
211         onclick = null;
212         ondblclick = null;
213         onfocus = null;
214         onkeydown = null;
215         onkeypress = null;
216         onkeyup = null;
217         onmousedown = null;
218         onmousemove = null;
219         onmouseout = null;
220         onmouseover = null;
221         onmouseup = null;
222         style = null;
223         styleClass = null;
224         tabindex = null;
225         title = null;
226     }
227 }
228
Popular Tags