001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: package org.netbeans.modules.visualweb.faces.dt_1_2.component;
042:
043: import org.netbeans.modules.visualweb.faces.dt.HtmlNonGeneratedBeanInfoBase;
044: import java.beans.*;
045: import com.sun.rave.designtime.*;
046: import com.sun.rave.designtime.markup.*;
047: import org.netbeans.modules.visualweb.faces.dt.util.ComponentBundle;
048: import javax.faces.component.UISelectItem;
049:
050: public class UISelectItemBeanInfo extends HtmlNonGeneratedBeanInfoBase {
051:
052: private static final ComponentBundle bundle = ComponentBundle
053: .getBundle(UISelectItemBeanInfo.class);
054:
055: public UISelectItemBeanInfo() {
056: super ();
057: beanClass = UISelectItem.class;
058: iconFileName_C16 = "UISelectItem_C16.gif"; //NOI18N
059: iconFileName_C32 = "UISelectItem_C32.gif"; //NOI18N
060: iconFileName_M16 = "UISelectItem_M16.gif"; //NOI18N
061: iconFileName_M32 = "UISelectItem_M32.gif"; //NOI18N
062: }
063:
064: private BeanDescriptor beanDescriptor;
065:
066: /**
067: * @return The BeanDescriptor
068: */
069: public BeanDescriptor getBeanDescriptor() {
070: if (beanDescriptor == null) {
071: beanDescriptor = new BeanDescriptor(beanClass);
072: beanDescriptor.setValue(
073: Constants.BeanDescriptor.TAGLIB_URI,
074: "http://java.sun.com/jsf/core"); //NOI18N
075: beanDescriptor.setValue(
076: Constants.BeanDescriptor.TAGLIB_PREFIX, "f"); //NOI18N
077: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
078: "selectItem"); //NOI18N
079: beanDescriptor.setValue(
080: Constants.BeanDescriptor.INSTANCE_NAME,
081: "selectItem"); //NOI18N
082: }
083: return beanDescriptor;
084: }
085:
086: private PropertyDescriptor[] propertyDescriptors;
087:
088: /**
089: * Returns the PropertyDescriptor array which describes
090: * the property meta-data for this JavaBean
091: *
092: * @return An array of PropertyDescriptor objects
093: */
094: public PropertyDescriptor[] getPropertyDescriptors() {
095: if (propertyDescriptors == null) {
096: try {
097: PropertyDescriptor prop_escape = new PropertyDescriptor(
098: "escape", beanClass, "getEscape", "setEscape"); //NOI18N
099: AttributeDescriptor attrib_escape = new AttributeDescriptor(
100: "escape"); //NOI18N
101: attrib_escape.setBindable(true);
102: prop_escape
103: .setValue(
104: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
105: attrib_escape);
106:
107: PropertyDescriptor prop_itemLabel = new PropertyDescriptor(
108: "itemLabel", beanClass, "getItemLabel",
109: "setItemLabel"); //NOI18N
110: AttributeDescriptor attrib_itemLabel = new AttributeDescriptor(
111: "itemLabel"); //NOI18N
112: attrib_escape.setBindable(true);
113: prop_escape
114: .setValue(
115: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
116: attrib_escape);
117:
118: PropertyDescriptor prop_itemDescription = new PropertyDescriptor(
119: "itemDescription", beanClass,
120: "getItemDescription", "setItemDescription"); //NOI18N
121: AttributeDescriptor attrib_itemDescription = new AttributeDescriptor(
122: "itemDescription"); //NOI18N
123: attrib_itemDescription.setBindable(true);
124: prop_itemDescription
125: .setValue(
126: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
127: attrib_itemDescription);
128:
129: PropertyDescriptor prop_itemValue = new PropertyDescriptor(
130: "itemValue", beanClass, "getItemValue",
131: "setItemValue"); //NOI18N
132: AttributeDescriptor attrib_itemValue = new AttributeDescriptor(
133: "itemValue"); //NOI18N
134: attrib_itemValue.setBindable(true);
135: prop_itemValue
136: .setValue(
137: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
138: attrib_itemValue);
139:
140: PropertyDescriptor prop_value = new PropertyDescriptor(
141: "value", beanClass, "getValue", "setValue"); //NOI18N
142: AttributeDescriptor attrib_value = new AttributeDescriptor(
143: "value"); //NOI18N
144: attrib_value.setBindable(true);
145: prop_value
146: .setValue(
147: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
148: attrib_value);
149:
150: PropertyDescriptor prop_id = new PropertyDescriptor(
151: "id", beanClass, "getId", "setId"); //NOI18N
152: prop_id.setShortDescription(bundle
153: .getMessage("idPropShortDesc")); //NOI18N
154: prop_id.setHidden(true);
155: AttributeDescriptor attrib_id = new AttributeDescriptor(
156: "id"); //NOI18N
157: attrib_id.setBindable(false);
158: prop_escape
159: .setValue(
160: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
161: attrib_escape);
162:
163: propertyDescriptors = new PropertyDescriptor[] {
164: prop_escape, prop_itemLabel,
165: prop_itemDescription, prop_itemValue,
166: prop_value, prop_id, };
167: } catch (IntrospectionException ix) {
168: ix.printStackTrace();
169: }
170: }
171:
172: return propertyDescriptors;
173: }
174: }
|