001: //GEN-BEGIN:BeanInfo
002: /*
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
004: *
005: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
006: *
007: * The contents of this file are subject to the terms of either the GNU
008: * General Public License Version 2 only ("GPL") or the Common
009: * Development and Distribution License("CDDL") (collectively, the
010: * "License"). You may not use this file except in compliance with the
011: * License. You can obtain a copy of the License at
012: * http://www.netbeans.org/cddl-gplv2.html
013: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
014: * specific language governing permissions and limitations under the
015: * License. When distributing the software, include this License Header
016: * Notice in each file and include the License file at
017: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
018: * particular file as subject to the "Classpath" exception as provided
019: * by Sun in the GPL Version 2 section of the License file that
020: * accompanied this code. If applicable, add the following below the
021: * License Header, with the fields enclosed by brackets [] replaced by
022: * your own identifying information:
023: * "Portions Copyrighted [year] [name of copyright owner]"
024: *
025: * Contributor(s):
026: *
027: * The Original Software is NetBeans. The Initial Developer of the Original
028: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
029: * Microsystems, Inc. All Rights Reserved.
030: *
031: * If you wish your version of this file to be governed by only the CDDL
032: * or only the GPL Version 2, indicate your decision by adding
033: * "[Contributor] elects to include this software in this distribution
034: * under the [CDDL or GPL Version 2] license." If you do not indicate a
035: * single choice of license, a recipient has the option to distribute
036: * your version of this file under either the CDDL, the GPL Version 2 or
037: * to extend the choice of license to its licensees as provided above.
038: * However, if you add GPL Version 2 code and therefore, elected the GPL
039: * Version 2 license, then the option applies only if the new code is
040: * made subject to such option by the copyright holder.
041: */
042: package org.netbeans.modules.visualweb.web.ui.dt.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.ResourceBundle;
051:
052: import com.sun.rave.designtime.CategoryDescriptor;
053: import com.sun.rave.designtime.Constants;
054: import com.sun.rave.designtime.faces.FacetDescriptor;
055: import com.sun.rave.designtime.markup.AttributeDescriptor;
056:
057: import java.beans.SimpleBeanInfo;
058:
059: /**
060: * <p>Auto-generated design time metadata class.
061: * Do <strong>NOT</strong> modify; all changes
062: * <strong>will</strong> be lost!</p>
063: */
064:
065: abstract class PropertySheetSectionBeanInfoBase extends SimpleBeanInfo {
066:
067: protected static ResourceBundle resources = ResourceBundle
068: .getBundle(
069: "org.netbeans.modules.visualweb.web.ui.dt.component.Bundle-JSF",
070: Locale.getDefault(),
071: PropertySheetSectionBeanInfoBase.class
072: .getClassLoader());
073:
074: /**
075: * <p>Construct a new <code>PropertySheetSectionBeanInfoBase</code>.</p>
076: */
077: public PropertySheetSectionBeanInfoBase() {
078:
079: beanClass = com.sun.rave.web.ui.component.PropertySheetSection.class;
080: iconFileName_C16 = "/org/netbeans/modules/visualweb/web/ui/dt/component/PropertySheetSection_C16";
081: iconFileName_C32 = "/org/netbeans/modules/visualweb/web/ui/dt/component/PropertySheetSection_C32";
082: iconFileName_M16 = "/org/netbeans/modules/visualweb/web/ui/dt/component/PropertySheetSection_M16";
083: iconFileName_M32 = "/org/netbeans/modules/visualweb/web/ui/dt/component/PropertySheetSection_M32";
084:
085: }
086:
087: /**
088: * <p>The bean class that this BeanInfo represents.
089: */
090: protected Class beanClass;
091:
092: /**
093: * <p>The cached BeanDescriptor.</p>
094: */
095: protected BeanDescriptor beanDescriptor;
096:
097: /**
098: * <p>The index of the default property.</p>
099: */
100: protected int defaultPropertyIndex = -2;
101:
102: /**
103: * <p>The name of the default property.</p>
104: */
105: protected String defaultPropertyName;
106:
107: /**
108: * <p>The 16x16 color icon.</p>
109: */
110: protected String iconFileName_C16;
111:
112: /**
113: * <p>The 32x32 color icon.</p>
114: */
115: protected String iconFileName_C32;
116:
117: /**
118: * <p>The 16x16 monochrome icon.</p>
119: */
120: protected String iconFileName_M16;
121:
122: /**
123: * <p>The 32x32 monochrome icon.</p>
124: */
125: protected String iconFileName_M32;
126:
127: /**
128: * <p>The cached property descriptors.</p>
129: */
130: protected PropertyDescriptor[] propDescriptors;
131:
132: /**
133: * <p>Return the <code>BeanDescriptor</code> for this bean.</p>
134: */
135: public BeanDescriptor getBeanDescriptor() {
136:
137: if (beanDescriptor != null) {
138: return beanDescriptor;
139: }
140:
141: beanDescriptor = new BeanDescriptor(beanClass);
142: beanDescriptor.setDisplayName(resources
143: .getString("PropertySheetSection_DisplayName"));
144: beanDescriptor.setShortDescription(resources
145: .getString("PropertySheetSection_Description"));
146: beanDescriptor.setExpert(false);
147: beanDescriptor.setHidden(false);
148: beanDescriptor.setPreferred(false);
149: beanDescriptor.setValue(
150: Constants.BeanDescriptor.FACET_DESCRIPTORS,
151: getFacetDescriptors());
152: beanDescriptor
153: .setValue(Constants.BeanDescriptor.HELP_KEY,
154: "projrave_ui_elements_palette_bh_property_sheet_section");
155: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
156: "section");
157: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
158: Boolean.TRUE);
159: beanDescriptor
160: .setValue(Constants.BeanDescriptor.PROPERTIES_HELP_KEY,
161: "projrave_ui_elements_palette_bh_propsheets_bh_property_sheet_section_props");
162: beanDescriptor.setValue(
163: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
164: getCategoryDescriptors());
165: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
166: "propertySheetSection");
167: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_PREFIX,
168: "ui");
169: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_URI,
170: "http://www.sun.com/web/ui");
171:
172: return beanDescriptor;
173:
174: }
175:
176: /**
177: * <p>Return the <code>CategoryDescriptor</code> array for the property categories of this component.</p>
178: */
179: private CategoryDescriptor[] getCategoryDescriptors() {
180:
181: return com.sun.rave.designtime.base.CategoryDescriptors
182: .getDefaultCategoryDescriptors();
183:
184: }
185:
186: /**
187: * <p>Return the index of the default property, or
188: * -1 if there is no default property.</p>
189: */
190: public int getDefaultPropertyIndex() {
191:
192: if (defaultPropertyIndex > -2) {
193: return defaultPropertyIndex;
194: } else {
195: if (defaultPropertyName == null) {
196: defaultPropertyIndex = -1;
197: } else {
198: PropertyDescriptor pd[] = getPropertyDescriptors();
199: for (int i = 0; i < pd.length; i++) {
200: if (defaultPropertyName.equals(pd[i].getName())) {
201: defaultPropertyIndex = i;
202: break;
203: }
204: }
205: }
206: }
207: return defaultPropertyIndex;
208: }
209:
210: /**
211: * <p>The cached facet descriptors.</p>
212: */
213: protected FacetDescriptor[] facetDescriptors;
214:
215: /**
216: * <p>Return the <code>FacetDescriptor</code>s for this bean.</p>
217: */
218: public FacetDescriptor[] getFacetDescriptors() {
219:
220: if (facetDescriptors != null) {
221: return facetDescriptors;
222: }
223: facetDescriptors = new FacetDescriptor[] {};
224: return facetDescriptors;
225:
226: }
227:
228: /**
229: * <p>Return the specified image (if any)
230: * for this component class.</p>
231: */
232: public Image getIcon(int kind) {
233:
234: String name;
235: switch (kind) {
236: case ICON_COLOR_16x16:
237: name = iconFileName_C16;
238: break;
239: case ICON_COLOR_32x32:
240: name = iconFileName_C32;
241: break;
242: case ICON_MONO_16x16:
243: name = iconFileName_M16;
244: break;
245: case ICON_MONO_32x32:
246: name = iconFileName_M32;
247: break;
248: default:
249: name = null;
250: break;
251: }
252: if (name == null) {
253: return null;
254: }
255:
256: Image image = loadImage(name + ".png");
257: if (image == null) {
258: image = loadImage(name + ".gif");
259: }
260: return image;
261:
262: }
263:
264: /**
265: * <p>Return a class loaded by name via the class loader that loaded this class.</p>
266: */
267: private java.lang.Class loadClass(java.lang.String name) {
268:
269: try {
270: return Class.forName(name);
271: } catch (ClassNotFoundException e) {
272: throw new RuntimeException(e);
273: }
274:
275: }
276:
277: /**
278: * <p>Return the <code>PropertyDescriptor</code>s for this bean.</p>
279: */
280: public PropertyDescriptor[] getPropertyDescriptors() {
281:
282: if (propDescriptors != null) {
283: return propDescriptors;
284: }
285: AttributeDescriptor attrib = null;
286:
287: try {
288:
289: PropertyDescriptor prop_label = new PropertyDescriptor(
290: "label", beanClass, "getLabel", "setLabel");
291: prop_label
292: .setDisplayName(resources
293: .getString("PropertySheetSection_label_DisplayName"));
294: prop_label
295: .setShortDescription(resources
296: .getString("PropertySheetSection_label_Description"));
297: prop_label
298: .setPropertyEditorClass(loadClass("com.sun.rave.propertyeditors.StringPropertyEditor"));
299: prop_label.setExpert(false);
300: prop_label.setHidden(false);
301: prop_label.setPreferred(false);
302: attrib = new AttributeDescriptor("label", false, null, true);
303: prop_label.setValue(
304: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
305: attrib);
306: prop_label
307: .setValue(
308: Constants.PropertyDescriptor.CATEGORY,
309: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
310:
311: PropertyDescriptor prop_style = new PropertyDescriptor(
312: "style", beanClass, "getStyle", "setStyle");
313: prop_style
314: .setDisplayName(resources
315: .getString("PropertySheetSection_style_DisplayName"));
316: prop_style
317: .setShortDescription(resources
318: .getString("PropertySheetSection_style_Description"));
319: prop_style
320: .setPropertyEditorClass(loadClass("com.sun.rave.propertyeditors.css.CssStylePropertyEditor"));
321: prop_style.setExpert(false);
322: prop_style.setHidden(false);
323: prop_style.setPreferred(false);
324: attrib = new AttributeDescriptor("style", false, null, true);
325: prop_style.setValue(
326: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
327: attrib);
328: prop_style
329: .setValue(
330: Constants.PropertyDescriptor.CATEGORY,
331: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
332:
333: PropertyDescriptor prop_styleClass = new PropertyDescriptor(
334: "styleClass", beanClass, "getStyleClass",
335: "setStyleClass");
336: prop_styleClass
337: .setDisplayName(resources
338: .getString("PropertySheetSection_styleClass_DisplayName"));
339: prop_styleClass
340: .setShortDescription(resources
341: .getString("PropertySheetSection_styleClass_Description"));
342: prop_styleClass
343: .setPropertyEditorClass(loadClass("com.sun.rave.propertyeditors.StyleClassPropertyEditor"));
344: prop_styleClass.setExpert(false);
345: prop_styleClass.setHidden(false);
346: prop_styleClass.setPreferred(false);
347: attrib = new AttributeDescriptor("styleClass", false, null,
348: true);
349: prop_styleClass.setValue(
350: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
351: attrib);
352: prop_styleClass
353: .setValue(
354: Constants.PropertyDescriptor.CATEGORY,
355: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
356:
357: PropertyDescriptor prop_visible = new PropertyDescriptor(
358: "visible", beanClass, "isVisible", "setVisible");
359: prop_visible
360: .setDisplayName(resources
361: .getString("PropertySheetSection_visible_DisplayName"));
362: prop_visible
363: .setShortDescription(resources
364: .getString("PropertySheetSection_visible_Description"));
365: prop_visible.setExpert(false);
366: prop_visible.setHidden(false);
367: prop_visible.setPreferred(false);
368: attrib = new AttributeDescriptor("visible", false, "true",
369: true);
370: prop_visible.setValue(
371: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
372: attrib);
373: prop_visible
374: .setValue(
375: Constants.PropertyDescriptor.CATEGORY,
376: com.sun.rave.designtime.base.CategoryDescriptors.BEHAVIOR);
377:
378: PropertyDescriptor prop_attributes = new PropertyDescriptor(
379: "attributes", beanClass, "getAttributes", null);
380: prop_attributes
381: .setDisplayName(resources
382: .getString("PropertySheetSection_attributes_DisplayName"));
383: prop_attributes
384: .setShortDescription(resources
385: .getString("PropertySheetSection_attributes_Description"));
386: prop_attributes.setExpert(false);
387: prop_attributes.setHidden(true);
388: prop_attributes.setPreferred(false);
389: prop_attributes
390: .setValue(
391: Constants.PropertyDescriptor.CATEGORY,
392: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
393:
394: PropertyDescriptor prop_childCount = new PropertyDescriptor(
395: "childCount", beanClass, "getChildCount", null);
396: prop_childCount
397: .setDisplayName(resources
398: .getString("PropertySheetSection_childCount_DisplayName"));
399: prop_childCount
400: .setShortDescription(resources
401: .getString("PropertySheetSection_childCount_Description"));
402: prop_childCount.setExpert(false);
403: prop_childCount.setHidden(true);
404: prop_childCount.setPreferred(false);
405: prop_childCount
406: .setValue(
407: Constants.PropertyDescriptor.CATEGORY,
408: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
409:
410: PropertyDescriptor prop_children = new PropertyDescriptor(
411: "children", beanClass, "getChildren", null);
412: prop_children
413: .setDisplayName(resources
414: .getString("PropertySheetSection_children_DisplayName"));
415: prop_children
416: .setShortDescription(resources
417: .getString("PropertySheetSection_children_Description"));
418: prop_children.setExpert(false);
419: prop_children.setHidden(true);
420: prop_children.setPreferred(false);
421: prop_children
422: .setValue(
423: Constants.PropertyDescriptor.CATEGORY,
424: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
425:
426: PropertyDescriptor prop_facets = new PropertyDescriptor(
427: "facets", beanClass, "getFacets", null);
428: prop_facets
429: .setDisplayName(resources
430: .getString("PropertySheetSection_facets_DisplayName"));
431: prop_facets
432: .setShortDescription(resources
433: .getString("PropertySheetSection_facets_Description"));
434: prop_facets.setExpert(false);
435: prop_facets.setHidden(true);
436: prop_facets.setPreferred(false);
437: prop_facets
438: .setValue(
439: Constants.PropertyDescriptor.CATEGORY,
440: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
441:
442: PropertyDescriptor prop_family = new PropertyDescriptor(
443: "family", beanClass, "getFamily", null);
444: prop_family
445: .setDisplayName(resources
446: .getString("PropertySheetSection_family_DisplayName"));
447: prop_family
448: .setShortDescription(resources
449: .getString("PropertySheetSection_family_Description"));
450: prop_family.setExpert(false);
451: prop_family.setHidden(true);
452: prop_family.setPreferred(false);
453: prop_family
454: .setValue(
455: Constants.PropertyDescriptor.CATEGORY,
456: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
457:
458: PropertyDescriptor prop_id = new PropertyDescriptor("id",
459: beanClass, "getId", "setId");
460: prop_id.setDisplayName(resources
461: .getString("PropertySheetSection_id_DisplayName"));
462: prop_id.setShortDescription(resources
463: .getString("PropertySheetSection_id_Description"));
464: prop_id.setExpert(false);
465: prop_id.setHidden(true);
466: prop_id.setPreferred(false);
467: attrib = new AttributeDescriptor("id", false, null, false);
468: prop_id.setValue(
469: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
470: attrib);
471: prop_id
472: .setValue(
473: Constants.PropertyDescriptor.CATEGORY,
474: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
475:
476: PropertyDescriptor prop_parent = new PropertyDescriptor(
477: "parent", beanClass, "getParent", "setParent");
478: prop_parent
479: .setDisplayName(resources
480: .getString("PropertySheetSection_parent_DisplayName"));
481: prop_parent
482: .setShortDescription(resources
483: .getString("PropertySheetSection_parent_Description"));
484: prop_parent.setExpert(false);
485: prop_parent.setHidden(true);
486: prop_parent.setPreferred(false);
487: prop_parent
488: .setValue(
489: Constants.PropertyDescriptor.CATEGORY,
490: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
491:
492: PropertyDescriptor prop_rendered = new PropertyDescriptor(
493: "rendered", beanClass, "isRendered", "setRendered");
494: prop_rendered
495: .setDisplayName(resources
496: .getString("PropertySheetSection_rendered_DisplayName"));
497: prop_rendered
498: .setShortDescription(resources
499: .getString("PropertySheetSection_rendered_Description"));
500: prop_rendered.setExpert(false);
501: prop_rendered.setHidden(false);
502: prop_rendered.setPreferred(false);
503: attrib = new AttributeDescriptor("rendered", false, null,
504: true);
505: prop_rendered.setValue(
506: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
507: attrib);
508: prop_rendered
509: .setValue(
510: Constants.PropertyDescriptor.CATEGORY,
511: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
512:
513: PropertyDescriptor prop_rendererType = new PropertyDescriptor(
514: "rendererType", beanClass, "getRendererType",
515: "setRendererType");
516: prop_rendererType
517: .setDisplayName(resources
518: .getString("PropertySheetSection_rendererType_DisplayName"));
519: prop_rendererType
520: .setShortDescription(resources
521: .getString("PropertySheetSection_rendererType_Description"));
522: prop_rendererType.setExpert(false);
523: prop_rendererType.setHidden(true);
524: prop_rendererType.setPreferred(false);
525: prop_rendererType
526: .setValue(
527: Constants.PropertyDescriptor.CATEGORY,
528: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
529:
530: PropertyDescriptor prop_rendersChildren = new PropertyDescriptor(
531: "rendersChildren", beanClass, "getRendersChildren",
532: null);
533: prop_rendersChildren
534: .setDisplayName(resources
535: .getString("PropertySheetSection_rendersChildren_DisplayName"));
536: prop_rendersChildren
537: .setShortDescription(resources
538: .getString("PropertySheetSection_rendersChildren_Description"));
539: prop_rendersChildren.setExpert(false);
540: prop_rendersChildren.setHidden(true);
541: prop_rendersChildren.setPreferred(false);
542: prop_rendersChildren
543: .setValue(
544: Constants.PropertyDescriptor.CATEGORY,
545: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
546:
547: propDescriptors = new PropertyDescriptor[] {
548: prop_attributes, prop_childCount, prop_children,
549: prop_facets, prop_family, prop_id, prop_label,
550: prop_parent, prop_rendered, prop_rendererType,
551: prop_rendersChildren, prop_style, prop_styleClass,
552: prop_visible, };
553: return propDescriptors;
554:
555: } catch (IntrospectionException e) {
556: e.printStackTrace();
557: return null;
558: }
559:
560: }
561:
562: }
563: //GEN-END:BeanInfo
|