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 PropertySheetBeanInfoBase 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: PropertySheetBeanInfoBase.class.getClassLoader());
072:
073: /**
074: * <p>Construct a new <code>PropertySheetBeanInfoBase</code>.</p>
075: */
076: public PropertySheetBeanInfoBase() {
077:
078: beanClass = com.sun.rave.web.ui.component.PropertySheet.class;
079: iconFileName_C16 = "/org/netbeans/modules/visualweb/web/ui/dt/component/PropertySheet_C16";
080: iconFileName_C32 = "/org/netbeans/modules/visualweb/web/ui/dt/component/PropertySheet_C32";
081: iconFileName_M16 = "/org/netbeans/modules/visualweb/web/ui/dt/component/PropertySheet_M16";
082: iconFileName_M32 = "/org/netbeans/modules/visualweb/web/ui/dt/component/PropertySheet_M32";
083:
084: }
085:
086: /**
087: * <p>The bean class that this BeanInfo represents.
088: */
089: protected Class beanClass;
090:
091: /**
092: * <p>The cached BeanDescriptor.</p>
093: */
094: protected BeanDescriptor beanDescriptor;
095:
096: /**
097: * <p>The index of the default property.</p>
098: */
099: protected int defaultPropertyIndex = -2;
100:
101: /**
102: * <p>The name of the default property.</p>
103: */
104: protected String defaultPropertyName;
105:
106: /**
107: * <p>The 16x16 color icon.</p>
108: */
109: protected String iconFileName_C16;
110:
111: /**
112: * <p>The 32x32 color icon.</p>
113: */
114: protected String iconFileName_C32;
115:
116: /**
117: * <p>The 16x16 monochrome icon.</p>
118: */
119: protected String iconFileName_M16;
120:
121: /**
122: * <p>The 32x32 monochrome icon.</p>
123: */
124: protected String iconFileName_M32;
125:
126: /**
127: * <p>The cached property descriptors.</p>
128: */
129: protected PropertyDescriptor[] propDescriptors;
130:
131: /**
132: * <p>Return the <code>BeanDescriptor</code> for this bean.</p>
133: */
134: public BeanDescriptor getBeanDescriptor() {
135:
136: if (beanDescriptor != null) {
137: return beanDescriptor;
138: }
139:
140: beanDescriptor = new BeanDescriptor(beanClass);
141: beanDescriptor.setDisplayName(resources
142: .getString("PropertySheet_DisplayName"));
143: beanDescriptor.setShortDescription(resources
144: .getString("PropertySheet_Description"));
145: beanDescriptor.setExpert(false);
146: beanDescriptor.setHidden(false);
147: beanDescriptor.setPreferred(false);
148: beanDescriptor.setValue(
149: Constants.BeanDescriptor.FACET_DESCRIPTORS,
150: getFacetDescriptors());
151: beanDescriptor.setValue(Constants.BeanDescriptor.HELP_KEY,
152: "projrave_ui_elements_palette_bh_property_sheet");
153: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
154: "propertySheet");
155: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
156: Boolean.TRUE);
157: beanDescriptor
158: .setValue(Constants.BeanDescriptor.PROPERTIES_HELP_KEY,
159: "projrave_ui_elements_palette_bh_propsheets_bh_property_sheet_props");
160: beanDescriptor.setValue(
161: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
162: getCategoryDescriptors());
163: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
164: "propertySheet");
165: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_PREFIX,
166: "ui");
167: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_URI,
168: "http://www.sun.com/web/ui");
169:
170: return beanDescriptor;
171:
172: }
173:
174: /**
175: * <p>Return the <code>CategoryDescriptor</code> array for the property categories of this component.</p>
176: */
177: private CategoryDescriptor[] getCategoryDescriptors() {
178:
179: return com.sun.rave.designtime.base.CategoryDescriptors
180: .getDefaultCategoryDescriptors();
181:
182: }
183:
184: /**
185: * <p>Return the index of the default property, or
186: * -1 if there is no default property.</p>
187: */
188: public int getDefaultPropertyIndex() {
189:
190: if (defaultPropertyIndex > -2) {
191: return defaultPropertyIndex;
192: } else {
193: if (defaultPropertyName == null) {
194: defaultPropertyIndex = -1;
195: } else {
196: PropertyDescriptor pd[] = getPropertyDescriptors();
197: for (int i = 0; i < pd.length; i++) {
198: if (defaultPropertyName.equals(pd[i].getName())) {
199: defaultPropertyIndex = i;
200: break;
201: }
202: }
203: }
204: }
205: return defaultPropertyIndex;
206: }
207:
208: /**
209: * <p>The cached facet descriptors.</p>
210: */
211: protected FacetDescriptor[] facetDescriptors;
212:
213: /**
214: * <p>Return the <code>FacetDescriptor</code>s for this bean.</p>
215: */
216: public FacetDescriptor[] getFacetDescriptors() {
217:
218: if (facetDescriptors != null) {
219: return facetDescriptors;
220: }
221: facetDescriptors = new FacetDescriptor[] {};
222: return facetDescriptors;
223:
224: }
225:
226: /**
227: * <p>Return the specified image (if any)
228: * for this component class.</p>
229: */
230: public Image getIcon(int kind) {
231:
232: String name;
233: switch (kind) {
234: case ICON_COLOR_16x16:
235: name = iconFileName_C16;
236: break;
237: case ICON_COLOR_32x32:
238: name = iconFileName_C32;
239: break;
240: case ICON_MONO_16x16:
241: name = iconFileName_M16;
242: break;
243: case ICON_MONO_32x32:
244: name = iconFileName_M32;
245: break;
246: default:
247: name = null;
248: break;
249: }
250: if (name == null) {
251: return null;
252: }
253:
254: Image image = loadImage(name + ".png");
255: if (image == null) {
256: image = loadImage(name + ".gif");
257: }
258: return image;
259:
260: }
261:
262: /**
263: * <p>Return a class loaded by name via the class loader that loaded this class.</p>
264: */
265: private java.lang.Class loadClass(java.lang.String name) {
266:
267: try {
268: return Class.forName(name);
269: } catch (ClassNotFoundException e) {
270: throw new RuntimeException(e);
271: }
272:
273: }
274:
275: /**
276: * <p>Return the <code>PropertyDescriptor</code>s for this bean.</p>
277: */
278: public PropertyDescriptor[] getPropertyDescriptors() {
279:
280: if (propDescriptors != null) {
281: return propDescriptors;
282: }
283: AttributeDescriptor attrib = null;
284:
285: try {
286:
287: PropertyDescriptor prop_jumpLinks = new PropertyDescriptor(
288: "jumpLinks", beanClass, "isJumpLinks",
289: "setJumpLinks");
290: prop_jumpLinks.setDisplayName(resources
291: .getString("PropertySheet_jumpLinks_DisplayName"));
292: prop_jumpLinks.setShortDescription(resources
293: .getString("PropertySheet_jumpLinks_Description"));
294: prop_jumpLinks.setExpert(false);
295: prop_jumpLinks.setHidden(false);
296: prop_jumpLinks.setPreferred(false);
297: attrib = new AttributeDescriptor("jumpLinks", false, null,
298: true);
299: prop_jumpLinks.setValue(
300: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
301: attrib);
302: prop_jumpLinks
303: .setValue(
304: Constants.PropertyDescriptor.CATEGORY,
305: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
306:
307: PropertyDescriptor prop_requiredFields = new PropertyDescriptor(
308: "requiredFields", beanClass, "getRequiredFields",
309: "setRequiredFields");
310: prop_requiredFields
311: .setDisplayName(resources
312: .getString("PropertySheet_requiredFields_DisplayName"));
313: prop_requiredFields
314: .setShortDescription(resources
315: .getString("PropertySheet_requiredFields_Description"));
316: prop_requiredFields
317: .setPropertyEditorClass(loadClass("org.netbeans.modules.visualweb.web.ui.dt.component.propertyeditors.RequiredFieldsPropertyEditor"));
318: prop_requiredFields.setExpert(false);
319: prop_requiredFields.setHidden(false);
320: prop_requiredFields.setPreferred(false);
321: attrib = new AttributeDescriptor("requiredFields", false,
322: null, true);
323: prop_requiredFields.setValue(
324: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
325: attrib);
326: prop_requiredFields
327: .setValue(
328: Constants.PropertyDescriptor.CATEGORY,
329: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
330:
331: PropertyDescriptor prop_style = new PropertyDescriptor(
332: "style", beanClass, "getStyle", "setStyle");
333: prop_style.setDisplayName(resources
334: .getString("PropertySheet_style_DisplayName"));
335: prop_style.setShortDescription(resources
336: .getString("PropertySheet_style_Description"));
337: prop_style
338: .setPropertyEditorClass(loadClass("com.sun.rave.propertyeditors.css.CssStylePropertyEditor"));
339: prop_style.setExpert(false);
340: prop_style.setHidden(false);
341: prop_style.setPreferred(false);
342: attrib = new AttributeDescriptor("style", false, null, true);
343: prop_style.setValue(
344: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
345: attrib);
346: prop_style
347: .setValue(
348: Constants.PropertyDescriptor.CATEGORY,
349: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
350:
351: PropertyDescriptor prop_styleClass = new PropertyDescriptor(
352: "styleClass", beanClass, "getStyleClass",
353: "setStyleClass");
354: prop_styleClass.setDisplayName(resources
355: .getString("PropertySheet_styleClass_DisplayName"));
356: prop_styleClass.setShortDescription(resources
357: .getString("PropertySheet_styleClass_Description"));
358: prop_styleClass
359: .setPropertyEditorClass(loadClass("com.sun.rave.propertyeditors.StyleClassPropertyEditor"));
360: prop_styleClass.setExpert(false);
361: prop_styleClass.setHidden(false);
362: prop_styleClass.setPreferred(false);
363: attrib = new AttributeDescriptor("styleClass", false, null,
364: true);
365: prop_styleClass.setValue(
366: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
367: attrib);
368: prop_styleClass
369: .setValue(
370: Constants.PropertyDescriptor.CATEGORY,
371: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
372:
373: PropertyDescriptor prop_visible = new PropertyDescriptor(
374: "visible", beanClass, "isVisible", "setVisible");
375: prop_visible.setDisplayName(resources
376: .getString("PropertySheet_visible_DisplayName"));
377: prop_visible.setShortDescription(resources
378: .getString("PropertySheet_visible_Description"));
379: prop_visible.setExpert(false);
380: prop_visible.setHidden(false);
381: prop_visible.setPreferred(false);
382: attrib = new AttributeDescriptor("visible", false, "true",
383: true);
384: prop_visible.setValue(
385: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
386: attrib);
387: prop_visible
388: .setValue(
389: Constants.PropertyDescriptor.CATEGORY,
390: com.sun.rave.designtime.base.CategoryDescriptors.BEHAVIOR);
391:
392: PropertyDescriptor prop_attributes = new PropertyDescriptor(
393: "attributes", beanClass, "getAttributes", null);
394: prop_attributes.setDisplayName(resources
395: .getString("PropertySheet_attributes_DisplayName"));
396: prop_attributes.setShortDescription(resources
397: .getString("PropertySheet_attributes_Description"));
398: prop_attributes.setExpert(false);
399: prop_attributes.setHidden(true);
400: prop_attributes.setPreferred(false);
401: prop_attributes
402: .setValue(
403: Constants.PropertyDescriptor.CATEGORY,
404: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
405:
406: PropertyDescriptor prop_childCount = new PropertyDescriptor(
407: "childCount", beanClass, "getChildCount", null);
408: prop_childCount.setDisplayName(resources
409: .getString("PropertySheet_childCount_DisplayName"));
410: prop_childCount.setShortDescription(resources
411: .getString("PropertySheet_childCount_Description"));
412: prop_childCount.setExpert(false);
413: prop_childCount.setHidden(true);
414: prop_childCount.setPreferred(false);
415: prop_childCount
416: .setValue(
417: Constants.PropertyDescriptor.CATEGORY,
418: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
419:
420: PropertyDescriptor prop_children = new PropertyDescriptor(
421: "children", beanClass, "getChildren", null);
422: prop_children.setDisplayName(resources
423: .getString("PropertySheet_children_DisplayName"));
424: prop_children.setShortDescription(resources
425: .getString("PropertySheet_children_Description"));
426: prop_children.setExpert(false);
427: prop_children.setHidden(true);
428: prop_children.setPreferred(false);
429: prop_children
430: .setValue(
431: Constants.PropertyDescriptor.CATEGORY,
432: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
433:
434: PropertyDescriptor prop_facets = new PropertyDescriptor(
435: "facets", beanClass, "getFacets", null);
436: prop_facets.setDisplayName(resources
437: .getString("PropertySheet_facets_DisplayName"));
438: prop_facets.setShortDescription(resources
439: .getString("PropertySheet_facets_Description"));
440: prop_facets.setExpert(false);
441: prop_facets.setHidden(true);
442: prop_facets.setPreferred(false);
443: prop_facets
444: .setValue(
445: Constants.PropertyDescriptor.CATEGORY,
446: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
447:
448: PropertyDescriptor prop_family = new PropertyDescriptor(
449: "family", beanClass, "getFamily", null);
450: prop_family.setDisplayName(resources
451: .getString("PropertySheet_family_DisplayName"));
452: prop_family.setShortDescription(resources
453: .getString("PropertySheet_family_Description"));
454: prop_family.setExpert(false);
455: prop_family.setHidden(true);
456: prop_family.setPreferred(false);
457: prop_family
458: .setValue(
459: Constants.PropertyDescriptor.CATEGORY,
460: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
461:
462: PropertyDescriptor prop_id = new PropertyDescriptor("id",
463: beanClass, "getId", "setId");
464: prop_id.setDisplayName(resources
465: .getString("PropertySheet_id_DisplayName"));
466: prop_id.setShortDescription(resources
467: .getString("PropertySheet_id_Description"));
468: prop_id.setExpert(false);
469: prop_id.setHidden(true);
470: prop_id.setPreferred(false);
471: attrib = new AttributeDescriptor("id", false, null, false);
472: prop_id.setValue(
473: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
474: attrib);
475: prop_id
476: .setValue(
477: Constants.PropertyDescriptor.CATEGORY,
478: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
479:
480: PropertyDescriptor prop_parent = new PropertyDescriptor(
481: "parent", beanClass, "getParent", "setParent");
482: prop_parent.setDisplayName(resources
483: .getString("PropertySheet_parent_DisplayName"));
484: prop_parent.setShortDescription(resources
485: .getString("PropertySheet_parent_Description"));
486: prop_parent.setExpert(false);
487: prop_parent.setHidden(true);
488: prop_parent.setPreferred(false);
489: prop_parent
490: .setValue(
491: Constants.PropertyDescriptor.CATEGORY,
492: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
493:
494: PropertyDescriptor prop_rendered = new PropertyDescriptor(
495: "rendered", beanClass, "isRendered", "setRendered");
496: prop_rendered.setDisplayName(resources
497: .getString("PropertySheet_rendered_DisplayName"));
498: prop_rendered.setShortDescription(resources
499: .getString("PropertySheet_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("PropertySheet_rendererType_DisplayName"));
519: prop_rendererType
520: .setShortDescription(resources
521: .getString("PropertySheet_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("PropertySheet_rendersChildren_DisplayName"));
536: prop_rendersChildren
537: .setShortDescription(resources
538: .getString("PropertySheet_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_jumpLinks,
550: prop_parent, prop_rendered, prop_rendererType,
551: prop_rendersChildren, prop_requiredFields,
552: prop_style, prop_styleClass, 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
|