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 HtmlBeanInfoBase 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(), HtmlBeanInfoBase.class
071: .getClassLoader());
072:
073: /**
074: * <p>Construct a new <code>HtmlBeanInfoBase</code>.</p>
075: */
076: public HtmlBeanInfoBase() {
077:
078: beanClass = com.sun.rave.web.ui.component.Html.class;
079: defaultPropertyName = "xmlns";
080: iconFileName_C16 = "/org/netbeans/modules/visualweb/web/ui/dt/component/Html_C16";
081: iconFileName_C32 = "/org/netbeans/modules/visualweb/web/ui/dt/component/Html_C32";
082: iconFileName_M16 = "/org/netbeans/modules/visualweb/web/ui/dt/component/Html_M16";
083: iconFileName_M32 = "/org/netbeans/modules/visualweb/web/ui/dt/component/Html_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("Html_DisplayName"));
144: beanDescriptor.setShortDescription(resources
145: .getString("Html_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_html");
154: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
155: "html");
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: "html");
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_lang = new PropertyDescriptor(
286: "lang", beanClass, "getLang", "setLang");
287: prop_lang.setDisplayName(resources
288: .getString("Html_lang_DisplayName"));
289: prop_lang.setShortDescription(resources
290: .getString("Html_lang_Description"));
291: prop_lang.setExpert(false);
292: prop_lang.setHidden(false);
293: prop_lang.setPreferred(false);
294: attrib = new AttributeDescriptor("lang", false, null, true);
295: prop_lang.setValue(
296: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
297: attrib);
298: prop_lang
299: .setValue(
300: Constants.PropertyDescriptor.CATEGORY,
301: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
302:
303: PropertyDescriptor prop_xmlns = new PropertyDescriptor(
304: "xmlns", beanClass, "getXmlns", "setXmlns");
305: prop_xmlns.setDisplayName(resources
306: .getString("Html_xmlns_DisplayName"));
307: prop_xmlns.setShortDescription(resources
308: .getString("Html_xmlns_Description"));
309: prop_xmlns.setExpert(false);
310: prop_xmlns.setHidden(false);
311: prop_xmlns.setPreferred(false);
312: attrib = new AttributeDescriptor("xmlns", false,
313: "\"http://www.w3.org/1999/xhtml\"", true);
314: prop_xmlns.setValue(
315: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
316: attrib);
317: prop_xmlns
318: .setValue(
319: Constants.PropertyDescriptor.CATEGORY,
320: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
321:
322: PropertyDescriptor prop_attributes = new PropertyDescriptor(
323: "attributes", beanClass, "getAttributes", null);
324: prop_attributes.setDisplayName(resources
325: .getString("Html_attributes_DisplayName"));
326: prop_attributes.setShortDescription(resources
327: .getString("Html_attributes_Description"));
328: prop_attributes.setExpert(false);
329: prop_attributes.setHidden(true);
330: prop_attributes.setPreferred(false);
331: prop_attributes
332: .setValue(
333: Constants.PropertyDescriptor.CATEGORY,
334: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
335:
336: PropertyDescriptor prop_childCount = new PropertyDescriptor(
337: "childCount", beanClass, "getChildCount", null);
338: prop_childCount.setDisplayName(resources
339: .getString("Html_childCount_DisplayName"));
340: prop_childCount.setShortDescription(resources
341: .getString("Html_childCount_Description"));
342: prop_childCount.setExpert(false);
343: prop_childCount.setHidden(true);
344: prop_childCount.setPreferred(false);
345: prop_childCount
346: .setValue(
347: Constants.PropertyDescriptor.CATEGORY,
348: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
349:
350: PropertyDescriptor prop_children = new PropertyDescriptor(
351: "children", beanClass, "getChildren", null);
352: prop_children.setDisplayName(resources
353: .getString("Html_children_DisplayName"));
354: prop_children.setShortDescription(resources
355: .getString("Html_children_Description"));
356: prop_children.setExpert(false);
357: prop_children.setHidden(true);
358: prop_children.setPreferred(false);
359: prop_children
360: .setValue(
361: Constants.PropertyDescriptor.CATEGORY,
362: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
363:
364: PropertyDescriptor prop_facets = new PropertyDescriptor(
365: "facets", beanClass, "getFacets", null);
366: prop_facets.setDisplayName(resources
367: .getString("Html_facets_DisplayName"));
368: prop_facets.setShortDescription(resources
369: .getString("Html_facets_Description"));
370: prop_facets.setExpert(false);
371: prop_facets.setHidden(true);
372: prop_facets.setPreferred(false);
373: prop_facets
374: .setValue(
375: Constants.PropertyDescriptor.CATEGORY,
376: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
377:
378: PropertyDescriptor prop_family = new PropertyDescriptor(
379: "family", beanClass, "getFamily", null);
380: prop_family.setDisplayName(resources
381: .getString("Html_family_DisplayName"));
382: prop_family.setShortDescription(resources
383: .getString("Html_family_Description"));
384: prop_family.setExpert(false);
385: prop_family.setHidden(true);
386: prop_family.setPreferred(false);
387: prop_family
388: .setValue(
389: Constants.PropertyDescriptor.CATEGORY,
390: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
391:
392: PropertyDescriptor prop_id = new PropertyDescriptor("id",
393: beanClass, "getId", "setId");
394: prop_id.setDisplayName(resources
395: .getString("Html_id_DisplayName"));
396: prop_id.setShortDescription(resources
397: .getString("Html_id_Description"));
398: prop_id.setExpert(false);
399: prop_id.setHidden(true);
400: prop_id.setPreferred(false);
401: attrib = new AttributeDescriptor("id", false, null, false);
402: prop_id.setValue(
403: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
404: attrib);
405: prop_id
406: .setValue(
407: Constants.PropertyDescriptor.CATEGORY,
408: com.sun.rave.designtime.base.CategoryDescriptors.GENERAL);
409:
410: PropertyDescriptor prop_parent = new PropertyDescriptor(
411: "parent", beanClass, "getParent", "setParent");
412: prop_parent.setDisplayName(resources
413: .getString("Html_parent_DisplayName"));
414: prop_parent.setShortDescription(resources
415: .getString("Html_parent_Description"));
416: prop_parent.setExpert(false);
417: prop_parent.setHidden(true);
418: prop_parent.setPreferred(false);
419: prop_parent
420: .setValue(
421: Constants.PropertyDescriptor.CATEGORY,
422: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
423:
424: PropertyDescriptor prop_rendered = new PropertyDescriptor(
425: "rendered", beanClass, "isRendered", "setRendered");
426: prop_rendered.setDisplayName(resources
427: .getString("Html_rendered_DisplayName"));
428: prop_rendered.setShortDescription(resources
429: .getString("Html_rendered_Description"));
430: prop_rendered.setExpert(false);
431: prop_rendered.setHidden(false);
432: prop_rendered.setPreferred(false);
433: attrib = new AttributeDescriptor("rendered", false, null,
434: true);
435: prop_rendered.setValue(
436: Constants.PropertyDescriptor.ATTRIBUTE_DESCRIPTOR,
437: attrib);
438: prop_rendered
439: .setValue(
440: Constants.PropertyDescriptor.CATEGORY,
441: com.sun.rave.designtime.base.CategoryDescriptors.ADVANCED);
442:
443: PropertyDescriptor prop_rendererType = new PropertyDescriptor(
444: "rendererType", beanClass, "getRendererType",
445: "setRendererType");
446: prop_rendererType.setDisplayName(resources
447: .getString("Html_rendererType_DisplayName"));
448: prop_rendererType.setShortDescription(resources
449: .getString("Html_rendererType_Description"));
450: prop_rendererType.setExpert(false);
451: prop_rendererType.setHidden(true);
452: prop_rendererType.setPreferred(false);
453: prop_rendererType
454: .setValue(
455: Constants.PropertyDescriptor.CATEGORY,
456: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
457:
458: PropertyDescriptor prop_rendersChildren = new PropertyDescriptor(
459: "rendersChildren", beanClass, "getRendersChildren",
460: null);
461: prop_rendersChildren.setDisplayName(resources
462: .getString("Html_rendersChildren_DisplayName"));
463: prop_rendersChildren.setShortDescription(resources
464: .getString("Html_rendersChildren_Description"));
465: prop_rendersChildren.setExpert(false);
466: prop_rendersChildren.setHidden(true);
467: prop_rendersChildren.setPreferred(false);
468: prop_rendersChildren
469: .setValue(
470: Constants.PropertyDescriptor.CATEGORY,
471: com.sun.rave.designtime.base.CategoryDescriptors.INTERNAL);
472:
473: propDescriptors = new PropertyDescriptor[] {
474: prop_attributes, prop_childCount, prop_children,
475: prop_facets, prop_family, prop_id, prop_lang,
476: prop_parent, prop_rendered, prop_rendererType,
477: prop_rendersChildren, prop_xmlns, };
478: return propDescriptors;
479:
480: } catch (IntrospectionException e) {
481: e.printStackTrace();
482: return null;
483: }
484:
485: }
486:
487: }
488: //GEN-END:BeanInfo
|