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 LegendBeanInfoBase 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(), LegendBeanInfoBase.class
071: .getClassLoader());
072:
073: /**
074: * <p>Construct a new <code>LegendBeanInfoBase</code>.</p>
075: */
076: public LegendBeanInfoBase() {
077:
078: beanClass = com.sun.rave.web.ui.component.Legend.class;
079: iconFileName_C16 = "/org/netbeans/modules/visualweb/web/ui/dt/component/Legend_C16";
080: iconFileName_C32 = "/org/netbeans/modules/visualweb/web/ui/dt/component/Legend_C32";
081: iconFileName_M16 = "/org/netbeans/modules/visualweb/web/ui/dt/component/Legend_M16";
082: iconFileName_M32 = "/org/netbeans/modules/visualweb/web/ui/dt/component/Legend_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("Legend_DisplayName"));
143: beanDescriptor.setShortDescription(resources
144: .getString("Legend_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.INSTANCE_NAME,
152: "legend");
153: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
154: Boolean.TRUE);
155: beanDescriptor.setValue(
156: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
157: getCategoryDescriptors());
158: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
159: "legend");
160: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_PREFIX,
161: "ui");
162: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_URI,
163: "http://www.sun.com/web/ui");
164:
165: return beanDescriptor;
166:
167: }
168:
169: /**
170: * <p>Return the <code>CategoryDescriptor</code> array for the property categories of this component.</p>
171: */
172: private CategoryDescriptor[] getCategoryDescriptors() {
173:
174: return com.sun.rave.designtime.base.CategoryDescriptors
175: .getDefaultCategoryDescriptors();
176:
177: }
178:
179: /**
180: * <p>Return the index of the default property, or
181: * -1 if there is no default property.</p>
182: */
183: public int getDefaultPropertyIndex() {
184:
185: if (defaultPropertyIndex > -2) {
186: return defaultPropertyIndex;
187: } else {
188: if (defaultPropertyName == null) {
189: defaultPropertyIndex = -1;
190: } else {
191: PropertyDescriptor pd[] = getPropertyDescriptors();
192: for (int i = 0; i < pd.length; i++) {
193: if (defaultPropertyName.equals(pd[i].getName())) {
194: defaultPropertyIndex = i;
195: break;
196: }
197: }
198: }
199: }
200: return defaultPropertyIndex;
201: }
202:
203: /**
204: * <p>The cached facet descriptors.</p>
205: */
206: protected FacetDescriptor[] facetDescriptors;
207:
208: /**
209: * <p>Return the <code>FacetDescriptor</code>s for this bean.</p>
210: */
211: public FacetDescriptor[] getFacetDescriptors() {
212:
213: if (facetDescriptors != null) {
214: return facetDescriptors;
215: }
216: facetDescriptors = new FacetDescriptor[] {};
217: return facetDescriptors;
218:
219: }
220:
221: /**
222: * <p>Return the specified image (if any)
223: * for this component class.</p>
224: */
225: public Image getIcon(int kind) {
226:
227: String name;
228: switch (kind) {
229: case ICON_COLOR_16x16:
230: name = iconFileName_C16;
231: break;
232: case ICON_COLOR_32x32:
233: name = iconFileName_C32;
234: break;
235: case ICON_MONO_16x16:
236: name = iconFileName_M16;
237: break;
238: case ICON_MONO_32x32:
239: name = iconFileName_M32;
240: break;
241: default:
242: name = null;
243: break;
244: }
245: if (name == null) {
246: return null;
247: }
248:
249: Image image = loadImage(name + ".png");
250: if (image == null) {
251: image = loadImage(name + ".gif");
252: }
253: return image;
254:
255: }
256:
257: /**
258: * <p>Return a class loaded by name via the class loader that loaded this class.</p>
259: */
260: private java.lang.Class loadClass(java.lang.String name) {
261:
262: try {
263: return Class.forName(name);
264: } catch (ClassNotFoundException e) {
265: throw new RuntimeException(e);
266: }
267:
268: }
269:
270: /**
271: * <p>Return the <code>PropertyDescriptor</code>s for this bean.</p>
272: */
273: public PropertyDescriptor[] getPropertyDescriptors() {
274:
275: if (propDescriptors != null) {
276: return propDescriptors;
277: }
278: AttributeDescriptor attrib = null;
279:
280: try {
281:
282: PropertyDescriptor prop_position = new PropertyDescriptor(
283: "position", beanClass, "getPosition", "setPosition");
284: prop_position.setDisplayName(resources
285: .getString("Legend_position_DisplayName"));
286: prop_position.setShortDescription(resources
287: .getString("Legend_position_Description"));
288: prop_position.setExpert(false);
289: prop_position.setHidden(false);
290: prop_position.setPreferred(false);
291: attrib = new AttributeDescriptor("position", false, null,
292: true);
293: prop_position.setValue(
294: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
295: attrib);
296: prop_position
297: .setValue(
298: Constants.PropertyDescriptor.CATEGORY,
299: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
300:
301: PropertyDescriptor prop_style = new PropertyDescriptor(
302: "style", beanClass, "getStyle", "setStyle");
303: prop_style.setDisplayName(resources
304: .getString("Legend_style_DisplayName"));
305: prop_style.setShortDescription(resources
306: .getString("Legend_style_Description"));
307: prop_style.setExpert(false);
308: prop_style.setHidden(false);
309: prop_style.setPreferred(false);
310: attrib = new AttributeDescriptor("style", false, null, true);
311: prop_style.setValue(
312: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
313: attrib);
314: prop_style
315: .setValue(
316: Constants.PropertyDescriptor.CATEGORY,
317: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
318:
319: PropertyDescriptor prop_styleClass = new PropertyDescriptor(
320: "styleClass", beanClass, "getStyleClass",
321: "setStyleClass");
322: prop_styleClass.setDisplayName(resources
323: .getString("Legend_styleClass_DisplayName"));
324: prop_styleClass.setShortDescription(resources
325: .getString("Legend_styleClass_Description"));
326: prop_styleClass.setExpert(false);
327: prop_styleClass.setHidden(false);
328: prop_styleClass.setPreferred(false);
329: attrib = new AttributeDescriptor("styleClass", false, null,
330: true);
331: prop_styleClass.setValue(
332: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
333: attrib);
334: prop_styleClass
335: .setValue(
336: Constants.PropertyDescriptor.CATEGORY,
337: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
338:
339: PropertyDescriptor prop_text = new PropertyDescriptor(
340: "text", beanClass, "getText", "setText");
341: prop_text.setDisplayName(resources
342: .getString("Legend_text_DisplayName"));
343: prop_text.setShortDescription(resources
344: .getString("Legend_text_Description"));
345: prop_text.setExpert(false);
346: prop_text.setHidden(false);
347: prop_text.setPreferred(false);
348: attrib = new AttributeDescriptor("text", false, null, true);
349: prop_text.setValue(
350: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
351: attrib);
352: prop_text
353: .setValue(
354: Constants.PropertyDescriptor.CATEGORY,
355: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
356:
357: PropertyDescriptor prop_visible = new PropertyDescriptor(
358: "visible", beanClass, "isVisible", "setVisible");
359: prop_visible.setDisplayName(resources
360: .getString("Legend_visible_DisplayName"));
361: prop_visible.setShortDescription(resources
362: .getString("Legend_visible_Description"));
363: prop_visible.setExpert(false);
364: prop_visible.setHidden(false);
365: prop_visible.setPreferred(false);
366: attrib = new AttributeDescriptor("visible", false, "true",
367: true);
368: prop_visible.setValue(
369: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
370: attrib);
371: prop_visible
372: .setValue(
373: Constants.PropertyDescriptor.CATEGORY,
374: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
375:
376: PropertyDescriptor prop_attributes = new PropertyDescriptor(
377: "attributes", beanClass, "getAttributes", null);
378: prop_attributes.setDisplayName(resources
379: .getString("Legend_attributes_DisplayName"));
380: prop_attributes.setShortDescription(resources
381: .getString("Legend_attributes_Description"));
382: prop_attributes.setExpert(false);
383: prop_attributes.setHidden(true);
384: prop_attributes.setPreferred(false);
385: prop_attributes
386: .setValue(
387: Constants.PropertyDescriptor.CATEGORY,
388: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
389:
390: PropertyDescriptor prop_childCount = new PropertyDescriptor(
391: "childCount", beanClass, "getChildCount", null);
392: prop_childCount.setDisplayName(resources
393: .getString("Legend_childCount_DisplayName"));
394: prop_childCount.setShortDescription(resources
395: .getString("Legend_childCount_Description"));
396: prop_childCount.setExpert(false);
397: prop_childCount.setHidden(true);
398: prop_childCount.setPreferred(false);
399: prop_childCount
400: .setValue(
401: Constants.PropertyDescriptor.CATEGORY,
402: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
403:
404: PropertyDescriptor prop_children = new PropertyDescriptor(
405: "children", beanClass, "getChildren", null);
406: prop_children.setDisplayName(resources
407: .getString("Legend_children_DisplayName"));
408: prop_children.setShortDescription(resources
409: .getString("Legend_children_Description"));
410: prop_children.setExpert(false);
411: prop_children.setHidden(true);
412: prop_children.setPreferred(false);
413: prop_children
414: .setValue(
415: Constants.PropertyDescriptor.CATEGORY,
416: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
417:
418: PropertyDescriptor prop_converter = new PropertyDescriptor(
419: "converter", beanClass, "getConverter",
420: "setConverter");
421: prop_converter.setDisplayName(resources
422: .getString("Legend_converter_DisplayName"));
423: prop_converter.setShortDescription(resources
424: .getString("Legend_converter_Description"));
425: prop_converter
426: .setPropertyEditorClass(loadClass("org.netbeans.modules.visualweb.web.ui.dt.component.propertyeditors.JSF1_1ConverterPropertyEditor"));
427: prop_converter.setExpert(false);
428: prop_converter.setHidden(true);
429: prop_converter.setPreferred(false);
430: prop_converter
431: .setValue(
432: Constants.PropertyDescriptor.CATEGORY,
433: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
434:
435: PropertyDescriptor prop_facets = new PropertyDescriptor(
436: "facets", beanClass, "getFacets", null);
437: prop_facets.setDisplayName(resources
438: .getString("Legend_facets_DisplayName"));
439: prop_facets.setShortDescription(resources
440: .getString("Legend_facets_Description"));
441: prop_facets.setExpert(false);
442: prop_facets.setHidden(true);
443: prop_facets.setPreferred(false);
444: prop_facets
445: .setValue(
446: Constants.PropertyDescriptor.CATEGORY,
447: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
448:
449: PropertyDescriptor prop_family = new PropertyDescriptor(
450: "family", beanClass, "getFamily", null);
451: prop_family.setDisplayName(resources
452: .getString("Legend_family_DisplayName"));
453: prop_family.setShortDescription(resources
454: .getString("Legend_family_Description"));
455: prop_family.setExpert(false);
456: prop_family.setHidden(true);
457: prop_family.setPreferred(false);
458: prop_family
459: .setValue(
460: Constants.PropertyDescriptor.CATEGORY,
461: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
462:
463: PropertyDescriptor prop_id = new PropertyDescriptor("id",
464: beanClass, "getId", "setId");
465: prop_id.setDisplayName(resources
466: .getString("Legend_id_DisplayName"));
467: prop_id.setShortDescription(resources
468: .getString("Legend_id_Description"));
469: prop_id.setExpert(false);
470: prop_id.setHidden(true);
471: prop_id.setPreferred(false);
472: attrib = new AttributeDescriptor("id", false, null, true);
473: prop_id.setValue(
474: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
475: attrib);
476: prop_id
477: .setValue(
478: Constants.PropertyDescriptor.CATEGORY,
479: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
480:
481: PropertyDescriptor prop_localValue = new PropertyDescriptor(
482: "localValue", beanClass, "getLocalValue", null);
483: prop_localValue.setDisplayName(resources
484: .getString("Legend_localValue_DisplayName"));
485: prop_localValue.setShortDescription(resources
486: .getString("Legend_localValue_Description"));
487: prop_localValue.setExpert(false);
488: prop_localValue.setHidden(true);
489: prop_localValue.setPreferred(false);
490: prop_localValue
491: .setValue(
492: Constants.PropertyDescriptor.CATEGORY,
493: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
494:
495: PropertyDescriptor prop_parent = new PropertyDescriptor(
496: "parent", beanClass, "getParent", null);
497: prop_parent.setDisplayName(resources
498: .getString("Legend_parent_DisplayName"));
499: prop_parent.setShortDescription(resources
500: .getString("Legend_parent_Description"));
501: prop_parent.setExpert(false);
502: prop_parent.setHidden(true);
503: prop_parent.setPreferred(false);
504: prop_parent
505: .setValue(
506: Constants.PropertyDescriptor.CATEGORY,
507: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
508:
509: PropertyDescriptor prop_rendered = new PropertyDescriptor(
510: "rendered", beanClass, "isRendered", "setRendered");
511: prop_rendered.setDisplayName(resources
512: .getString("Legend_rendered_DisplayName"));
513: prop_rendered.setShortDescription(resources
514: .getString("Legend_rendered_Description"));
515: prop_rendered.setExpert(false);
516: prop_rendered.setHidden(false);
517: prop_rendered.setPreferred(false);
518: attrib = new AttributeDescriptor("rendered", false, null,
519: true);
520: prop_rendered.setValue(
521: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
522: attrib);
523: prop_rendered
524: .setValue(
525: Constants.PropertyDescriptor.CATEGORY,
526: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
527:
528: PropertyDescriptor prop_rendererType = new PropertyDescriptor(
529: "rendererType", beanClass, "getRendererType",
530: "setRendererType");
531: prop_rendererType.setDisplayName(resources
532: .getString("Legend_rendererType_DisplayName"));
533: prop_rendererType.setShortDescription(resources
534: .getString("Legend_rendererType_Description"));
535: prop_rendererType.setExpert(false);
536: prop_rendererType.setHidden(true);
537: prop_rendererType.setPreferred(false);
538: prop_rendererType
539: .setValue(
540: Constants.PropertyDescriptor.CATEGORY,
541: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
542:
543: PropertyDescriptor prop_rendersChildren = new PropertyDescriptor(
544: "rendersChildren", beanClass, "getRendersChildren",
545: null);
546: prop_rendersChildren.setDisplayName(resources
547: .getString("Legend_rendersChildren_DisplayName"));
548: prop_rendersChildren.setShortDescription(resources
549: .getString("Legend_rendersChildren_Description"));
550: prop_rendersChildren.setExpert(false);
551: prop_rendersChildren.setHidden(true);
552: prop_rendersChildren.setPreferred(false);
553: prop_rendersChildren
554: .setValue(
555: Constants.PropertyDescriptor.CATEGORY,
556: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
557:
558: PropertyDescriptor prop_value = new PropertyDescriptor(
559: "value", beanClass, "getValue", "setValue");
560: prop_value.setDisplayName(resources
561: .getString("Legend_value_DisplayName"));
562: prop_value.setShortDescription(resources
563: .getString("Legend_value_Description"));
564: prop_value.setExpert(false);
565: prop_value.setHidden(true);
566: prop_value.setPreferred(false);
567: prop_value
568: .setValue(
569: Constants.PropertyDescriptor.CATEGORY,
570: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
571:
572: propDescriptors = new PropertyDescriptor[] {
573: prop_attributes, prop_childCount, prop_children,
574: prop_converter, prop_facets, prop_family, prop_id,
575: prop_localValue, prop_parent, prop_position,
576: prop_rendered, prop_rendererType,
577: prop_rendersChildren, prop_style, prop_styleClass,
578: prop_text, prop_value, prop_visible, };
579: return propDescriptors;
580:
581: } catch (IntrospectionException e) {
582: e.printStackTrace();
583: return null;
584: }
585:
586: }
587:
588: }
589: //GEN-END:BeanInfo
|