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_1.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_itemLabel = new PropertyDescriptor(
098: "itemLabel", beanClass, "getItemLabel",
099: "setItemLabel"); //NOI18N
100: AttributeDescriptor attrib_itemLabel = new AttributeDescriptor(
101: "itemLabel"); //NOI18N
102: attrib_itemLabel.setBindable(true);
103: prop_itemLabel
104: .setValue(
105: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
106: attrib_itemLabel);
107:
108: PropertyDescriptor prop_itemDescription = new PropertyDescriptor(
109: "itemDescription", beanClass,
110: "getItemDescription", "setItemDescription"); //NOI18N
111: AttributeDescriptor attrib_itemDescription = new AttributeDescriptor(
112: "itemDescription"); //NOI18N
113: attrib_itemDescription.setBindable(true);
114: prop_itemDescription
115: .setValue(
116: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
117: attrib_itemDescription);
118:
119: PropertyDescriptor prop_itemValue = new PropertyDescriptor(
120: "itemValue", beanClass, "getItemValue",
121: "setItemValue"); //NOI18N
122: AttributeDescriptor attrib_itemValue = new AttributeDescriptor(
123: "itemValue"); //NOI18N
124: attrib_itemValue.setBindable(true);
125: prop_itemValue
126: .setValue(
127: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
128: attrib_itemValue);
129:
130: PropertyDescriptor prop_value = new PropertyDescriptor(
131: "value", beanClass, "getValue", "setValue"); //NOI18N
132: AttributeDescriptor attrib_value = new AttributeDescriptor(
133: "value"); //NOI18N
134: attrib_value.setBindable(true);
135: prop_value
136: .setValue(
137: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
138: attrib_value);
139:
140: /* The <f:selectItem> tag does not have a "rendered" attribute
141: PropertyDescriptor prop_rendered = new PropertyDescriptor("rendered", beanClass, "isRendered", "setRendered"); //NOI18N
142: prop_rendered.setShortDescription(bundle.getMessage("rendPropShortDesc")); //NOI18N
143: AttributeDescriptor attrib_rendered = new AttributeDescriptor("rendered"); //NOI18N
144: attrib_rendered.setBindable(true);
145: prop_rendered.setValue(Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR, attrib_rendered);
146: */
147:
148: PropertyDescriptor prop_id = new PropertyDescriptor(
149: "id", beanClass, "getId", "setId"); //NOI18N
150: prop_id.setShortDescription(bundle
151: .getMessage("idPropShortDesc")); //NOI18N
152: prop_id.setHidden(true);
153: AttributeDescriptor attrib_id = new AttributeDescriptor(
154: "id"); //NOI18N
155: attrib_id.setBindable(false);
156: prop_itemLabel
157: .setValue(
158: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
159: attrib_itemLabel);
160:
161: propertyDescriptors = new PropertyDescriptor[] {
162: prop_itemLabel, prop_itemDescription,
163: prop_itemValue, prop_value,
164: // prop_rendered,
165: prop_id, };
166: } catch (IntrospectionException ix) {
167: ix.printStackTrace();
168: }
169: }
170:
171: return propertyDescriptors;
172: }
173: }
|