001: /*
002: * $Id: ELOptionsCollectionTagBeanInfo.java 471754 2006-11-06 14:55:09Z husted $
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.ELOptionsCollectionTag</code> class.
032: * It is needed to override the default mapping of custom tag attribute names
033: * to class attribute names. <p> This is because the value of the unevaluated
034: * EL 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 ELOptionsCollectionTagBeanInfo extends SimpleBeanInfo {
041: public PropertyDescriptor[] getPropertyDescriptors() {
042: ArrayList proplist = new ArrayList();
043:
044: try {
045: proplist
046: .add(new PropertyDescriptor("filter",
047: ELOptionsCollectionTag.class, null,
048: "setFilterExpr"));
049: } catch (IntrospectionException ex) {
050: }
051:
052: try {
053: proplist
054: .add(new PropertyDescriptor("label",
055: ELOptionsCollectionTag.class, null,
056: "setLabelExpr"));
057: } catch (IntrospectionException ex) {
058: }
059:
060: try {
061: proplist.add(new PropertyDescriptor("name",
062: ELOptionsCollectionTag.class, null, "setNameExpr"));
063: } catch (IntrospectionException ex) {
064: }
065:
066: try {
067: proplist.add(new PropertyDescriptor("property",
068: ELOptionsCollectionTag.class, null,
069: "setPropertyExpr"));
070: } catch (IntrospectionException ex) {
071: }
072:
073: try {
074: proplist
075: .add(new PropertyDescriptor("style",
076: ELOptionsCollectionTag.class, null,
077: "setStyleExpr"));
078: } catch (IntrospectionException ex) {
079: }
080:
081: try {
082: proplist.add(new PropertyDescriptor("styleClass",
083: ELOptionsCollectionTag.class, null,
084: "setStyleClassExpr"));
085: } catch (IntrospectionException ex) {
086: }
087:
088: try {
089: proplist
090: .add(new PropertyDescriptor("value",
091: ELOptionsCollectionTag.class, null,
092: "setValueExpr"));
093: } catch (IntrospectionException ex) {
094: }
095:
096: PropertyDescriptor[] result = new PropertyDescriptor[proplist
097: .size()];
098:
099: return ((PropertyDescriptor[]) proplist.toArray(result));
100: }
101: }
|