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 LinkBeanInfoBase 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(), LinkBeanInfoBase.class
071: .getClassLoader());
072:
073: /**
074: * <p>Construct a new <code>LinkBeanInfoBase</code>.</p>
075: */
076: public LinkBeanInfoBase() {
077:
078: beanClass = com.sun.rave.web.ui.component.Link.class;
079: defaultPropertyName = "url";
080: iconFileName_C16 = "/org/netbeans/modules/visualweb/web/ui/dt/component/Link_C16";
081: iconFileName_C32 = "/org/netbeans/modules/visualweb/web/ui/dt/component/Link_C32";
082: iconFileName_M16 = "/org/netbeans/modules/visualweb/web/ui/dt/component/Link_M16";
083: iconFileName_M32 = "/org/netbeans/modules/visualweb/web/ui/dt/component/Link_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("Link_DisplayName"));
144: beanDescriptor.setShortDescription(resources
145: .getString("Link_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_bh_link");
154: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
155: "link");
156: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
157: Boolean.FALSE);
158: beanDescriptor.setValue(
159: Constants.BeanDescriptor.MARKUP_SECTION, "head");
160: beanDescriptor
161: .setValue(Constants.BeanDescriptor.PROPERTIES_HELP_KEY,
162: "projrave_ui_elements_palette_bh_propsheets_bh_link_props");
163: beanDescriptor.setValue(
164: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
165: getCategoryDescriptors());
166: beanDescriptor.setValue(Constants.BeanDescriptor.TAG_NAME,
167: "link");
168: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_PREFIX,
169: "ui");
170: beanDescriptor.setValue(Constants.BeanDescriptor.TAGLIB_URI,
171: "http://www.sun.com/web/ui");
172:
173: return beanDescriptor;
174:
175: }
176:
177: /**
178: * <p>Return the <code>CategoryDescriptor</code> array for the property categories of this component.</p>
179: */
180: private CategoryDescriptor[] getCategoryDescriptors() {
181:
182: return com.sun.rave.designtime.base.CategoryDescriptors
183: .getDefaultCategoryDescriptors();
184:
185: }
186:
187: /**
188: * <p>Return the index of the default property, or
189: * -1 if there is no default property.</p>
190: */
191: public int getDefaultPropertyIndex() {
192:
193: if (defaultPropertyIndex > -2) {
194: return defaultPropertyIndex;
195: } else {
196: if (defaultPropertyName == null) {
197: defaultPropertyIndex = -1;
198: } else {
199: PropertyDescriptor pd[] = getPropertyDescriptors();
200: for (int i = 0; i < pd.length; i++) {
201: if (defaultPropertyName.equals(pd[i].getName())) {
202: defaultPropertyIndex = i;
203: break;
204: }
205: }
206: }
207: }
208: return defaultPropertyIndex;
209: }
210:
211: /**
212: * <p>The cached facet descriptors.</p>
213: */
214: protected FacetDescriptor[] facetDescriptors;
215:
216: /**
217: * <p>Return the <code>FacetDescriptor</code>s for this bean.</p>
218: */
219: public FacetDescriptor[] getFacetDescriptors() {
220:
221: if (facetDescriptors != null) {
222: return facetDescriptors;
223: }
224: facetDescriptors = new FacetDescriptor[] {};
225: return facetDescriptors;
226:
227: }
228:
229: /**
230: * <p>Return the specified image (if any)
231: * for this component class.</p>
232: */
233: public Image getIcon(int kind) {
234:
235: String name;
236: switch (kind) {
237: case ICON_COLOR_16x16:
238: name = iconFileName_C16;
239: break;
240: case ICON_COLOR_32x32:
241: name = iconFileName_C32;
242: break;
243: case ICON_MONO_16x16:
244: name = iconFileName_M16;
245: break;
246: case ICON_MONO_32x32:
247: name = iconFileName_M32;
248: break;
249: default:
250: name = null;
251: break;
252: }
253: if (name == null) {
254: return null;
255: }
256:
257: Image image = loadImage(name + ".png");
258: if (image == null) {
259: image = loadImage(name + ".gif");
260: }
261: return image;
262:
263: }
264:
265: /**
266: * <p>Return a class loaded by name via the class loader that loaded this class.</p>
267: */
268: private java.lang.Class loadClass(java.lang.String name) {
269:
270: try {
271: return Class.forName(name);
272: } catch (ClassNotFoundException e) {
273: throw new RuntimeException(e);
274: }
275:
276: }
277:
278: /**
279: * <p>Return the <code>PropertyDescriptor</code>s for this bean.</p>
280: */
281: public PropertyDescriptor[] getPropertyDescriptors() {
282:
283: if (propDescriptors != null) {
284: return propDescriptors;
285: }
286: AttributeDescriptor attrib = null;
287:
288: try {
289:
290: PropertyDescriptor prop_charset = new PropertyDescriptor(
291: "charset", beanClass, "getCharset", "setCharset");
292: prop_charset.setDisplayName(resources
293: .getString("Link_charset_DisplayName"));
294: prop_charset.setShortDescription(resources
295: .getString("Link_charset_Description"));
296: prop_charset
297: .setPropertyEditorClass(loadClass("com.sun.rave.propertyeditors.SelectOneDomainEditor"));
298: prop_charset.setExpert(false);
299: prop_charset.setHidden(false);
300: prop_charset.setPreferred(false);
301: attrib = new AttributeDescriptor("charset", false, null,
302: true);
303: prop_charset.setValue(
304: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
305: attrib);
306: prop_charset
307: .setValue(
308: Constants.PropertyDescriptor.CATEGORY,
309: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
310: prop_charset
311: .setValue(
312: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
313: com.sun.rave.propertyeditors.domains.CharacterSetsDomain.class);
314:
315: PropertyDescriptor prop_media = new PropertyDescriptor(
316: "media", beanClass, "getMedia", "setMedia");
317: prop_media.setDisplayName(resources
318: .getString("Link_media_DisplayName"));
319: prop_media.setShortDescription(resources
320: .getString("Link_media_Description"));
321: prop_media
322: .setPropertyEditorClass(loadClass("com.sun.rave.propertyeditors.StringPropertyEditor"));
323: prop_media.setExpert(false);
324: prop_media.setHidden(false);
325: prop_media.setPreferred(false);
326: attrib = new AttributeDescriptor("media", false, null, true);
327: prop_media.setValue(
328: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
329: attrib);
330: prop_media
331: .setValue(
332: Constants.PropertyDescriptor.CATEGORY,
333: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
334:
335: PropertyDescriptor prop_rel = new PropertyDescriptor("rel",
336: beanClass, "getRel", "setRel");
337: prop_rel.setDisplayName(resources
338: .getString("Link_rel_DisplayName"));
339: prop_rel.setShortDescription(resources
340: .getString("Link_rel_Description"));
341: prop_rel
342: .setPropertyEditorClass(loadClass("com.sun.rave.propertyeditors.SelectOneDomainEditor"));
343: prop_rel.setExpert(false);
344: prop_rel.setHidden(false);
345: prop_rel.setPreferred(false);
346: attrib = new AttributeDescriptor("rel", false,
347: "\"stylesheet\"", true);
348: prop_rel.setValue(
349: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
350: attrib);
351: prop_rel
352: .setValue(
353: Constants.PropertyDescriptor.CATEGORY,
354: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
355: prop_rel
356: .setValue(
357: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
358: com.sun.rave.propertyeditors.domains.HtmlLinkTypesDomain.class);
359:
360: PropertyDescriptor prop_type = new PropertyDescriptor(
361: "type", beanClass, "getType", "setType");
362: prop_type.setDisplayName(resources
363: .getString("Link_type_DisplayName"));
364: prop_type.setShortDescription(resources
365: .getString("Link_type_Description"));
366: prop_type.setExpert(false);
367: prop_type.setHidden(false);
368: prop_type.setPreferred(false);
369: attrib = new AttributeDescriptor("type", false,
370: "\"text/css\"", true);
371: prop_type.setValue(
372: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
373: attrib);
374: prop_type
375: .setValue(
376: Constants.PropertyDescriptor.CATEGORY,
377: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
378:
379: PropertyDescriptor prop_url = new PropertyDescriptor("url",
380: beanClass, "getUrl", "setUrl");
381: prop_url.setDisplayName(resources
382: .getString("Link_url_DisplayName"));
383: prop_url.setShortDescription(resources
384: .getString("Link_url_Description"));
385: prop_url
386: .setPropertyEditorClass(loadClass("org.netbeans.modules.visualweb.web.ui.dt.component.propertyeditors.SunWebUrlPropertyEditor"));
387: prop_url.setExpert(false);
388: prop_url.setHidden(false);
389: prop_url.setPreferred(false);
390: attrib = new AttributeDescriptor("url", false, null, true);
391: prop_url.setValue(
392: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
393: attrib);
394: prop_url
395: .setValue(
396: Constants.PropertyDescriptor.CATEGORY,
397: com.sun.rave.designtime.base.CategoryDescriptors.APPEARANCE);
398:
399: PropertyDescriptor prop_urlLang = new PropertyDescriptor(
400: "urlLang", beanClass, "getUrlLang", "setUrlLang");
401: prop_urlLang.setDisplayName(resources
402: .getString("Link_urlLang_DisplayName"));
403: prop_urlLang.setShortDescription(resources
404: .getString("Link_urlLang_Description"));
405: prop_urlLang
406: .setPropertyEditorClass(loadClass("com.sun.rave.propertyeditors.SelectOneDomainEditor"));
407: prop_urlLang.setExpert(false);
408: prop_urlLang.setHidden(false);
409: prop_urlLang.setPreferred(false);
410: attrib = new AttributeDescriptor("urlLang", false, null,
411: true);
412: prop_urlLang.setValue(
413: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
414: attrib);
415: prop_urlLang
416: .setValue(
417: Constants.PropertyDescriptor.CATEGORY,
418: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
419: prop_urlLang
420: .setValue(
421: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
422: com.sun.rave.propertyeditors.domains.LanguagesDomain.class);
423:
424: PropertyDescriptor prop_attributes = new PropertyDescriptor(
425: "attributes", beanClass, "getAttributes", null);
426: prop_attributes.setDisplayName(resources
427: .getString("Link_attributes_DisplayName"));
428: prop_attributes.setShortDescription(resources
429: .getString("Link_attributes_Description"));
430: prop_attributes.setExpert(false);
431: prop_attributes.setHidden(true);
432: prop_attributes.setPreferred(false);
433: prop_attributes
434: .setValue(
435: Constants.PropertyDescriptor.CATEGORY,
436: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
437:
438: PropertyDescriptor prop_childCount = new PropertyDescriptor(
439: "childCount", beanClass, "getChildCount", null);
440: prop_childCount.setDisplayName(resources
441: .getString("Link_childCount_DisplayName"));
442: prop_childCount.setShortDescription(resources
443: .getString("Link_childCount_Description"));
444: prop_childCount.setExpert(false);
445: prop_childCount.setHidden(true);
446: prop_childCount.setPreferred(false);
447: prop_childCount
448: .setValue(
449: Constants.PropertyDescriptor.CATEGORY,
450: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
451:
452: PropertyDescriptor prop_children = new PropertyDescriptor(
453: "children", beanClass, "getChildren", null);
454: prop_children.setDisplayName(resources
455: .getString("Link_children_DisplayName"));
456: prop_children.setShortDescription(resources
457: .getString("Link_children_Description"));
458: prop_children.setExpert(false);
459: prop_children.setHidden(true);
460: prop_children.setPreferred(false);
461: prop_children
462: .setValue(
463: Constants.PropertyDescriptor.CATEGORY,
464: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
465:
466: PropertyDescriptor prop_facets = new PropertyDescriptor(
467: "facets", beanClass, "getFacets", null);
468: prop_facets.setDisplayName(resources
469: .getString("Link_facets_DisplayName"));
470: prop_facets.setShortDescription(resources
471: .getString("Link_facets_Description"));
472: prop_facets.setExpert(false);
473: prop_facets.setHidden(true);
474: prop_facets.setPreferred(false);
475: prop_facets
476: .setValue(
477: Constants.PropertyDescriptor.CATEGORY,
478: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
479:
480: PropertyDescriptor prop_family = new PropertyDescriptor(
481: "family", beanClass, "getFamily", null);
482: prop_family.setDisplayName(resources
483: .getString("Link_family_DisplayName"));
484: prop_family.setShortDescription(resources
485: .getString("Link_family_Description"));
486: prop_family.setExpert(false);
487: prop_family.setHidden(true);
488: prop_family.setPreferred(false);
489: prop_family
490: .setValue(
491: Constants.PropertyDescriptor.CATEGORY,
492: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
493:
494: PropertyDescriptor prop_id = new PropertyDescriptor("id",
495: beanClass, "getId", "setId");
496: prop_id.setDisplayName(resources
497: .getString("Link_id_DisplayName"));
498: prop_id.setShortDescription(resources
499: .getString("Link_id_Description"));
500: prop_id.setExpert(false);
501: prop_id.setHidden(true);
502: prop_id.setPreferred(false);
503: attrib = new AttributeDescriptor("id", false, null, false);
504: prop_id.setValue(
505: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
506: attrib);
507: prop_id
508: .setValue(
509: Constants.PropertyDescriptor.CATEGORY,
510: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
511:
512: PropertyDescriptor prop_parent = new PropertyDescriptor(
513: "parent", beanClass, "getParent", "setParent");
514: prop_parent.setDisplayName(resources
515: .getString("Link_parent_DisplayName"));
516: prop_parent.setShortDescription(resources
517: .getString("Link_parent_Description"));
518: prop_parent.setExpert(false);
519: prop_parent.setHidden(true);
520: prop_parent.setPreferred(false);
521: prop_parent
522: .setValue(
523: Constants.PropertyDescriptor.CATEGORY,
524: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
525:
526: PropertyDescriptor prop_rendered = new PropertyDescriptor(
527: "rendered", beanClass, "isRendered", "setRendered");
528: prop_rendered.setDisplayName(resources
529: .getString("Link_rendered_DisplayName"));
530: prop_rendered.setShortDescription(resources
531: .getString("Link_rendered_Description"));
532: prop_rendered.setExpert(false);
533: prop_rendered.setHidden(false);
534: prop_rendered.setPreferred(false);
535: attrib = new AttributeDescriptor("rendered", false, null,
536: true);
537: prop_rendered.setValue(
538: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
539: attrib);
540: prop_rendered
541: .setValue(
542: Constants.PropertyDescriptor.CATEGORY,
543: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
544:
545: PropertyDescriptor prop_rendererType = new PropertyDescriptor(
546: "rendererType", beanClass, "getRendererType",
547: "setRendererType");
548: prop_rendererType.setDisplayName(resources
549: .getString("Link_rendererType_DisplayName"));
550: prop_rendererType.setShortDescription(resources
551: .getString("Link_rendererType_Description"));
552: prop_rendererType.setExpert(false);
553: prop_rendererType.setHidden(true);
554: prop_rendererType.setPreferred(false);
555: prop_rendererType
556: .setValue(
557: Constants.PropertyDescriptor.CATEGORY,
558: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
559:
560: PropertyDescriptor prop_rendersChildren = new PropertyDescriptor(
561: "rendersChildren", beanClass, "getRendersChildren",
562: null);
563: prop_rendersChildren.setDisplayName(resources
564: .getString("Link_rendersChildren_DisplayName"));
565: prop_rendersChildren.setShortDescription(resources
566: .getString("Link_rendersChildren_Description"));
567: prop_rendersChildren.setExpert(false);
568: prop_rendersChildren.setHidden(true);
569: prop_rendersChildren.setPreferred(false);
570: prop_rendersChildren
571: .setValue(
572: Constants.PropertyDescriptor.CATEGORY,
573: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
574:
575: propDescriptors = new PropertyDescriptor[] {
576: prop_attributes, prop_charset, prop_childCount,
577: prop_children, prop_facets, prop_family, prop_id,
578: prop_media, prop_parent, prop_rel, prop_rendered,
579: prop_rendererType, prop_rendersChildren, prop_type,
580: prop_url, prop_urlLang, };
581: return propDescriptors;
582:
583: } catch (IntrospectionException e) {
584: e.printStackTrace();
585: return null;
586: }
587:
588: }
589:
590: }
591: //GEN-END:BeanInfo
|