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 ObjectArrayDataProviderBeanInfoBase 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: ObjectArrayDataProviderBeanInfoBase.class
073: .getClassLoader());
074:
075: /**
076: * <p>Construct a new <code>ObjectArrayDataProviderBeanInfoBase</code>.</p>
077: */
078: public ObjectArrayDataProviderBeanInfoBase() {
079:
080: beanClass = com.sun.data.provider.impl.ObjectArrayDataProvider.class;
081: iconFileName_C16 = "/org/netbeans/modules/visualweb/dataprovider/designtime/impl/ObjectArrayDataProvider_C16";
082: iconFileName_C32 = "/org/netbeans/modules/visualweb/dataprovider/designtime/impl/ObjectArrayDataProvider_C32";
083: iconFileName_M16 = "/org/netbeans/modules/visualweb/dataprovider/designtime/impl/ObjectArrayDataProvider_M16";
084: iconFileName_M32 = "/org/netbeans/modules/visualweb/dataprovider/designtime/impl/ObjectArrayDataProvider_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.setDisplayName(resources
144: .getString("ObjectArrayDataProvider_DisplayName"));
145: beanDescriptor.setShortDescription(resources
146: .getString("ObjectArrayDataProvider_Description"));
147: beanDescriptor.setExpert(false);
148: beanDescriptor.setHidden(false);
149: beanDescriptor.setPreferred(false);
150: beanDescriptor.setValue(
151: Constants.BeanDescriptor.FACET_DESCRIPTORS,
152: getFacetDescriptors());
153: beanDescriptor.setValue(Constants.BeanDescriptor.INSTANCE_NAME,
154: "objectArrayDataProvider");
155: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
156: Boolean.TRUE);
157: beanDescriptor.setValue(
158: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
159: getCategoryDescriptors());
160:
161: return beanDescriptor;
162:
163: }
164:
165: /**
166: * <p>Return the <code>CategoryDescriptor</code> array for the property categories of this component.</p>
167: */
168: private CategoryDescriptor[] getCategoryDescriptors() {
169:
170: return com.sun.rave.designtime.base.CategoryDescriptors
171: .getDefaultCategoryDescriptors();
172:
173: }
174:
175: /**
176: * <p>Return the index of the default property, or
177: * -1 if there is no default property.</p>
178: */
179: public int getDefaultPropertyIndex() {
180:
181: if (defaultPropertyIndex > -2) {
182: return defaultPropertyIndex;
183: } else {
184: if (defaultPropertyName == null) {
185: defaultPropertyIndex = -1;
186: } else {
187: PropertyDescriptor pd[] = getPropertyDescriptors();
188: for (int i = 0; i < pd.length; i++) {
189: if (defaultPropertyName.equals(pd[i].getName())) {
190: defaultPropertyIndex = i;
191: break;
192: }
193: }
194: }
195: }
196: return defaultPropertyIndex;
197: }
198:
199: /**
200: * <p>The cached facet descriptors.</p>
201: */
202: protected FacetDescriptor[] facetDescriptors;
203:
204: /**
205: * <p>Return the <code>FacetDescriptor</code>s for this bean.</p>
206: */
207: public FacetDescriptor[] getFacetDescriptors() {
208:
209: if (facetDescriptors != null) {
210: return facetDescriptors;
211: }
212: facetDescriptors = new FacetDescriptor[] {};
213: return facetDescriptors;
214:
215: }
216:
217: /**
218: * <p>Return the specified image (if any)
219: * for this component class.</p>
220: */
221: public Image getIcon(int kind) {
222:
223: String name;
224: switch (kind) {
225: case ICON_COLOR_16x16:
226: name = iconFileName_C16;
227: break;
228: case ICON_COLOR_32x32:
229: name = iconFileName_C32;
230: break;
231: case ICON_MONO_16x16:
232: name = iconFileName_M16;
233: break;
234: case ICON_MONO_32x32:
235: name = iconFileName_M32;
236: break;
237: default:
238: name = null;
239: break;
240: }
241: if (name == null) {
242: return null;
243: }
244:
245: Image image = loadImage(name + ".png");
246: if (image == null) {
247: image = loadImage(name + ".gif");
248: }
249: return image;
250:
251: }
252:
253: /**
254: * <p>Return a class loaded by name via the class loader that loaded this class.</p>
255: */
256: private java.lang.Class loadClass(java.lang.String name) {
257:
258: try {
259: return Class.forName(name);
260: } catch (ClassNotFoundException e) {
261: throw new RuntimeException(e);
262: }
263:
264: }
265:
266: /**
267: * <p>Return the <code>PropertyDescriptor</code>s for this bean.</p>
268: */
269: public PropertyDescriptor[] getPropertyDescriptors() {
270:
271: if (propDescriptors != null) {
272: return propDescriptors;
273: }
274: AttributeDescriptor attrib = null;
275:
276: try {
277:
278: PropertyDescriptor prop_array = new PropertyDescriptor(
279: "array", beanClass, "getArray", "setArray");
280: prop_array
281: .setDisplayName(resources
282: .getString("ObjectArrayDataProvider_array_DisplayName"));
283: prop_array
284: .setShortDescription(resources
285: .getString("ObjectArrayDataProvider_array_Description"));
286: prop_array
287: .setPropertyEditorClass(loadClass("com.sun.rave.propertyeditors.SelectOneDomainEditor"));
288: prop_array.setExpert(false);
289: prop_array.setHidden(false);
290: prop_array.setPreferred(false);
291: prop_array
292: .setValue(
293: Constants.PropertyDescriptor.CATEGORY,
294: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
295: prop_array
296: .setValue(
297: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
298: loadClass("com.sun.rave.propertyeditors.domains.InstanceVariableDomain"));
299:
300: PropertyDescriptor prop_class = new PropertyDescriptor(
301: "class", beanClass, "getClass", null);
302: prop_class
303: .setDisplayName(resources
304: .getString("ObjectArrayDataProvider_class_DisplayName"));
305: prop_class
306: .setShortDescription(resources
307: .getString("ObjectArrayDataProvider_class_Description"));
308: prop_class.setExpert(false);
309: prop_class.setHidden(true);
310: prop_class.setPreferred(false);
311: prop_class
312: .setValue(
313: Constants.PropertyDescriptor.CATEGORY,
314: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
315:
316: PropertyDescriptor prop_cursorRow = new PropertyDescriptor(
317: "cursorRow", beanClass, "getCursorRow",
318: "setCursorRow");
319: prop_cursorRow
320: .setDisplayName(resources
321: .getString("ObjectArrayDataProvider_cursorRow_DisplayName"));
322: prop_cursorRow
323: .setShortDescription(resources
324: .getString("ObjectArrayDataProvider_cursorRow_Description"));
325: prop_cursorRow.setExpert(false);
326: prop_cursorRow.setHidden(true);
327: prop_cursorRow.setPreferred(false);
328: prop_cursorRow
329: .setValue(
330: Constants.PropertyDescriptor.CATEGORY,
331: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
332:
333: PropertyDescriptor prop_dataListeners = new PropertyDescriptor(
334: "dataListeners", beanClass, "getDataListeners",
335: null);
336: prop_dataListeners
337: .setDisplayName(resources
338: .getString("ObjectArrayDataProvider_dataListeners_DisplayName"));
339: prop_dataListeners
340: .setShortDescription(resources
341: .getString("ObjectArrayDataProvider_dataListeners_Description"));
342: prop_dataListeners.setExpert(false);
343: prop_dataListeners.setHidden(true);
344: prop_dataListeners.setPreferred(false);
345: prop_dataListeners
346: .setValue(
347: Constants.PropertyDescriptor.CATEGORY,
348: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
349:
350: PropertyDescriptor prop_fieldKeys = new PropertyDescriptor(
351: "fieldKeys", beanClass, "getFieldKeys", null);
352: prop_fieldKeys
353: .setDisplayName(resources
354: .getString("ObjectArrayDataProvider_fieldKeys_DisplayName"));
355: prop_fieldKeys
356: .setShortDescription(resources
357: .getString("ObjectArrayDataProvider_fieldKeys_Description"));
358: prop_fieldKeys.setExpert(false);
359: prop_fieldKeys.setHidden(true);
360: prop_fieldKeys.setPreferred(false);
361: prop_fieldKeys
362: .setValue(
363: Constants.PropertyDescriptor.CATEGORY,
364: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
365:
366: PropertyDescriptor prop_includeFields = new PropertyDescriptor(
367: "includeFields", beanClass, "isIncludeFields",
368: "setIncludeFields");
369: prop_includeFields
370: .setDisplayName(resources
371: .getString("ObjectArrayDataProvider_includeFields_DisplayName"));
372: prop_includeFields
373: .setShortDescription(resources
374: .getString("ObjectArrayDataProvider_includeFields_Description"));
375: prop_includeFields.setExpert(false);
376: prop_includeFields.setHidden(false);
377: prop_includeFields.setPreferred(false);
378: prop_includeFields
379: .setValue(
380: Constants.PropertyDescriptor.CATEGORY,
381: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
382:
383: PropertyDescriptor prop_rowCount = new PropertyDescriptor(
384: "rowCount", beanClass, "getRowCount", null);
385: prop_rowCount
386: .setDisplayName(resources
387: .getString("ObjectArrayDataProvider_rowCount_DisplayName"));
388: prop_rowCount
389: .setShortDescription(resources
390: .getString("ObjectArrayDataProvider_rowCount_Description"));
391: prop_rowCount.setExpert(false);
392: prop_rowCount.setHidden(true);
393: prop_rowCount.setPreferred(false);
394: prop_rowCount
395: .setValue(
396: Constants.PropertyDescriptor.CATEGORY,
397: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
398:
399: PropertyDescriptor prop_tableCursorListeners = new PropertyDescriptor(
400: "tableCursorListeners", beanClass,
401: "getTableCursorListeners", null);
402: prop_tableCursorListeners
403: .setDisplayName(resources
404: .getString("ObjectArrayDataProvider_tableCursorListeners_DisplayName"));
405: prop_tableCursorListeners
406: .setShortDescription(resources
407: .getString("ObjectArrayDataProvider_tableCursorListeners_Description"));
408: prop_tableCursorListeners.setExpert(false);
409: prop_tableCursorListeners.setHidden(true);
410: prop_tableCursorListeners.setPreferred(false);
411: prop_tableCursorListeners
412: .setValue(
413: Constants.PropertyDescriptor.CATEGORY,
414: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
415:
416: PropertyDescriptor prop_tableDataListeners = new PropertyDescriptor(
417: "tableDataListeners", beanClass,
418: "getTableDataListeners", null);
419: prop_tableDataListeners
420: .setDisplayName(resources
421: .getString("ObjectArrayDataProvider_tableDataListeners_DisplayName"));
422: prop_tableDataListeners
423: .setShortDescription(resources
424: .getString("ObjectArrayDataProvider_tableDataListeners_Description"));
425: prop_tableDataListeners.setExpert(false);
426: prop_tableDataListeners.setHidden(true);
427: prop_tableDataListeners.setPreferred(false);
428: prop_tableDataListeners
429: .setValue(
430: Constants.PropertyDescriptor.CATEGORY,
431: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
432:
433: propDescriptors = new PropertyDescriptor[] { prop_array,
434: prop_class, prop_cursorRow, prop_dataListeners,
435: prop_fieldKeys, prop_includeFields, prop_rowCount,
436: prop_tableCursorListeners, prop_tableDataListeners, };
437: return propDescriptors;
438:
439: } catch (IntrospectionException e) {
440: e.printStackTrace();
441: return null;
442: }
443:
444: }
445:
446: }
447: //GEN-END:BeanInfo
|