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