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.dataprovider.designtime.impl;
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 MethodResultTableDataProviderBeanInfoBase extends
066: SimpleBeanInfo {
067:
068: protected static ResourceBundle resources = ResourceBundle
069: .getBundle(
070: "org.netbeans.modules.visualweb.dataprovider.designtime.impl.Bundle-JSF",
071: Locale.getDefault(),
072: MethodResultTableDataProviderBeanInfoBase.class
073: .getClassLoader());
074:
075: /**
076: * <p>Construct a new <code>MethodResultTableDataProviderBeanInfoBase</code>.</p>
077: */
078: public MethodResultTableDataProviderBeanInfoBase() {
079:
080: beanClass = com.sun.data.provider.impl.MethodResultTableDataProvider.class;
081: iconFileName_C16 = "/org/netbeans/modules/visualweb/dataprovider/designtime/impl/MethodResultTableDataProvider_C16";
082: iconFileName_C32 = "/org/netbeans/modules/visualweb/dataprovider/designtime/impl/MethodResultTableDataProvider_C32";
083: iconFileName_M16 = "/org/netbeans/modules/visualweb/dataprovider/designtime/impl/MethodResultTableDataProvider_M16";
084: iconFileName_M32 = "/org/netbeans/modules/visualweb/dataprovider/designtime/impl/MethodResultTableDataProvider_M32";
085:
086: }
087:
088: /**
089: * <p>The bean class that this BeanInfo represents.
090: */
091: protected Class beanClass;
092:
093: /**
094: * <p>The cached BeanDescriptor.</p>
095: */
096: protected BeanDescriptor beanDescriptor;
097:
098: /**
099: * <p>The index of the default property.</p>
100: */
101: protected int defaultPropertyIndex = -2;
102:
103: /**
104: * <p>The name of the default property.</p>
105: */
106: protected String defaultPropertyName;
107:
108: /**
109: * <p>The 16x16 color icon.</p>
110: */
111: protected String iconFileName_C16;
112:
113: /**
114: * <p>The 32x32 color icon.</p>
115: */
116: protected String iconFileName_C32;
117:
118: /**
119: * <p>The 16x16 monochrome icon.</p>
120: */
121: protected String iconFileName_M16;
122:
123: /**
124: * <p>The 32x32 monochrome icon.</p>
125: */
126: protected String iconFileName_M32;
127:
128: /**
129: * <p>The cached property descriptors.</p>
130: */
131: protected PropertyDescriptor[] propDescriptors;
132:
133: /**
134: * <p>Return the <code>BeanDescriptor</code> for this bean.</p>
135: */
136: public BeanDescriptor getBeanDescriptor() {
137:
138: if (beanDescriptor != null) {
139: return beanDescriptor;
140: }
141:
142: beanDescriptor = new BeanDescriptor(beanClass);
143: beanDescriptor
144: .setDisplayName(resources
145: .getString("MethodResultTableDataProvider_DisplayName"));
146: beanDescriptor
147: .setShortDescription(resources
148: .getString("MethodResultTableDataProvider_Description"));
149: beanDescriptor.setExpert(false);
150: beanDescriptor.setHidden(false);
151: beanDescriptor.setPreferred(false);
152: beanDescriptor.setValue(
153: Constants.BeanDescriptor.FACET_DESCRIPTORS,
154: getFacetDescriptors());
155: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
156: "methodResultTableDataProvider");
157: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
158: Boolean.TRUE);
159: beanDescriptor.setValue(
160: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
161: getCategoryDescriptors());
162:
163: return beanDescriptor;
164:
165: }
166:
167: /**
168: * <p>Return the <code>CategoryDescriptor</code> array for the property categories of this component.</p>
169: */
170: private CategoryDescriptor[] getCategoryDescriptors() {
171:
172: return com.sun.rave.designtime.base.CategoryDescriptors
173: .getDefaultCategoryDescriptors();
174:
175: }
176:
177: /**
178: * <p>Return the index of the default property, or
179: * -1 if there is no default property.</p>
180: */
181: public int getDefaultPropertyIndex() {
182:
183: if (defaultPropertyIndex > -2) {
184: return defaultPropertyIndex;
185: } else {
186: if (defaultPropertyName == null) {
187: defaultPropertyIndex = -1;
188: } else {
189: PropertyDescriptor pd[] = getPropertyDescriptors();
190: for (int i = 0; i < pd.length; i++) {
191: if (defaultPropertyName.equals(pd[i].getName())) {
192: defaultPropertyIndex = i;
193: break;
194: }
195: }
196: }
197: }
198: return defaultPropertyIndex;
199: }
200:
201: /**
202: * <p>The cached facet descriptors.</p>
203: */
204: protected FacetDescriptor[] facetDescriptors;
205:
206: /**
207: * <p>Return the <code>FacetDescriptor</code>s for this bean.</p>
208: */
209: public FacetDescriptor[] getFacetDescriptors() {
210:
211: if (facetDescriptors != null) {
212: return facetDescriptors;
213: }
214: facetDescriptors = new FacetDescriptor[] {};
215: return facetDescriptors;
216:
217: }
218:
219: /**
220: * <p>Return the specified image (if any)
221: * for this component class.</p>
222: */
223: public Image getIcon(int kind) {
224:
225: String name;
226: switch (kind) {
227: case ICON_COLOR_16x16:
228: name = iconFileName_C16;
229: break;
230: case ICON_COLOR_32x32:
231: name = iconFileName_C32;
232: break;
233: case ICON_MONO_16x16:
234: name = iconFileName_M16;
235: break;
236: case ICON_MONO_32x32:
237: name = iconFileName_M32;
238: break;
239: default:
240: name = null;
241: break;
242: }
243: if (name == null) {
244: return null;
245: }
246:
247: Image image = loadImage(name + ".png");
248: if (image == null) {
249: image = loadImage(name + ".gif");
250: }
251: return image;
252:
253: }
254:
255: /**
256: * <p>Return a class loaded by name via the class loader that loaded this class.</p>
257: */
258: private java.lang.Class loadClass(java.lang.String name) {
259:
260: try {
261: return Class.forName(name);
262: } catch (ClassNotFoundException e) {
263: throw new RuntimeException(e);
264: }
265:
266: }
267:
268: /**
269: * <p>Return the <code>PropertyDescriptor</code>s for this bean.</p>
270: */
271: public PropertyDescriptor[] getPropertyDescriptors() {
272:
273: if (propDescriptors != null) {
274: return propDescriptors;
275: }
276: AttributeDescriptor attrib = null;
277:
278: try {
279:
280: PropertyDescriptor prop_class = new PropertyDescriptor(
281: "class", beanClass, "getClass", null);
282: prop_class
283: .setDisplayName(resources
284: .getString("MethodResultTableDataProvider_class_DisplayName"));
285: prop_class
286: .setShortDescription(resources
287: .getString("MethodResultTableDataProvider_class_Description"));
288: prop_class.setExpert(false);
289: prop_class.setHidden(true);
290: prop_class.setPreferred(false);
291: prop_class
292: .setValue(
293: Constants.PropertyDescriptor.CATEGORY,
294: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
295:
296: PropertyDescriptor prop_dataClassInstance = new PropertyDescriptor(
297: "dataClassInstance", beanClass,
298: "getDataClassInstance", "setDataClassInstance");
299: prop_dataClassInstance
300: .setDisplayName(resources
301: .getString("MethodResultTableDataProvider_dataClassInstance_DisplayName"));
302: prop_dataClassInstance
303: .setShortDescription(resources
304: .getString("MethodResultTableDataProvider_dataClassInstance_Description"));
305: prop_dataClassInstance
306: .setPropertyEditorClass(loadClass("com.sun.rave.propertyeditors.SelectOneDomainEditor"));
307: prop_dataClassInstance.setExpert(false);
308: prop_dataClassInstance.setHidden(false);
309: prop_dataClassInstance.setPreferred(false);
310: prop_dataClassInstance
311: .setValue(
312: Constants.PropertyDescriptor.CATEGORY,
313: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
314: prop_dataClassInstance
315: .setValue(
316: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
317: loadClass("com.sun.rave.propertyeditors.domains.InstanceVariableDomain"));
318:
319: PropertyDescriptor prop_dataListeners = new PropertyDescriptor(
320: "dataListeners", beanClass, "getDataListeners",
321: null);
322: prop_dataListeners
323: .setDisplayName(resources
324: .getString("MethodResultTableDataProvider_dataListeners_DisplayName"));
325: prop_dataListeners
326: .setShortDescription(resources
327: .getString("MethodResultTableDataProvider_dataListeners_Description"));
328: prop_dataListeners.setExpert(false);
329: prop_dataListeners.setHidden(true);
330: prop_dataListeners.setPreferred(false);
331: prop_dataListeners
332: .setValue(
333: Constants.PropertyDescriptor.CATEGORY,
334: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
335:
336: PropertyDescriptor prop_dataMethod = new PropertyDescriptor(
337: "dataMethod", beanClass, "getDataMethod",
338: "setDataMethod");
339: prop_dataMethod
340: .setDisplayName(resources
341: .getString("MethodResultTableDataProvider_dataMethod_DisplayName"));
342: prop_dataMethod
343: .setShortDescription(resources
344: .getString("MethodResultTableDataProvider_dataMethod_Description"));
345: prop_dataMethod.setExpert(false);
346: prop_dataMethod.setHidden(false);
347: prop_dataMethod.setPreferred(false);
348: prop_dataMethod
349: .setValue(
350: Constants.PropertyDescriptor.CATEGORY,
351: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
352:
353: PropertyDescriptor prop_dataMethodArguments = new PropertyDescriptor(
354: "dataMethodArguments", beanClass,
355: "getDataMethodArguments", "setDataMethodArguments");
356: prop_dataMethodArguments
357: .setDisplayName(resources
358: .getString("MethodResultTableDataProvider_dataMethodArguments_DisplayName"));
359: prop_dataMethodArguments
360: .setShortDescription(resources
361: .getString("MethodResultTableDataProvider_dataMethodArguments_Description"));
362: prop_dataMethodArguments
363: .setPropertyEditorClass(loadClass("com.sun.rave.propertyeditors.SelectOneDomainEditor"));
364: prop_dataMethodArguments.setExpert(false);
365: prop_dataMethodArguments.setHidden(false);
366: prop_dataMethodArguments.setPreferred(false);
367: prop_dataMethodArguments
368: .setValue(
369: Constants.PropertyDescriptor.CATEGORY,
370: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
371: prop_dataMethodArguments
372: .setValue(
373: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
374: loadClass("com.sun.rave.propertyeditors.domains.InstanceVariableDomain"));
375:
376: PropertyDescriptor prop_fieldKeys = new PropertyDescriptor(
377: "fieldKeys", beanClass, "getFieldKeys", null);
378: prop_fieldKeys
379: .setDisplayName(resources
380: .getString("MethodResultTableDataProvider_fieldKeys_DisplayName"));
381: prop_fieldKeys
382: .setShortDescription(resources
383: .getString("MethodResultTableDataProvider_fieldKeys_Description"));
384: prop_fieldKeys.setExpert(false);
385: prop_fieldKeys.setHidden(true);
386: prop_fieldKeys.setPreferred(false);
387: prop_fieldKeys
388: .setValue(
389: Constants.PropertyDescriptor.CATEGORY,
390: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
391:
392: PropertyDescriptor prop_refreshableDataListeners = new PropertyDescriptor(
393: "refreshableDataListeners", beanClass,
394: "getRefreshableDataListeners", null);
395: prop_refreshableDataListeners
396: .setDisplayName(resources
397: .getString("MethodResultTableDataProvider_refreshableDataListeners_DisplayName"));
398: prop_refreshableDataListeners
399: .setShortDescription(resources
400: .getString("MethodResultTableDataProvider_refreshableDataListeners_Description"));
401: prop_refreshableDataListeners.setExpert(false);
402: prop_refreshableDataListeners.setHidden(true);
403: prop_refreshableDataListeners.setPreferred(false);
404: prop_refreshableDataListeners
405: .setValue(
406: Constants.PropertyDescriptor.CATEGORY,
407: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
408:
409: PropertyDescriptor prop_resultObject = new PropertyDescriptor(
410: "resultObject", beanClass, "getResultObject", null);
411: prop_resultObject
412: .setDisplayName(resources
413: .getString("MethodResultTableDataProvider_resultObject_DisplayName"));
414: prop_resultObject
415: .setShortDescription(resources
416: .getString("MethodResultTableDataProvider_resultObject_Description"));
417: prop_resultObject.setExpert(false);
418: prop_resultObject.setHidden(false);
419: prop_resultObject.setPreferred(false);
420: prop_resultObject
421: .setValue(
422: Constants.PropertyDescriptor.CATEGORY,
423: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
424:
425: PropertyDescriptor prop_resultObjects = new PropertyDescriptor(
426: "resultObjects", beanClass, "getResultObjects",
427: null);
428: prop_resultObjects
429: .setDisplayName(resources
430: .getString("MethodResultTableDataProvider_resultObjects_DisplayName"));
431: prop_resultObjects
432: .setShortDescription(resources
433: .getString("MethodResultTableDataProvider_resultObjects_Description"));
434: prop_resultObjects.setExpert(false);
435: prop_resultObjects.setHidden(false);
436: prop_resultObjects.setPreferred(false);
437: prop_resultObjects
438: .setValue(
439: Constants.PropertyDescriptor.CATEGORY,
440: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
441:
442: propDescriptors = new PropertyDescriptor[] { prop_class,
443: prop_dataClassInstance, prop_dataListeners,
444: prop_dataMethod, prop_dataMethodArguments,
445: prop_fieldKeys, prop_refreshableDataListeners,
446: prop_resultObject, prop_resultObjects, };
447: return propDescriptors;
448:
449: } catch (IntrospectionException e) {
450: e.printStackTrace();
451: return null;
452: }
453:
454: }
455:
456: }
457: //GEN-END:BeanInfo
|