KickJava   Java API By Example, From Geeks To Geeks.

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


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.taglib.UIComponentTag;
19 import org.apache.cocoon.faces.FacesUtils;
20
21 import javax.faces.component.UIComponent;
22 import javax.faces.component.UIData;
23 import javax.faces.FacesException;
24
25 /**
26  * @version CVS $Id: DataTableTag.java 54865 2004-10-15 19:37:03Z vgritsenko $
27  */

28 public class DataTableTag extends UIComponentTag {
29
30     private String JavaDoc first;
31     private String JavaDoc rows;
32     private String JavaDoc value;
33     private String JavaDoc var;
34     private String JavaDoc bgcolor;
35     private String JavaDoc border;
36     private String JavaDoc cellpadding;
37     private String JavaDoc cellspacing;
38     private String JavaDoc columnClasses;
39     private String JavaDoc dir;
40     private String JavaDoc footerClass;
41     private String JavaDoc frame;
42     private String JavaDoc headerClass;
43     private String JavaDoc lang;
44     private String JavaDoc onclick;
45     private String JavaDoc ondblclick;
46     private String JavaDoc onkeydown;
47     private String JavaDoc onkeypress;
48     private String JavaDoc onkeyup;
49     private String JavaDoc onmousedown;
50     private String JavaDoc onmousemove;
51     private String JavaDoc onmouseout;
52     private String JavaDoc onmouseover;
53     private String JavaDoc onmouseup;
54     private String JavaDoc rowClasses;
55     private String JavaDoc rules;
56     private String JavaDoc style;
57     private String JavaDoc styleClass;
58     private String JavaDoc summary;
59     private String JavaDoc title;
60     private String JavaDoc width;
61
62
63     public void setFirst(String JavaDoc first) {
64         this.first = first;
65     }
66
67     public void setRows(String JavaDoc rows) {
68         this.rows = rows;
69     }
70
71     public void setValue(String JavaDoc value) {
72         this.value = value;
73     }
74
75     public void setVar(String JavaDoc var) {
76         this.var = var;
77     }
78
79     public void setBgcolor(String JavaDoc bgcolor) {
80         this.bgcolor = bgcolor;
81     }
82
83     public void setBorder(String JavaDoc border) {
84         this.border = border;
85     }
86
87     public void setCellpadding(String JavaDoc cellpadding) {
88         this.cellpadding = cellpadding;
89     }
90
91     public void setCellspacing(String JavaDoc cellspacing) {
92         this.cellspacing = cellspacing;
93     }
94
95     public void setColumnClasses(String JavaDoc columnClasses) {
96         this.columnClasses = columnClasses;
97     }
98
99     public void setDir(String JavaDoc dir) {
100         this.dir = dir;
101     }
102
103     public void setFooterClass(String JavaDoc footerClass) {
104         this.footerClass = footerClass;
105     }
106
107     public void setFrame(String JavaDoc frame) {
108         this.frame = frame;
109     }
110
111     public void setHeaderClass(String JavaDoc headerClass) {
112         this.headerClass = headerClass;
113     }
114
115     public void setLang(String JavaDoc lang) {
116         this.lang = lang;
117     }
118
119     public void setOnclick(String JavaDoc onclick) {
120         this.onclick = onclick;
121     }
122
123     public void setOndblclick(String JavaDoc ondblclick) {
124         this.ondblclick = ondblclick;
125     }
126
127     public void setOnkeydown(String JavaDoc onkeydown) {
128         this.onkeydown = onkeydown;
129     }
130
131     public void setOnkeypress(String JavaDoc onkeypress) {
132         this.onkeypress = onkeypress;
133     }
134
135     public void setOnkeyup(String JavaDoc onkeyup) {
136         this.onkeyup = onkeyup;
137     }
138
139     public void setOnmousedown(String JavaDoc onmousedown) {
140         this.onmousedown = onmousedown;
141     }
142
143     public void setOnmousemove(String JavaDoc onmousemove) {
144         this.onmousemove = onmousemove;
145     }
146
147     public void setOnmouseout(String JavaDoc onmouseout) {
148         this.onmouseout = onmouseout;
149     }
150
151     public void setOnmouseover(String JavaDoc onmouseover) {
152         this.onmouseover = onmouseover;
153     }
154
155     public void setOnmouseup(String JavaDoc onmouseup) {
156         this.onmouseup = onmouseup;
157     }
158
159     public void setRowClasses(String JavaDoc rowClasses) {
160         this.rowClasses = rowClasses;
161     }
162
163     public void setRules(String JavaDoc rules) {
164         this.rules = rules;
165     }
166
167     public void setStyle(String JavaDoc style) {
168         this.style = style;
169     }
170
171     public void setStyleClass(String JavaDoc styleClass) {
172         this.styleClass = styleClass;
173     }
174
175     public void setSummary(String JavaDoc summary) {
176         this.summary = summary;
177     }
178
179     public void setTitle(String JavaDoc title) {
180         this.title = title;
181     }
182
183     public void setWidth(String JavaDoc width) {
184         this.width = width;
185     }
186
187
188     public String JavaDoc getRendererType() {
189         return "javax.faces.Table";
190     }
191
192     public String JavaDoc getComponentType() {
193         return "javax.faces.HtmlDataTable";
194     }
195
196
197     protected void setProperties(UIComponent component) {
198         super.setProperties(component);
199
200         UIData data;
201         try {
202             data = (UIData) component;
203         } catch (ClassCastException JavaDoc cce) {
204             throw new FacesException("Tag <" + getClass().getName() + "> expected UIData. " +
205                                      "Got <" + component.getClass().getName() + ">");
206         }
207
208         if (first != null) {
209             if (FacesUtils.isExpression(first)) {
210                 data.setValueBinding("first", createValueBinding(first));
211             } else {
212                 data.setFirst(Integer.parseInt(first));
213             }
214         }
215
216         if (rows != null) {
217             if (FacesUtils.isExpression(rows)) {
218                 data.setValueBinding("rows", createValueBinding(rows));
219             } else {
220                 data.setRows(Integer.parseInt(rows));
221             }
222         }
223
224         if (value != null) {
225             if (FacesUtils.isExpression(value)) {
226                 data.setValueBinding("value", createValueBinding(value));
227             } else {
228                 data.setValue(value);
229             }
230         }
231
232         data.setVar(var);
233
234         setProperty(component, "bgcolor", bgcolor);
235
236         setIntegerProperty(component, "border", border);
237
238         setProperty(component, "cellpadding", cellpadding);
239         setProperty(component, "cellspacing", cellspacing);
240         setProperty(component, "columnClasses", columnClasses);
241         setProperty(component, "dir", dir);
242         setProperty(component, "footerClass", footerClass);
243         setProperty(component, "frame", frame);
244         setProperty(component, "headerClass", headerClass);
245         setProperty(component, "lang", lang);
246
247         setProperty(component, "onclick", onclick);
248         setProperty(component, "ondblclick", ondblclick);
249         setProperty(component, "onkeydown", onkeydown);
250         setProperty(component, "onkeypress", onkeypress);
251         setProperty(component, "onkeyup", onkeyup);
252         setProperty(component, "onmousedown", onmousedown);
253         setProperty(component, "onmousemove", onmousemove);
254         setProperty(component, "onmouseout", onmouseout);
255         setProperty(component, "onmouseover", onmouseover);
256         setProperty(component, "onmouseup", onmouseup);
257
258         setProperty(component, "rowClasses", rowClasses);
259         setProperty(component, "rules", rules);
260         setProperty(component, "style", style);
261         setProperty(component, "styleClass", styleClass);
262         setProperty(component, "summary", summary);
263         setProperty(component, "title", title);
264         setProperty(component, "width", width);
265     }
266
267     public void recycle() {
268         super.recycle();
269         first = null;
270         rows = null;
271         value = null;
272         var = null;
273         bgcolor = null;
274         border = null;
275         cellpadding = null;
276         cellspacing = null;
277         columnClasses = null;
278         dir = null;
279         footerClass = null;
280         frame = null;
281         headerClass = null;
282         lang = null;
283         onclick = null;
284         ondblclick = null;
285         onkeydown = null;
286         onkeypress = null;
287         onkeyup = null;
288         onmousedown = null;
289         onmousemove = null;
290         onmouseout = null;
291         onmouseover = null;
292         onmouseup = null;
293         rowClasses = null;
294         rules = null;
295         style = null;
296         styleClass = null;
297         summary = null;
298         title = null;
299         width = null;
300     }
301 }
302
Popular Tags