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