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