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 HeadBeanInfoBase 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(), HeadBeanInfoBase.class
071: .getClassLoader());
072:
073: /**
074: * <p>Construct a new <code>HeadBeanInfoBase</code>.</p>
075: */
076: public HeadBeanInfoBase() {
077:
078: beanClass = com.sun.rave.web.ui.component.Head.class;
079: defaultPropertyName = "title";
080: iconFileName_C16 = "/org/netbeans/modules/visualweb/web/ui/dt/component/Head_C16";
081: iconFileName_C32 = "/org/netbeans/modules/visualweb/web/ui/dt/component/Head_C32";
082: iconFileName_M16 = "/org/netbeans/modules/visualweb/web/ui/dt/component/Head_M16";
083: iconFileName_M32 = "/org/netbeans/modules/visualweb/web/ui/dt/component/Head_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("Head_DisplayName"));
144: beanDescriptor.setShortDescription(resources
145: .getString("Head_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.setValue(Constants.BeanDescriptor.HELP_KEY,
153: "projrave_ui_elements_palette_html_elements_head");
154: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
155: "head");
156: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
157: Boolean.TRUE);
158: beanDescriptor.setValue(
159: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
160: getCategoryDescriptors());
161: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
162: "head");
163: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_PREFIX,
164: "ui");
165: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_URI,
166: "http://www.sun.com/web/ui");
167:
168: return beanDescriptor;
169:
170: }
171:
172: /**
173: * <p>Return the <code>CategoryDescriptor</code> array for the property categories of this component.</p>
174: */
175: private CategoryDescriptor[] getCategoryDescriptors() {
176:
177: return com.sun.rave.designtime.base.CategoryDescriptors
178: .getDefaultCategoryDescriptors();
179:
180: }
181:
182: /**
183: * <p>Return the index of the default property, or
184: * -1 if there is no default property.</p>
185: */
186: public int getDefaultPropertyIndex() {
187:
188: if (defaultPropertyIndex > -2) {
189: return defaultPropertyIndex;
190: } else {
191: if (defaultPropertyName == null) {
192: defaultPropertyIndex = -1;
193: } else {
194: PropertyDescriptor pd[] = getPropertyDescriptors();
195: for (int i = 0; i < pd.length; i++) {
196: if (defaultPropertyName.equals(pd[i].getName())) {
197: defaultPropertyIndex = i;
198: break;
199: }
200: }
201: }
202: }
203: return defaultPropertyIndex;
204: }
205:
206: /**
207: * <p>The cached facet descriptors.</p>
208: */
209: protected FacetDescriptor[] facetDescriptors;
210:
211: /**
212: * <p>Return the <code>FacetDescriptor</code>s for this bean.</p>
213: */
214: public FacetDescriptor[] getFacetDescriptors() {
215:
216: if (facetDescriptors != null) {
217: return facetDescriptors;
218: }
219: facetDescriptors = new FacetDescriptor[] {};
220: return facetDescriptors;
221:
222: }
223:
224: /**
225: * <p>Return the specified image (if any)
226: * for this component class.</p>
227: */
228: public Image getIcon(int kind) {
229:
230: String name;
231: switch (kind) {
232: case ICON_COLOR_16x16:
233: name = iconFileName_C16;
234: break;
235: case ICON_COLOR_32x32:
236: name = iconFileName_C32;
237: break;
238: case ICON_MONO_16x16:
239: name = iconFileName_M16;
240: break;
241: case ICON_MONO_32x32:
242: name = iconFileName_M32;
243: break;
244: default:
245: name = null;
246: break;
247: }
248: if (name == null) {
249: return null;
250: }
251:
252: Image image = loadImage(name + ".png");
253: if (image == null) {
254: image = loadImage(name + ".gif");
255: }
256: return image;
257:
258: }
259:
260: /**
261: * <p>Return a class loaded by name via the class loader that loaded this class.</p>
262: */
263: private java.lang.Class loadClass(java.lang.String name) {
264:
265: try {
266: return Class.forName(name);
267: } catch (ClassNotFoundException e) {
268: throw new RuntimeException(e);
269: }
270:
271: }
272:
273: /**
274: * <p>Return the <code>PropertyDescriptor</code>s for this bean.</p>
275: */
276: public PropertyDescriptor[] getPropertyDescriptors() {
277:
278: if (propDescriptors != null) {
279: return propDescriptors;
280: }
281: AttributeDescriptor attrib = null;
282:
283: try {
284:
285: PropertyDescriptor prop_defaultBase = new PropertyDescriptor(
286: "defaultBase", beanClass, "isDefaultBase",
287: "setDefaultBase");
288: prop_defaultBase.setDisplayName(resources
289: .getString("Head_defaultBase_DisplayName"));
290: prop_defaultBase.setShortDescription(resources
291: .getString("Head_defaultBase_Description"));
292: prop_defaultBase.setExpert(false);
293: prop_defaultBase.setHidden(false);
294: prop_defaultBase.setPreferred(false);
295: attrib = new AttributeDescriptor("defaultBase", false,
296: "false", true);
297: prop_defaultBase.setValue(
298: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
299: attrib);
300: prop_defaultBase
301: .setValue(
302: Constants.PropertyDescriptor.CATEGORY,
303: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
304:
305: PropertyDescriptor prop_profile = new PropertyDescriptor(
306: "profile", beanClass, "getProfile", "setProfile");
307: prop_profile.setDisplayName(resources
308: .getString("Head_profile_DisplayName"));
309: prop_profile.setShortDescription(resources
310: .getString("Head_profile_Description"));
311: prop_profile.setExpert(false);
312: prop_profile.setHidden(false);
313: prop_profile.setPreferred(false);
314: attrib = new AttributeDescriptor("profile", false, null,
315: true);
316: prop_profile.setValue(
317: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
318: attrib);
319: prop_profile
320: .setValue(
321: Constants.PropertyDescriptor.CATEGORY,
322: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
323:
324: PropertyDescriptor prop_title = new PropertyDescriptor(
325: "title", beanClass, "getTitle", "setTitle");
326: prop_title.setDisplayName(resources
327: .getString("Head_title_DisplayName"));
328: prop_title.setShortDescription(resources
329: .getString("Head_title_Description"));
330: prop_title.setExpert(false);
331: prop_title.setHidden(false);
332: prop_title.setPreferred(false);
333: attrib = new AttributeDescriptor("title", false, null, true);
334: prop_title.setValue(
335: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
336: attrib);
337: prop_title
338: .setValue(
339: Constants.PropertyDescriptor.CATEGORY,
340: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
341:
342: PropertyDescriptor prop_attributes = new PropertyDescriptor(
343: "attributes", beanClass, "getAttributes", null);
344: prop_attributes.setDisplayName(resources
345: .getString("Head_attributes_DisplayName"));
346: prop_attributes.setShortDescription(resources
347: .getString("Head_attributes_Description"));
348: prop_attributes.setExpert(false);
349: prop_attributes.setHidden(true);
350: prop_attributes.setPreferred(false);
351: prop_attributes
352: .setValue(
353: Constants.PropertyDescriptor.CATEGORY,
354: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
355:
356: PropertyDescriptor prop_childCount = new PropertyDescriptor(
357: "childCount", beanClass, "getChildCount", null);
358: prop_childCount.setDisplayName(resources
359: .getString("Head_childCount_DisplayName"));
360: prop_childCount.setShortDescription(resources
361: .getString("Head_childCount_Description"));
362: prop_childCount.setExpert(false);
363: prop_childCount.setHidden(true);
364: prop_childCount.setPreferred(false);
365: prop_childCount
366: .setValue(
367: Constants.PropertyDescriptor.CATEGORY,
368: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
369:
370: PropertyDescriptor prop_children = new PropertyDescriptor(
371: "children", beanClass, "getChildren", null);
372: prop_children.setDisplayName(resources
373: .getString("Head_children_DisplayName"));
374: prop_children.setShortDescription(resources
375: .getString("Head_children_Description"));
376: prop_children.setExpert(false);
377: prop_children.setHidden(true);
378: prop_children.setPreferred(false);
379: prop_children
380: .setValue(
381: Constants.PropertyDescriptor.CATEGORY,
382: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
383:
384: PropertyDescriptor prop_facets = new PropertyDescriptor(
385: "facets", beanClass, "getFacets", null);
386: prop_facets.setDisplayName(resources
387: .getString("Head_facets_DisplayName"));
388: prop_facets.setShortDescription(resources
389: .getString("Head_facets_Description"));
390: prop_facets.setExpert(false);
391: prop_facets.setHidden(true);
392: prop_facets.setPreferred(false);
393: prop_facets
394: .setValue(
395: Constants.PropertyDescriptor.CATEGORY,
396: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
397:
398: PropertyDescriptor prop_family = new PropertyDescriptor(
399: "family", beanClass, "getFamily", null);
400: prop_family.setDisplayName(resources
401: .getString("Head_family_DisplayName"));
402: prop_family.setShortDescription(resources
403: .getString("Head_family_Description"));
404: prop_family.setExpert(false);
405: prop_family.setHidden(true);
406: prop_family.setPreferred(false);
407: prop_family
408: .setValue(
409: Constants.PropertyDescriptor.CATEGORY,
410: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
411:
412: PropertyDescriptor prop_id = new PropertyDescriptor("id",
413: beanClass, "getId", "setId");
414: prop_id.setDisplayName(resources
415: .getString("Head_id_DisplayName"));
416: prop_id.setShortDescription(resources
417: .getString("Head_id_Description"));
418: prop_id.setExpert(false);
419: prop_id.setHidden(true);
420: prop_id.setPreferred(false);
421: attrib = new AttributeDescriptor("id", false, null, false);
422: prop_id.setValue(
423: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
424: attrib);
425: prop_id
426: .setValue(
427: Constants.PropertyDescriptor.CATEGORY,
428: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
429:
430: PropertyDescriptor prop_parent = new PropertyDescriptor(
431: "parent", beanClass, "getParent", "setParent");
432: prop_parent.setDisplayName(resources
433: .getString("Head_parent_DisplayName"));
434: prop_parent.setShortDescription(resources
435: .getString("Head_parent_Description"));
436: prop_parent.setExpert(false);
437: prop_parent.setHidden(true);
438: prop_parent.setPreferred(false);
439: prop_parent
440: .setValue(
441: Constants.PropertyDescriptor.CATEGORY,
442: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
443:
444: PropertyDescriptor prop_rendered = new PropertyDescriptor(
445: "rendered", beanClass, "isRendered", "setRendered");
446: prop_rendered.setDisplayName(resources
447: .getString("Head_rendered_DisplayName"));
448: prop_rendered.setShortDescription(resources
449: .getString("Head_rendered_Description"));
450: prop_rendered.setExpert(false);
451: prop_rendered.setHidden(false);
452: prop_rendered.setPreferred(false);
453: attrib = new AttributeDescriptor("rendered", false, null,
454: true);
455: prop_rendered.setValue(
456: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
457: attrib);
458: prop_rendered
459: .setValue(
460: Constants.PropertyDescriptor.CATEGORY,
461: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
462:
463: PropertyDescriptor prop_rendererType = new PropertyDescriptor(
464: "rendererType", beanClass, "getRendererType",
465: "setRendererType");
466: prop_rendererType.setDisplayName(resources
467: .getString("Head_rendererType_DisplayName"));
468: prop_rendererType.setShortDescription(resources
469: .getString("Head_rendererType_Description"));
470: prop_rendererType.setExpert(false);
471: prop_rendererType.setHidden(true);
472: prop_rendererType.setPreferred(false);
473: prop_rendererType
474: .setValue(
475: Constants.PropertyDescriptor.CATEGORY,
476: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
477:
478: PropertyDescriptor prop_rendersChildren = new PropertyDescriptor(
479: "rendersChildren", beanClass, "getRendersChildren",
480: null);
481: prop_rendersChildren.setDisplayName(resources
482: .getString("Head_rendersChildren_DisplayName"));
483: prop_rendersChildren.setShortDescription(resources
484: .getString("Head_rendersChildren_Description"));
485: prop_rendersChildren.setExpert(false);
486: prop_rendersChildren.setHidden(true);
487: prop_rendersChildren.setPreferred(false);
488: prop_rendersChildren
489: .setValue(
490: Constants.PropertyDescriptor.CATEGORY,
491: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
492:
493: propDescriptors = new PropertyDescriptor[] {
494: prop_attributes, prop_childCount, prop_children,
495: prop_defaultBase, prop_facets, prop_family,
496: prop_id, prop_parent, prop_profile, prop_rendered,
497: prop_rendererType, prop_rendersChildren,
498: prop_title, };
499: return propDescriptors;
500:
501: } catch (IntrospectionException e) {
502: e.printStackTrace();
503: return null;
504: }
505:
506: }
507:
508: }
509: //GEN-END:BeanInfo
|