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.taglib.UIComponentTag;
020: import org.apache.cocoon.faces.FacesUtils;
021:
022: import javax.faces.component.UIComponent;
023: import javax.faces.component.UIData;
024: import javax.faces.FacesException;
025:
026: /**
027: * @version CVS $Id: DataTableTag.java 433543 2006-08-22 06:22:54Z crossley $
028: */
029: public class DataTableTag extends UIComponentTag {
030:
031: private String first;
032: private String rows;
033: private String value;
034: private String var;
035: private String bgcolor;
036: private String border;
037: private String cellpadding;
038: private String cellspacing;
039: private String columnClasses;
040: private String dir;
041: private String footerClass;
042: private String frame;
043: private String headerClass;
044: private String lang;
045: private String onclick;
046: private String ondblclick;
047: private String onkeydown;
048: private String onkeypress;
049: private String onkeyup;
050: private String onmousedown;
051: private String onmousemove;
052: private String onmouseout;
053: private String onmouseover;
054: private String onmouseup;
055: private String rowClasses;
056: private String rules;
057: private String style;
058: private String styleClass;
059: private String summary;
060: private String title;
061: private String width;
062:
063: public void setFirst(String first) {
064: this .first = first;
065: }
066:
067: public void setRows(String rows) {
068: this .rows = rows;
069: }
070:
071: public void setValue(String value) {
072: this .value = value;
073: }
074:
075: public void setVar(String var) {
076: this .var = var;
077: }
078:
079: public void setBgcolor(String bgcolor) {
080: this .bgcolor = bgcolor;
081: }
082:
083: public void setBorder(String border) {
084: this .border = border;
085: }
086:
087: public void setCellpadding(String cellpadding) {
088: this .cellpadding = cellpadding;
089: }
090:
091: public void setCellspacing(String cellspacing) {
092: this .cellspacing = cellspacing;
093: }
094:
095: public void setColumnClasses(String columnClasses) {
096: this .columnClasses = columnClasses;
097: }
098:
099: public void setDir(String dir) {
100: this .dir = dir;
101: }
102:
103: public void setFooterClass(String footerClass) {
104: this .footerClass = footerClass;
105: }
106:
107: public void setFrame(String frame) {
108: this .frame = frame;
109: }
110:
111: public void setHeaderClass(String headerClass) {
112: this .headerClass = headerClass;
113: }
114:
115: public void setLang(String lang) {
116: this .lang = lang;
117: }
118:
119: public void setOnclick(String onclick) {
120: this .onclick = onclick;
121: }
122:
123: public void setOndblclick(String ondblclick) {
124: this .ondblclick = ondblclick;
125: }
126:
127: public void setOnkeydown(String onkeydown) {
128: this .onkeydown = onkeydown;
129: }
130:
131: public void setOnkeypress(String onkeypress) {
132: this .onkeypress = onkeypress;
133: }
134:
135: public void setOnkeyup(String onkeyup) {
136: this .onkeyup = onkeyup;
137: }
138:
139: public void setOnmousedown(String onmousedown) {
140: this .onmousedown = onmousedown;
141: }
142:
143: public void setOnmousemove(String onmousemove) {
144: this .onmousemove = onmousemove;
145: }
146:
147: public void setOnmouseout(String onmouseout) {
148: this .onmouseout = onmouseout;
149: }
150:
151: public void setOnmouseover(String onmouseover) {
152: this .onmouseover = onmouseover;
153: }
154:
155: public void setOnmouseup(String onmouseup) {
156: this .onmouseup = onmouseup;
157: }
158:
159: public void setRowClasses(String rowClasses) {
160: this .rowClasses = rowClasses;
161: }
162:
163: public void setRules(String rules) {
164: this .rules = rules;
165: }
166:
167: public void setStyle(String style) {
168: this .style = style;
169: }
170:
171: public void setStyleClass(String styleClass) {
172: this .styleClass = styleClass;
173: }
174:
175: public void setSummary(String summary) {
176: this .summary = summary;
177: }
178:
179: public void setTitle(String title) {
180: this .title = title;
181: }
182:
183: public void setWidth(String width) {
184: this .width = width;
185: }
186:
187: public String getRendererType() {
188: return "javax.faces.Table";
189: }
190:
191: public String getComponentType() {
192: return "javax.faces.HtmlDataTable";
193: }
194:
195: protected void setProperties(UIComponent component) {
196: super .setProperties(component);
197:
198: UIData data;
199: try {
200: data = (UIData) component;
201: } catch (ClassCastException cce) {
202: throw new FacesException("Tag <" + getClass().getName()
203: + "> expected UIData. " + "Got <"
204: + component.getClass().getName() + ">");
205: }
206:
207: if (first != null) {
208: if (FacesUtils.isExpression(first)) {
209: data
210: .setValueBinding("first",
211: createValueBinding(first));
212: } else {
213: data.setFirst(Integer.parseInt(first));
214: }
215: }
216:
217: if (rows != null) {
218: if (FacesUtils.isExpression(rows)) {
219: data.setValueBinding("rows", createValueBinding(rows));
220: } else {
221: data.setRows(Integer.parseInt(rows));
222: }
223: }
224:
225: if (value != null) {
226: if (FacesUtils.isExpression(value)) {
227: data
228: .setValueBinding("value",
229: createValueBinding(value));
230: } else {
231: data.setValue(value);
232: }
233: }
234:
235: data.setVar(var);
236:
237: setProperty(component, "bgcolor", bgcolor);
238:
239: setIntegerProperty(component, "border", border);
240:
241: setProperty(component, "cellpadding", cellpadding);
242: setProperty(component, "cellspacing", cellspacing);
243: setProperty(component, "columnClasses", columnClasses);
244: setProperty(component, "dir", dir);
245: setProperty(component, "footerClass", footerClass);
246: setProperty(component, "frame", frame);
247: setProperty(component, "headerClass", headerClass);
248: setProperty(component, "lang", lang);
249:
250: setProperty(component, "onclick", onclick);
251: setProperty(component, "ondblclick", ondblclick);
252: setProperty(component, "onkeydown", onkeydown);
253: setProperty(component, "onkeypress", onkeypress);
254: setProperty(component, "onkeyup", onkeyup);
255: setProperty(component, "onmousedown", onmousedown);
256: setProperty(component, "onmousemove", onmousemove);
257: setProperty(component, "onmouseout", onmouseout);
258: setProperty(component, "onmouseover", onmouseover);
259: setProperty(component, "onmouseup", onmouseup);
260:
261: setProperty(component, "rowClasses", rowClasses);
262: setProperty(component, "rules", rules);
263: setProperty(component, "style", style);
264: setProperty(component, "styleClass", styleClass);
265: setProperty(component, "summary", summary);
266: setProperty(component, "title", title);
267: setProperty(component, "width", width);
268: }
269:
270: public void recycle() {
271: super.recycle();
272: first = null;
273: rows = null;
274: value = null;
275: var = null;
276: bgcolor = null;
277: border = null;
278: cellpadding = null;
279: cellspacing = null;
280: columnClasses = null;
281: dir = null;
282: footerClass = null;
283: frame = null;
284: headerClass = null;
285: lang = null;
286: onclick = null;
287: ondblclick = null;
288: onkeydown = null;
289: onkeypress = null;
290: onkeyup = null;
291: onmousedown = null;
292: onmousemove = null;
293: onmouseout = null;
294: onmouseover = null;
295: onmouseup = null;
296: rowClasses = null;
297: rules = null;
298: style = null;
299: styleClass = null;
300: summary = null;
301: title = null;
302: width = null;
303: }
304: }
|