KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Needed to make the "class" tag attribute working.
25  * @author Fabrizio Giustina
26  * @version $Revision: 956 $ ($Author: fgiust $)
27  */

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

34     public PropertyDescriptor JavaDoc[] getPropertyDescriptors()
35     {
36         List JavaDoc proplist = new ArrayList JavaDoc();
37
38         try
39         {
40             proplist.add(new PropertyDescriptor JavaDoc("class", //$NON-NLS-1$
41
CaptionTag.class, null, "setClass")); //$NON-NLS-1$
42
proplist.add(new PropertyDescriptor JavaDoc("dir", //$NON-NLS-1$
43
CaptionTag.class, null, "setDir")); //$NON-NLS-1$
44
proplist.add(new PropertyDescriptor JavaDoc("id", //$NON-NLS-1$
45
CaptionTag.class, null, "setId")); //$NON-NLS-1$
46
proplist.add(new PropertyDescriptor JavaDoc("lang", //$NON-NLS-1$
47
CaptionTag.class, null, "setLang")); //$NON-NLS-1$
48
proplist.add(new PropertyDescriptor JavaDoc("media", //$NON-NLS-1$
49
CaptionTag.class, null, "setMedia")); //$NON-NLS-1$
50
proplist.add(new PropertyDescriptor JavaDoc("style", //$NON-NLS-1$
51
CaptionTag.class, null, "setStyle")); //$NON-NLS-1$
52
proplist.add(new PropertyDescriptor JavaDoc("title", //$NON-NLS-1$
53
CaptionTag.class, null, "setTitle")); //$NON-NLS-1$
54

55             // make ATG Dynamo happy:
56
// Attribute "className" of tag "caption" in taglib descriptor file displaytag-11.tld" must have a
57
// corresponding property in class "org.displaytag.tags.CaptionTag" with a public setter method
58
proplist.add(new PropertyDescriptor JavaDoc("className", //$NON-NLS-1$
59
CaptionTag.class, null, "setClass")); //$NON-NLS-1$
60
}
61         catch (IntrospectionException JavaDoc ex)
62         {
63             throw new UnhandledException("You got an introspection exception - maybe defining a property that is not"
64                 + " defined in the CaptionTag?: "
65                 + ex.getMessage(), ex);
66         }
67
68         PropertyDescriptor JavaDoc[] result = new PropertyDescriptor JavaDoc[proplist.size()];
69         return ((PropertyDescriptor JavaDoc[]) proplist.toArray(result));
70     }
71
72 }
Popular Tags