KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > displaytag > tags > TableTagBeanInfo


1 /**
2  * Licensed under the Artistic License; you may not use this file
3  * except in compliance with the License.
4  * You may obtain a copy of the License at
5  *
6  * http://displaytag.sourceforge.net/license.html
7  *
8  * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
9  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
10  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11  */

12 package org.displaytag.tags;
13
14 import java.beans.IntrospectionException JavaDoc;
15 import java.beans.PropertyDescriptor JavaDoc;
16 import java.beans.SimpleBeanInfo JavaDoc;
17 import java.util.ArrayList JavaDoc;
18 import java.util.List JavaDoc;
19
20 import org.apache.commons.lang.UnhandledException;
21
22
23 /**
24  * Beaninfo class for tableTag. Needed to make the "class" tag attribute working and to handle the swith between
25  * setName() and setNameString() setters for the name attribute.
26  * @author Fabrizio Giustina
27  * @version $Revision: 956 $ ($Author: fgiust $)
28  */

29 public class TableTagBeanInfo extends SimpleBeanInfo JavaDoc
30 {
31
32     /**
33      * @see java.beans.BeanInfo#getPropertyDescriptors()
34      */

35     public PropertyDescriptor JavaDoc[] getPropertyDescriptors()
36     {
37         List JavaDoc proplist = new ArrayList JavaDoc();
38
39         try
40         {
41             proplist.add(new PropertyDescriptor JavaDoc("cellpadding", //$NON-NLS-1$
42
TableTag.class, null, "setCellpadding")); //$NON-NLS-1$
43
proplist.add(new PropertyDescriptor JavaDoc("cellspacing", //$NON-NLS-1$
44
TableTag.class, null, "setCellspacing")); //$NON-NLS-1$
45
proplist.add(new PropertyDescriptor JavaDoc("class", //$NON-NLS-1$
46
TableTag.class, null, "setClass")); //$NON-NLS-1$
47
proplist.add(new PropertyDescriptor JavaDoc("decorator", //$NON-NLS-1$
48
TableTag.class, null, "setDecorator")); //$NON-NLS-1$
49
proplist.add(new PropertyDescriptor JavaDoc("defaultorder", //$NON-NLS-1$
50
TableTag.class, null, "setDefaultorder")); //$NON-NLS-1$
51
proplist.add(new PropertyDescriptor JavaDoc("defaultsort", //$NON-NLS-1$
52
TableTag.class, null, "setDefaultsort")); //$NON-NLS-1$
53
proplist.add(new PropertyDescriptor JavaDoc("export", //$NON-NLS-1$
54
TableTag.class, null, "setExport")); //$NON-NLS-1$
55
proplist.add(new PropertyDescriptor JavaDoc("frame", //$NON-NLS-1$
56
TableTag.class, null, "setFrame")); //$NON-NLS-1$
57
proplist.add(new PropertyDescriptor JavaDoc("length", //$NON-NLS-1$
58
TableTag.class, null, "setLength")); //$NON-NLS-1$
59
proplist.add(new PropertyDescriptor JavaDoc("offset", //$NON-NLS-1$
60
TableTag.class, null, "setOffset")); //$NON-NLS-1$
61
proplist.add(new PropertyDescriptor JavaDoc("pagesize", //$NON-NLS-1$
62
TableTag.class, null, "setPagesize")); //$NON-NLS-1$
63
proplist.add(new PropertyDescriptor JavaDoc("partialList", //$NON-NLS-1$
64
TableTag.class, null, "setPartialList")); //$NON-NLS-1$
65
proplist.add(new PropertyDescriptor JavaDoc("requestURI", //$NON-NLS-1$
66
TableTag.class, null, "setRequestURI")); //$NON-NLS-1$
67
proplist.add(new PropertyDescriptor JavaDoc("requestURIcontext", //$NON-NLS-1$
68
TableTag.class, null, "setRequestURIcontext")); //$NON-NLS-1$
69
proplist.add(new PropertyDescriptor JavaDoc("rules", //$NON-NLS-1$
70
TableTag.class, null, "setRules")); //$NON-NLS-1$
71
proplist.add(new PropertyDescriptor JavaDoc("sort", //$NON-NLS-1$
72
TableTag.class, null, "setSort")); //$NON-NLS-1$
73
proplist.add(new PropertyDescriptor JavaDoc("style", //$NON-NLS-1$
74
TableTag.class, null, "setStyle")); //$NON-NLS-1$
75
proplist.add(new PropertyDescriptor JavaDoc("summary", //$NON-NLS-1$
76
TableTag.class, null, "setSummary")); //$NON-NLS-1$
77
proplist.add(new PropertyDescriptor JavaDoc("excludedParams", //$NON-NLS-1$
78
TableTag.class, null, "setExcludedParams")); //$NON-NLS-1$
79
proplist.add(new PropertyDescriptor JavaDoc("id", //$NON-NLS-1$
80
TableTag.class, null, "setUid")); //$NON-NLS-1$
81
proplist.add(new PropertyDescriptor JavaDoc("uid", //$NON-NLS-1$
82
TableTag.class, null, "setUid")); //$NON-NLS-1$
83
proplist.add(new PropertyDescriptor JavaDoc("htmlId", //$NON-NLS-1$
84
TableTag.class, null, "setHtmlId")); //$NON-NLS-1$
85
proplist.add(new PropertyDescriptor JavaDoc("varTotals", //$NON-NLS-1$
86
TableTag.class, null, "setVarTotals")); //$NON-NLS-1$
87

88             // deprecated attributes
89
proplist.add(new PropertyDescriptor JavaDoc("list", //$NON-NLS-1$
90
TableTag.class, null, "setList")); //$NON-NLS-1$
91

92             // make ATG Dynamo happy:
93
proplist.add(new PropertyDescriptor JavaDoc("className", //$NON-NLS-1$
94
TableTag.class, null, "setClass")); //$NON-NLS-1$
95

96             try
97             {
98                 Class.forName("javax.servlet.jsp.tagext.IterationTag"); //$NON-NLS-1$
99
// jsp >= 1.2
100
proplist.add(new PropertyDescriptor JavaDoc("name", //$NON-NLS-1$
101
TableTag.class, null, "setName")); //$NON-NLS-1$
102
proplist.add(new PropertyDescriptor JavaDoc("size", //$NON-NLS-1$
103
TableTag.class, null, "setSize")); //$NON-NLS-1$
104
}
105             catch (ClassNotFoundException JavaDoc e)
106             {
107                 // jsp 1.1, can't use a setter with an Object parameter
108
proplist.add(new PropertyDescriptor JavaDoc("name", //$NON-NLS-1$
109
TableTag.class, null, "setNameString")); //$NON-NLS-1$
110
proplist.add(new PropertyDescriptor JavaDoc("size", //$NON-NLS-1$
111
TableTag.class, null, "setSizeObjectName")); //$NON-NLS-1$
112
}
113
114         }
115         catch (IntrospectionException JavaDoc ex)
116         {
117             throw new UnhandledException("You got an introspection exception - maybe defining a property that is not"
118                 + " defined in the TableTag?: "
119                 + ex.getMessage(), ex);
120         }
121
122         PropertyDescriptor JavaDoc[] result = new PropertyDescriptor JavaDoc[proplist.size()];
123         return ((PropertyDescriptor JavaDoc[]) proplist.toArray(result));
124     }
125 }
Popular Tags