View Javadoc

1   /*
2    * $Id: ELJavascriptValidatorTagBeanInfo.java 376779 2006-02-10 18:08:58Z husted $
3    *
4    * Copyright 1999-2004 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.strutsel.taglib.html;
19  
20  import java.beans.IntrospectionException;
21  import java.beans.PropertyDescriptor;
22  import java.beans.SimpleBeanInfo;
23  
24  import java.util.ArrayList;
25  
26  /***
27   * This is the <code>BeanInfo</code> descriptor for the
28   * <code>org.apache.strutsel.taglib.html.ELJavascriptValidatorTag</code>
29   * class. It is needed to override the default mapping of custom tag attribute
30   * names to class attribute names. <p> This is because the value of the
31   * unevaluated EL expression has to be kept separately from the evaluated
32   * value, which is stored in the base class. This is related to the fact that
33   * the JSP compiler can choose to reuse different tag instances if they
34   * received the same original attribute values, and the JSP compiler can
35   * choose to not re-call the setter methods, because it can assume the same
36   * values are already set.
37   */
38  public class ELJavascriptValidatorTagBeanInfo extends SimpleBeanInfo {
39      public PropertyDescriptor[] getPropertyDescriptors() {
40          ArrayList proplist = new ArrayList();
41  
42          try {
43              proplist.add(new PropertyDescriptor("cdata",
44                      ELJavascriptValidatorTag.class, null, "setCdataExpr"));
45          } catch (IntrospectionException ex) {
46          }
47  
48          try {
49              proplist.add(new PropertyDescriptor("dynamicJavascript",
50                      ELJavascriptValidatorTag.class, null,
51                      "setDynamicJavascriptExpr"));
52          } catch (IntrospectionException ex) {
53          }
54  
55          try {
56              proplist.add(new PropertyDescriptor("formName",
57                      ELJavascriptValidatorTag.class, null, "setFormNameExpr"));
58          } catch (IntrospectionException ex) {
59          }
60  
61          try {
62              proplist.add(new PropertyDescriptor("method",
63                      ELJavascriptValidatorTag.class, null, "setMethodExpr"));
64          } catch (IntrospectionException ex) {
65          }
66  
67          try {
68              proplist.add(new PropertyDescriptor("page",
69                      ELJavascriptValidatorTag.class, null, "setPageExpr"));
70          } catch (IntrospectionException ex) {
71          }
72  
73          try {
74              proplist.add(new PropertyDescriptor("scriptLanguage",
75                      ELJavascriptValidatorTag.class, null,
76                      "setScriptLanguageExpr"));
77          } catch (IntrospectionException ex) {
78          }
79  
80          try {
81              proplist.add(new PropertyDescriptor("src",
82                      ELJavascriptValidatorTag.class, null, "setSrcExpr"));
83          } catch (IntrospectionException ex) {
84          }
85  
86          try {
87              proplist.add(new PropertyDescriptor("staticJavascript",
88                      ELJavascriptValidatorTag.class, null,
89                      "setStaticJavascriptExpr"));
90          } catch (IntrospectionException ex) {
91          }
92  
93          try {
94              proplist.add(new PropertyDescriptor("htmlComment",
95                      ELJavascriptValidatorTag.class, null, "setHtmlCommentExpr"));
96          } catch (IntrospectionException ex) {
97          }
98  
99          try {
100             proplist.add(new PropertyDescriptor("bundle",
101                     ELJavascriptValidatorTag.class, null, "setBundleExpr"));
102         } catch (IntrospectionException ex) {
103         }
104 
105         PropertyDescriptor[] result = new PropertyDescriptor[proplist.size()];
106 
107         return ((PropertyDescriptor[]) proplist.toArray(result));
108     }
109 }