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:
042: package org.netbeans.modules.visualweb.faces.dt_1_2.component;
043:
044: import java.awt.Image;
045: import java.beans.BeanDescriptor;
046: import java.beans.BeanInfo;
047: import java.beans.IntrospectionException;
048: import java.beans.PropertyDescriptor;
049: import java.util.Locale;
050: import java.util.List;
051: import java.util.ArrayList;
052: import java.util.Arrays;
053: import java.util.ResourceBundle;
054:
055: import com.sun.rave.designtime.CategoryDescriptor;
056: import com.sun.rave.designtime.Constants;
057: import com.sun.rave.designtime.faces.FacetDescriptor;
058: import com.sun.rave.designtime.markup.AttributeDescriptor;
059:
060: import org.netbeans.modules.visualweb.faces.dt.HtmlBeanInfoBase;
061: import org.netbeans.modules.visualweb.faces.dt.BeanDescriptorBase;
062: import org.netbeans.modules.visualweb.faces.dt.PropertyDescriptorBase;
063:
064: /**
065: * <p>Auto-generated design time metadata class.
066: * Do <strong>NOT</strong> modify; all changes
067: * <strong>will</strong> be lost!</p>
068: */
069:
070: abstract class UIFormBeanInfoBase extends HtmlBeanInfoBase {
071:
072: protected static ResourceBundle resources = ResourceBundle
073: .getBundle(
074: "org.netbeans.modules.visualweb.faces.dt_1_2.component.Bundle-JSF",
075: Locale.getDefault(), UIFormBeanInfoBase.class
076: .getClassLoader());
077:
078: /**
079: * <p>Construct a new <code>UIFormBeanInfoBase</code>.</p>
080: */
081: public UIFormBeanInfoBase() {
082:
083: beanClass = javax.faces.component.UIForm.class;
084: iconFileName_C16 = "/com/sun/rave/faces/dt_1_2/component/UIForm_C16";
085: iconFileName_C32 = "/com/sun/rave/faces/dt_1_2/component/UIForm_C32";
086: iconFileName_M16 = "/com/sun/rave/faces/dt_1_2/component/UIForm_M16";
087: iconFileName_M32 = "/com/sun/rave/faces/dt_1_2/component/UIForm_M32";
088:
089: }
090:
091: private BeanDescriptor beanDescriptor;
092:
093: /**
094: * <p>Return the <code>BeanDescriptor</code> for this bean.</p>
095: */
096: public BeanDescriptor getBeanDescriptor() {
097:
098: if (beanDescriptor != null) {
099: return beanDescriptor;
100: }
101:
102: beanDescriptor = new BeanDescriptorBase(beanClass);
103: beanDescriptor.setDisplayName(resources
104: .getString("UIForm_DisplayName"));
105: beanDescriptor.setShortDescription(resources
106: .getString("UIForm_Description"));
107: beanDescriptor.setExpert(false);
108: beanDescriptor.setHidden(false);
109: beanDescriptor.setPreferred(false);
110: beanDescriptor.setValue(
111: Constants.BeanDescriptor.FACET_DESCRIPTORS,
112: getFacetDescriptors());
113: beanDescriptor.setValue(Constants.BeanDescriptor.HELP_KEY,
114: "projrave_ui_elements_palette_jsfstd_form");
115: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
116: "form");
117: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
118: Boolean.TRUE);
119: beanDescriptor.setValue(
120: Constants.BeanDescriptor.MARKUP_SECTION, "body");
121: beanDescriptor.setValue(
122: Constants.BeanDescriptor.PROPERTIES_HELP_KEY,
123: "projrave_ui_elements_propsheets_jsfstd_form_props");
124: beanDescriptor.setValue(
125: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
126: getCategoryDescriptors());
127: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
128: "form");
129: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_PREFIX,
130: "h");
131: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_URI,
132: "http://java.sun.com/jsf/html");
133:
134: return beanDescriptor;
135:
136: }
137:
138: /**
139: * <p>Return the <code>CategoryDescriptor</code> array for the property categories of this component.</p>
140: */
141: private CategoryDescriptor[] getCategoryDescriptors() {
142:
143: return com.sun.rave.designtime.base.CategoryDescriptors
144: .getDefaultCategoryDescriptors();
145:
146: }
147:
148: /**
149: * <p>The cached facet descriptors.</p>
150: */
151: protected FacetDescriptor[] facetDescriptors;
152:
153: /**
154: * <p>Return the <code>FacetDescriptor</code>s for this bean.</p>
155: */
156: public FacetDescriptor[] getFacetDescriptors() {
157:
158: if (facetDescriptors != null) {
159: return facetDescriptors;
160: }
161: facetDescriptors = new FacetDescriptor[] {};
162: return facetDescriptors;
163:
164: }
165:
166: /**
167: * <p>Return a class loaded by name via the class loader that loaded this class.</p>
168: */
169:
170: private PropertyDescriptor[] propertyDescriptors;
171:
172: /**
173: * <p>Return the <code>PropertyDescriptor</code>s for this bean.</p>
174: */
175: public PropertyDescriptor[] getPropertyDescriptors() {
176:
177: if (propertyDescriptors != null) {
178: return propertyDescriptors;
179: }
180: AttributeDescriptor attrib = null;
181:
182: try {
183:
184: PropertyDescriptor prop_attributes = new PropertyDescriptorBase(
185: "attributes", beanClass, "getAttributes", null);
186: prop_attributes.setDisplayName(resources
187: .getString("UIForm_attributes_DisplayName"));
188: prop_attributes.setShortDescription(resources
189: .getString("UIForm_attributes_Description"));
190: prop_attributes.setExpert(false);
191: prop_attributes.setHidden(true);
192: prop_attributes.setPreferred(false);
193: prop_attributes
194: .setValue(
195: Constants.PropertyDescriptor.CATEGORY,
196: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
197:
198: PropertyDescriptor prop_childCount = new PropertyDescriptorBase(
199: "childCount", beanClass, "getChildCount", null);
200: prop_childCount.setDisplayName(resources
201: .getString("UIForm_childCount_DisplayName"));
202: prop_childCount.setShortDescription(resources
203: .getString("UIForm_childCount_Description"));
204: prop_childCount.setExpert(false);
205: prop_childCount.setHidden(true);
206: prop_childCount.setPreferred(false);
207: prop_childCount
208: .setValue(
209: Constants.PropertyDescriptor.CATEGORY,
210: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
211:
212: PropertyDescriptor prop_children = new PropertyDescriptorBase(
213: "children", beanClass, "getChildren", null);
214: prop_children.setDisplayName(resources
215: .getString("UIForm_children_DisplayName"));
216: prop_children.setShortDescription(resources
217: .getString("UIForm_children_Description"));
218: prop_children.setExpert(false);
219: prop_children.setHidden(true);
220: prop_children.setPreferred(false);
221: prop_children
222: .setValue(
223: Constants.PropertyDescriptor.CATEGORY,
224: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
225:
226: PropertyDescriptor prop_facets = new PropertyDescriptorBase(
227: "facets", beanClass, "getFacets", null);
228: prop_facets.setDisplayName(resources
229: .getString("UIForm_facets_DisplayName"));
230: prop_facets.setShortDescription(resources
231: .getString("UIForm_facets_Description"));
232: prop_facets.setExpert(false);
233: prop_facets.setHidden(true);
234: prop_facets.setPreferred(false);
235: prop_facets
236: .setValue(
237: Constants.PropertyDescriptor.CATEGORY,
238: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
239:
240: PropertyDescriptor prop_family = new PropertyDescriptorBase(
241: "family", beanClass, "getFamily", null);
242: prop_family.setDisplayName(resources
243: .getString("UIForm_family_DisplayName"));
244: prop_family.setShortDescription(resources
245: .getString("UIForm_family_Description"));
246: prop_family.setExpert(false);
247: prop_family.setHidden(true);
248: prop_family.setPreferred(false);
249: prop_family
250: .setValue(
251: Constants.PropertyDescriptor.CATEGORY,
252: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
253:
254: PropertyDescriptor prop_id = new PropertyDescriptorBase(
255: "id", beanClass, "getId", "setId");
256: prop_id.setDisplayName(resources
257: .getString("UIForm_id_DisplayName"));
258: prop_id.setShortDescription(resources
259: .getString("UIForm_id_Description"));
260: prop_id.setExpert(false);
261: prop_id.setHidden(true);
262: prop_id.setPreferred(false);
263: attrib = new AttributeDescriptor("id", false, null, true);
264: prop_id.setValue(
265: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
266: attrib);
267: prop_id
268: .setValue(
269: Constants.PropertyDescriptor.CATEGORY,
270: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
271:
272: PropertyDescriptor prop_parent = new PropertyDescriptorBase(
273: "parent", beanClass, "getParent", null);
274: prop_parent.setDisplayName(resources
275: .getString("UIForm_parent_DisplayName"));
276: prop_parent.setShortDescription(resources
277: .getString("UIForm_parent_Description"));
278: prop_parent.setExpert(false);
279: prop_parent.setHidden(true);
280: prop_parent.setPreferred(false);
281: prop_parent
282: .setValue(
283: Constants.PropertyDescriptor.CATEGORY,
284: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
285:
286: PropertyDescriptor prop_rendered = new PropertyDescriptorBase(
287: "rendered", beanClass, "isRendered", "setRendered");
288: prop_rendered.setDisplayName(resources
289: .getString("UIForm_rendered_DisplayName"));
290: prop_rendered.setShortDescription(resources
291: .getString("UIForm_rendered_Description"));
292: prop_rendered.setExpert(false);
293: prop_rendered.setHidden(false);
294: prop_rendered.setPreferred(false);
295: attrib = new AttributeDescriptor("rendered", false, null,
296: true);
297: prop_rendered.setValue(
298: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
299: attrib);
300: prop_rendered
301: .setValue(
302: Constants.PropertyDescriptor.CATEGORY,
303: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
304:
305: PropertyDescriptor prop_rendererType = new PropertyDescriptorBase(
306: "rendererType", beanClass, "getRendererType",
307: "setRendererType");
308: prop_rendererType.setDisplayName(resources
309: .getString("UIForm_rendererType_DisplayName"));
310: prop_rendererType.setShortDescription(resources
311: .getString("UIForm_rendererType_Description"));
312: prop_rendererType.setExpert(false);
313: prop_rendererType.setHidden(true);
314: prop_rendererType.setPreferred(false);
315: prop_rendererType
316: .setValue(
317: Constants.PropertyDescriptor.CATEGORY,
318: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
319:
320: PropertyDescriptor prop_rendersChildren = new PropertyDescriptorBase(
321: "rendersChildren", beanClass, "getRendersChildren",
322: null);
323: prop_rendersChildren.setDisplayName(resources
324: .getString("UIForm_rendersChildren_DisplayName"));
325: prop_rendersChildren.setShortDescription(resources
326: .getString("UIForm_rendersChildren_Description"));
327: prop_rendersChildren.setExpert(false);
328: prop_rendersChildren.setHidden(true);
329: prop_rendersChildren.setPreferred(false);
330: prop_rendersChildren
331: .setValue(
332: Constants.PropertyDescriptor.CATEGORY,
333: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
334:
335: PropertyDescriptor prop_submitted = new PropertyDescriptorBase(
336: "submitted", beanClass, "isSubmitted",
337: "setSubmitted");
338: prop_submitted.setDisplayName(resources
339: .getString("UIForm_submitted_DisplayName"));
340: prop_submitted.setShortDescription(resources
341: .getString("UIForm_submitted_Description"));
342: prop_submitted.setExpert(false);
343: prop_submitted.setHidden(false);
344: prop_submitted.setPreferred(false);
345: prop_submitted
346: .setValue(
347: Constants.PropertyDescriptor.CATEGORY,
348: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
349:
350: List<PropertyDescriptor> propertyDescriptorList = new ArrayList<PropertyDescriptor>();
351: propertyDescriptorList.add(prop_attributes);
352: propertyDescriptorList.add(prop_childCount);
353: propertyDescriptorList.add(prop_children);
354: propertyDescriptorList.add(prop_facets);
355: propertyDescriptorList.add(prop_family);
356: propertyDescriptorList.add(prop_id);
357: propertyDescriptorList.add(prop_parent);
358: propertyDescriptorList.add(prop_rendered);
359: propertyDescriptorList.add(prop_rendererType);
360: propertyDescriptorList.add(prop_rendersChildren);
361: propertyDescriptorList.add(prop_submitted);
362:
363: propertyDescriptorList.addAll(Arrays.asList(super
364: .getPropertyDescriptors()));
365: propertyDescriptors = propertyDescriptorList
366: .toArray(new PropertyDescriptor[propertyDescriptorList
367: .size()]);
368: return propertyDescriptors;
369:
370: } catch (IntrospectionException e) {
371: e.printStackTrace();
372: return null;
373: }
374:
375: }
376:
377: }
|