001: /*
002: * $Id: ELOptionTagBeanInfo.java 479635 2006-11-27 14:27:18Z pbenedict $
003: *
004: * Licensed to the Apache Software Foundation (ASF) under one
005: * or more contributor license agreements. See the NOTICE file
006: * distributed with this work for additional information
007: * regarding copyright ownership. The ASF licenses this file
008: * to you under the Apache License, Version 2.0 (the
009: * "License"); you may not use this file except in compliance
010: * with the License. You may obtain a copy of the License at
011: *
012: * http://www.apache.org/licenses/LICENSE-2.0
013: *
014: * Unless required by applicable law or agreed to in writing,
015: * software distributed under the License is distributed on an
016: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017: * KIND, either express or implied. See the License for the
018: * specific language governing permissions and limitations
019: * under the License.
020: */
021: package org.apache.strutsel.taglib.html;
022:
023: import java.beans.IntrospectionException;
024: import java.beans.PropertyDescriptor;
025: import java.beans.SimpleBeanInfo;
026:
027: import java.util.ArrayList;
028:
029: /**
030: * This is the <code>BeanInfo</code> descriptor for the
031: * <code>org.apache.strutsel.taglib.html.ELOptionTag</code> class. It is
032: * needed to override the default mapping of custom tag attribute names to
033: * class attribute names. <p> This is because the value of the unevaluated EL
034: * expression has to be kept separately from the evaluated value, which is
035: * stored in the base class. This is related to the fact that the JSP compiler
036: * can choose to reuse different tag instances if they received the same
037: * original attribute values, and the JSP compiler can choose to not re-call
038: * the setter methods, because it can assume the same values are already set.
039: */
040: public class ELOptionTagBeanInfo extends SimpleBeanInfo {
041: public PropertyDescriptor[] getPropertyDescriptors() {
042: ArrayList proplist = new ArrayList();
043:
044: try {
045: proplist.add(new PropertyDescriptor("bundle",
046: ELOptionTag.class, null, "setBundleExpr"));
047: } catch (IntrospectionException ex) {
048: }
049:
050: try {
051: proplist.add(new PropertyDescriptor("dir",
052: ELOptionTag.class, null, "setDirExpr"));
053: } catch (IntrospectionException ex) {
054: }
055:
056: try {
057: proplist.add(new PropertyDescriptor("disabled",
058: ELOptionTag.class, null, "setDisabledExpr"));
059: } catch (IntrospectionException ex) {
060: }
061:
062: try {
063: proplist.add(new PropertyDescriptor("filter",
064: ELOptionTag.class, null, "setFilterExpr"));
065: } catch (IntrospectionException ex) {
066: }
067:
068: try {
069: proplist.add(new PropertyDescriptor("lang",
070: ELOptionTag.class, null, "setLangExpr"));
071: } catch (IntrospectionException ex) {
072: }
073:
074: try {
075: proplist.add(new PropertyDescriptor("key",
076: ELOptionTag.class, null, "setKeyExpr"));
077: } catch (IntrospectionException ex) {
078: }
079:
080: try {
081: proplist.add(new PropertyDescriptor("locale",
082: ELOptionTag.class, null, "setLocaleExpr"));
083: } catch (IntrospectionException ex) {
084: }
085:
086: try {
087: proplist.add(new PropertyDescriptor("style",
088: ELOptionTag.class, null, "setStyleExpr"));
089: } catch (IntrospectionException ex) {
090: }
091:
092: try {
093: proplist.add(new PropertyDescriptor("styleClass",
094: ELOptionTag.class, null, "setStyleClassExpr"));
095: } catch (IntrospectionException ex) {
096: }
097:
098: try {
099: proplist.add(new PropertyDescriptor("styleId",
100: ELOptionTag.class, null, "setStyleIdExpr"));
101: } catch (IntrospectionException ex) {
102: }
103:
104: try {
105: proplist.add(new PropertyDescriptor("value",
106: ELOptionTag.class, null, "setValueExpr"));
107: } catch (IntrospectionException ex) {
108: }
109:
110: PropertyDescriptor[] result = new PropertyDescriptor[proplist
111: .size()];
112:
113: return ((PropertyDescriptor[]) proplist.toArray(result));
114: }
115: }
|