View Javadoc

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;
15  import java.beans.PropertyDescriptor;
16  import java.beans.SimpleBeanInfo;
17  import java.util.ArrayList;
18  import java.util.List;
19  
20  
21  /***
22   * Beaninfo class for tableTag. Needed to make the "class" tag attribute working and to handle the swith between
23   * setName() and setNameString() setters for the name attribute.
24   * @author Fabrizio Giustina
25   * @version $Revision: 1.11 $ ($Author: fgiust $)
26   */
27  public class TableTagBeanInfo extends SimpleBeanInfo
28  {
29  
30      /***
31       * @see java.beans.BeanInfo#getPropertyDescriptors()
32       */
33      public PropertyDescriptor[] getPropertyDescriptors()
34      {
35          List proplist = new ArrayList();
36  
37          try
38          {
39              proplist.add(new PropertyDescriptor("cellpadding", //$NON-NLS-1$
40                  TableTag.class, null, "setCellpadding")); //$NON-NLS-1$ 
41              proplist.add(new PropertyDescriptor("cellspacing", //$NON-NLS-1$
42                  TableTag.class, null, "setCellspacing")); //$NON-NLS-1$ 
43              proplist.add(new PropertyDescriptor("class", //$NON-NLS-1$
44                  TableTag.class, null, "setClass")); //$NON-NLS-1$ 
45              proplist.add(new PropertyDescriptor("decorator", //$NON-NLS-1$
46                  TableTag.class, null, "setDecorator")); //$NON-NLS-1$ 
47              proplist.add(new PropertyDescriptor("defaultorder", //$NON-NLS-1$
48                  TableTag.class, null, "setDefaultorder")); //$NON-NLS-1$ 
49              proplist.add(new PropertyDescriptor("defaultsort", //$NON-NLS-1$
50                  TableTag.class, null, "setDefaultsort")); //$NON-NLS-1$ 
51              proplist.add(new PropertyDescriptor("export", //$NON-NLS-1$
52                  TableTag.class, null, "setExport")); //$NON-NLS-1$ 
53              proplist.add(new PropertyDescriptor("frame", //$NON-NLS-1$
54                  TableTag.class, null, "setFrame")); //$NON-NLS-1$ 
55              proplist.add(new PropertyDescriptor("length", //$NON-NLS-1$
56                  TableTag.class, null, "setLength")); //$NON-NLS-1$ 
57              proplist.add(new PropertyDescriptor("offset", //$NON-NLS-1$
58                  TableTag.class, null, "setOffset")); //$NON-NLS-1$ 
59              proplist.add(new PropertyDescriptor("pagesize", //$NON-NLS-1$
60                  TableTag.class, null, "setPagesize")); //$NON-NLS-1$ 
61              proplist.add(new PropertyDescriptor("requestURI", //$NON-NLS-1$
62                  TableTag.class, null, "setRequestURI")); //$NON-NLS-1$ 
63              proplist.add(new PropertyDescriptor("requestURIcontext", //$NON-NLS-1$
64                  TableTag.class, null, "setRequestURIcontext")); //$NON-NLS-1$ 
65              proplist.add(new PropertyDescriptor("rules", //$NON-NLS-1$
66                  TableTag.class, null, "setRules")); //$NON-NLS-1$ 
67              proplist.add(new PropertyDescriptor("sort", //$NON-NLS-1$
68                  TableTag.class, null, "setSort")); //$NON-NLS-1$ 
69              proplist.add(new PropertyDescriptor("style", //$NON-NLS-1$
70                  TableTag.class, null, "setStyle")); //$NON-NLS-1$ 
71              proplist.add(new PropertyDescriptor("summary", //$NON-NLS-1$
72                  TableTag.class, null, "setSummary")); //$NON-NLS-1$ 
73              proplist.add(new PropertyDescriptor("excludedParams", //$NON-NLS-1$
74                  TableTag.class, null, "setExcludedParams")); //$NON-NLS-1$
75              proplist.add(new PropertyDescriptor("id", //$NON-NLS-1$
76                  TableTag.class, null, "setUid")); //$NON-NLS-1$ 
77              proplist.add(new PropertyDescriptor("uid", //$NON-NLS-1$
78                  TableTag.class, null, "setUid")); //$NON-NLS-1$ 
79              proplist.add(new PropertyDescriptor("htmlId", //$NON-NLS-1$
80                  TableTag.class, null, "setHtmlId")); //$NON-NLS-1$ 
81  
82              // deprecated attributes
83              proplist.add(new PropertyDescriptor("list", //$NON-NLS-1$
84                  TableTag.class, null, "setList")); //$NON-NLS-1$ 
85              proplist.add(new PropertyDescriptor("property", //$NON-NLS-1$
86                  TableTag.class, null, "setProperty")); //$NON-NLS-1$ 
87              proplist.add(new PropertyDescriptor("scope", //$NON-NLS-1$
88                  TableTag.class, null, "setScope")); //$NON-NLS-1$ 
89  
90              proplist.add(new PropertyDescriptor("width", //$NON-NLS-1$
91                  TableTag.class, null, "setWidth")); //$NON-NLS-1$ 
92              proplist.add(new PropertyDescriptor("styleClass", //$NON-NLS-1$
93                  TableTag.class, null, "setClass")); //$NON-NLS-1$ 
94              proplist.add(new PropertyDescriptor("border", //$NON-NLS-1$
95                  TableTag.class, null, "setBorder")); //$NON-NLS-1$ 
96              proplist.add(new PropertyDescriptor("align", //$NON-NLS-1$
97                  TableTag.class, null, "setAlign")); //$NON-NLS-1$ 
98              proplist.add(new PropertyDescriptor("background", //$NON-NLS-1$
99                  TableTag.class, null, "setBackground")); //$NON-NLS-1$ 
100             proplist.add(new PropertyDescriptor("bgcolor", //$NON-NLS-1$
101                 TableTag.class, null, "setBgcolor")); //$NON-NLS-1$ 
102             proplist.add(new PropertyDescriptor("height", //$NON-NLS-1$
103                 TableTag.class, null, "setHeight")); //$NON-NLS-1$ 
104             proplist.add(new PropertyDescriptor("hspace", //$NON-NLS-1$
105                 TableTag.class, null, "setHspace")); //$NON-NLS-1$ 
106             proplist.add(new PropertyDescriptor("vspace", //$NON-NLS-1$
107                 TableTag.class, null, "setVspace")); //$NON-NLS-1$ 
108 
109             // make ATG Dynamo happy:
110             proplist.add(new PropertyDescriptor("className", //$NON-NLS-1$
111                 TableTag.class, null, "setClass")); //$NON-NLS-1$ 
112 
113             try
114             {
115                 Class.forName("javax.servlet.jsp.tagext.IterationTag"); //$NON-NLS-1$
116                 // jsp >= 1.2
117                 proplist.add(new PropertyDescriptor("name", //$NON-NLS-1$
118                     TableTag.class, null, "setName")); //$NON-NLS-1$ 
119             }
120             catch (Throwable e)
121             {
122                 // jsp 1.1, can't use a setter with an Object parameter
123                 proplist.add(new PropertyDescriptor("name", //$NON-NLS-1$
124                     TableTag.class, null, "setNameString")); //$NON-NLS-1$ 
125             }
126 
127         }
128         catch (IntrospectionException ex)
129         {
130             // ignore, this should never happen
131         }
132 
133         PropertyDescriptor[] result = new PropertyDescriptor[proplist.size()];
134         return ((PropertyDescriptor[]) proplist.toArray(result));
135     }
136 }