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 java.beans.*;
044: import com.sun.rave.designtime.*;
045: import com.sun.rave.designtime.base.CategoryDescriptors;
046: import com.sun.rave.designtime.markup.AttributeDescriptor;
047: import org.netbeans.modules.visualweb.faces.dt.HtmlNonGeneratedBeanInfoBase;
048: import org.netbeans.modules.visualweb.faces.dt.util.ComponentBundle;
049: import javax.faces.component.UIParameter;
050:
051: public class UIParameterBeanInfo extends HtmlNonGeneratedBeanInfoBase {
052:
053: private static final ComponentBundle bundle = ComponentBundle
054: .getBundle(UIParameterBeanInfo.class);
055:
056: public UIParameterBeanInfo() {
057: super ();
058: beanClass = UIParameter.class;
059: iconFileName_C16 = "UIParameter_C16.gif"; //NOI18N
060: iconFileName_C32 = "UIParameter_C32.gif"; //NOI18N
061: iconFileName_M16 = "UIParameter_M16.gif"; //NOI18N
062: iconFileName_M32 = "UIParameter_M32.gif"; //NOI18N
063: }
064:
065: private BeanDescriptor beanDescriptor;
066:
067: /**
068: * @return The BeanDescriptor
069: */
070: public BeanDescriptor getBeanDescriptor() {
071: if (beanDescriptor == null) {
072: beanDescriptor = new BeanDescriptor(beanClass);
073: beanDescriptor.setDisplayName(bundle
074: .getMessage("UIParameter_DisplayName")); //NOI18N
075: beanDescriptor.setShortDescription(bundle
076: .getMessage("UIParameter_Description")); //NOI18N
077: beanDescriptor.setValue(
078: Constants.BeanDescriptor.TAGLIB_URI,
079: "http://java.sun.com/jsf/core"); //NOI18N
080: beanDescriptor.setValue(
081: Constants.BeanDescriptor.TAGLIB_PREFIX, "f"); //NOI18N
082: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
083: "param"); //NOI18N
084: beanDescriptor.setValue(
085: Constants.BeanDescriptor.INSTANCE_NAME, "param"); //NOI18N
086: beanDescriptor.setValue(
087: Constants.BeanDescriptor.IS_CONTAINER,
088: Boolean.FALSE);
089: beanDescriptor
090: .setValue(Constants.BeanDescriptor.HELP_KEY,
091: "projrave_ui_elements_palette_jsf-val-conv_f_param");
092: }
093: return beanDescriptor;
094: }
095:
096: PropertyDescriptor[] propertyDescriptors;
097:
098: /**
099: * Returns the PropertyDescriptor array which describes
100: * the property meta-data for this JavaBean
101: *
102: * @return An array of PropertyDescriptor objects
103: */
104: public PropertyDescriptor[] getPropertyDescriptors() {
105: if (propertyDescriptors == null) {
106: try {
107: PropertyDescriptor prop_id = new PropertyDescriptor(
108: "id", beanClass, "getId", "setId"); //NOI18N
109: prop_id.setHidden(true);
110: AttributeDescriptor attrib_id = new AttributeDescriptor(
111: "id"); //NOI18N
112: attrib_id.setBindable(false);
113: prop_id
114: .setValue(
115: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
116: attrib_id);
117:
118: PropertyDescriptor prop_name = new PropertyDescriptor(
119: "name", beanClass, "getName", "setName"); //NOI18N
120: AttributeDescriptor attrib_name = new AttributeDescriptor(
121: "name"); //NOI18N
122: attrib_name.setBindable(true);
123: prop_name
124: .setValue(
125: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
126: attrib_name);
127: prop_name
128: .setPropertyEditorClass(com.sun.rave.propertyeditors.StringPropertyEditor.class);
129: prop_name.setValue(
130: Constants.PropertyDescriptor.CATEGORY,
131: CategoryDescriptors.DATA);
132:
133: PropertyDescriptor prop_value = new PropertyDescriptor(
134: "value", beanClass, "getValue", "setValue"); //NOI18N
135: AttributeDescriptor attrib_value = new AttributeDescriptor(
136: "value"); //NOI18N
137: attrib_value.setBindable(true);
138: prop_value
139: .setValue(
140: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
141: attrib_value);
142: prop_value
143: .setPropertyEditorClass(com.sun.rave.propertyeditors.StringPropertyEditor.class);
144: prop_value.setValue(
145: Constants.PropertyDescriptor.CATEGORY,
146: CategoryDescriptors.DATA);
147:
148: propertyDescriptors = new PropertyDescriptor[] {
149: prop_id, prop_name, prop_value };
150: } catch (IntrospectionException ix) {
151: ix.printStackTrace();
152: }
153: }
154:
155: return propertyDescriptors;
156: }
157:
158: }
|