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