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 com.sun.rave.propertyeditors.binding.ValueBindingPropertyEditor;
049: import javax.faces.component.UISelectItems;
050: import org.netbeans.modules.visualweb.propertyeditors.binding.data.BindOptionsToDataProviderPanel;
051: import org.netbeans.modules.visualweb.propertyeditors.binding.data.BindValueToObjectPanel;
052:
053: public class UISelectItemsBeanInfo extends HtmlNonGeneratedBeanInfoBase {
054:
055: private static final ComponentBundle bundle = ComponentBundle
056: .getBundle(UISelectItemsBeanInfo.class);
057:
058: public UISelectItemsBeanInfo() {
059: super ();
060: beanClass = UISelectItems.class;
061: iconFileName_C16 = "UISelectItems_C16.gif"; //NOI18N
062: iconFileName_C32 = "UISelectItems_C32.gif"; //NOI18N
063: iconFileName_M16 = "UISelectItems_M16.gif"; //NOI18N
064: iconFileName_M32 = "UISelectItems_M32.gif"; //NOI18N
065: }
066:
067: private BeanDescriptor beanDescriptor;
068:
069: /**
070: * @return The BeanDescriptor
071: */
072: public BeanDescriptor getBeanDescriptor() {
073: if (beanDescriptor == null) {
074: beanDescriptor = new BeanDescriptor(beanClass);
075: beanDescriptor.setValue(
076: Constants.BeanDescriptor.TAGLIB_URI,
077: "http://java.sun.com/jsf/core"); //NOI18N
078: beanDescriptor.setValue(
079: Constants.BeanDescriptor.TAGLIB_PREFIX, "f"); //NOI18N
080: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
081: "selectItems"); //NOI18N
082: beanDescriptor.setValue(
083: Constants.BeanDescriptor.INSTANCE_NAME,
084: "selectItems"); //NOI18N
085: }
086: return beanDescriptor;
087: }
088:
089: private PropertyDescriptor[] propertyDescriptors;
090:
091: /**
092: * Returns the PropertyDescriptor array which describes
093: * the property meta-data for this JavaBean
094: *
095: * @return An array of PropertyDescriptor objects
096: */
097: public PropertyDescriptor[] getPropertyDescriptors() {
098: if (propertyDescriptors == null) {
099: try {
100: PropertyDescriptor prop_value = new PropertyDescriptor(
101: "value", beanClass, "getValue", "setValue"); //NOI18N
102: prop_value.setDisplayName(bundle
103: .getMessage("itemsParenVal")); //NOI18N
104: AttributeDescriptor attrib_value = new AttributeDescriptor(
105: "value"); //NOI18N
106: attrib_value.setBindable(true);
107: prop_value
108: .setValue(
109: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
110: attrib_value);
111: prop_value
112: .setPropertyEditorClass(ValueBindingPropertyEditor.class);
113:
114: prop_value
115: .setPropertyEditorClass(ValueBindingPropertyEditor.class);
116: prop_value.setValue("bindingPanelClassNames",
117: new Class[] {
118: BindOptionsToDataProviderPanel.class,
119: BindValueToObjectPanel.class });
120:
121: /* The <f:selectItems> tag does not have a "rendered" attribute
122: PropertyDescriptor prop_rendered = new PropertyDescriptor("rendered", beanClass, "isRendered", "setRendered"); //NOI18N
123: prop_rendered.setShortDescription(bundle.getMessage("rendPropShortDesc")); //NOI18N
124: AttributeDescriptor attrib_rendered = new AttributeDescriptor("rendered"); //NOI18N
125: attrib_rendered.setBindable(true);
126: prop_rendered.setValue(Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR, attrib_rendered);
127: */
128:
129: PropertyDescriptor prop_id = new PropertyDescriptor(
130: "id", beanClass, "getId", "setId"); //NOI18N
131: prop_id.setShortDescription(bundle
132: .getMessage("idPropShortDesc")); //NOI18N
133: prop_id.setHidden(true);
134: AttributeDescriptor attrib_id = new AttributeDescriptor(
135: "id"); //NOI18N
136: attrib_id.setBindable(false);
137: prop_id
138: .setValue(
139: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
140: attrib_id);
141:
142: propertyDescriptors = new PropertyDescriptor[] {
143: prop_value,
144: // prop_rendered,
145: prop_id, };
146: } catch (IntrospectionException ix) {
147: ix.printStackTrace();
148: }
149: }
150:
151: return propertyDescriptors;
152: }
153:
154: }
|