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 TableRowDataProviderBeanInfoBase extends SimpleBeanInfo {
066:
067: protected static ResourceBundle resources = ResourceBundle
068: .getBundle(
069: "org.netbeans.modules.visualweb.dataprovider.designtime.impl.Bundle-JSF",
070: Locale.getDefault(),
071: TableRowDataProviderBeanInfoBase.class
072: .getClassLoader());
073:
074: /**
075: * <p>Construct a new <code>TableRowDataProviderBeanInfoBase</code>.</p>
076: */
077: public TableRowDataProviderBeanInfoBase() {
078:
079: beanClass = com.sun.data.provider.impl.TableRowDataProvider.class;
080: iconFileName_C16 = "/org/netbeans/modules/visualweb/dataprovider/designtime/impl/TableRowDataProvider_C16";
081: iconFileName_C32 = "/org/netbeans/modules/visualweb/dataprovider/designtime/impl/TableRowDataProvider_C32";
082: iconFileName_M16 = "/org/netbeans/modules/visualweb/dataprovider/designtime/impl/TableRowDataProvider_M16";
083: iconFileName_M32 = "/org/netbeans/modules/visualweb/dataprovider/designtime/impl/TableRowDataProvider_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("TableRowDataProvider_DisplayName"));
144: beanDescriptor.setShortDescription(resources
145: .getString("TableRowDataProvider_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: "tableRowDataProvider");
154: beanDescriptor.setValue(Constants.BeanDescriptor.IS_CONTAINER,
155: Boolean.TRUE);
156: beanDescriptor.setValue(
157: Constants.BeanDescriptor.PROPERTY_CATEGORIES,
158: getCategoryDescriptors());
159:
160: return beanDescriptor;
161:
162: }
163:
164: /**
165: * <p>Return the <code>CategoryDescriptor</code> array for the property categories of this component.</p>
166: */
167: private CategoryDescriptor[] getCategoryDescriptors() {
168:
169: return com.sun.rave.designtime.base.CategoryDescriptors
170: .getDefaultCategoryDescriptors();
171:
172: }
173:
174: /**
175: * <p>Return the index of the default property, or
176: * -1 if there is no default property.</p>
177: */
178: public int getDefaultPropertyIndex() {
179:
180: if (defaultPropertyIndex > -2) {
181: return defaultPropertyIndex;
182: } else {
183: if (defaultPropertyName == null) {
184: defaultPropertyIndex = -1;
185: } else {
186: PropertyDescriptor pd[] = getPropertyDescriptors();
187: for (int i = 0; i < pd.length; i++) {
188: if (defaultPropertyName.equals(pd[i].getName())) {
189: defaultPropertyIndex = i;
190: break;
191: }
192: }
193: }
194: }
195: return defaultPropertyIndex;
196: }
197:
198: /**
199: * <p>The cached facet descriptors.</p>
200: */
201: protected FacetDescriptor[] facetDescriptors;
202:
203: /**
204: * <p>Return the <code>FacetDescriptor</code>s for this bean.</p>
205: */
206: public FacetDescriptor[] getFacetDescriptors() {
207:
208: if (facetDescriptors != null) {
209: return facetDescriptors;
210: }
211: facetDescriptors = new FacetDescriptor[] {};
212: return facetDescriptors;
213:
214: }
215:
216: /**
217: * <p>Return the specified image (if any)
218: * for this component class.</p>
219: */
220: public Image getIcon(int kind) {
221:
222: String name;
223: switch (kind) {
224: case ICON_COLOR_16x16:
225: name = iconFileName_C16;
226: break;
227: case ICON_COLOR_32x32:
228: name = iconFileName_C32;
229: break;
230: case ICON_MONO_16x16:
231: name = iconFileName_M16;
232: break;
233: case ICON_MONO_32x32:
234: name = iconFileName_M32;
235: break;
236: default:
237: name = null;
238: break;
239: }
240: if (name == null) {
241: return null;
242: }
243:
244: Image image = loadImage(name + ".png");
245: if (image == null) {
246: image = loadImage(name + ".gif");
247: }
248: return image;
249:
250: }
251:
252: /**
253: * <p>Return a class loaded by name via the class loader that loaded this class.</p>
254: */
255: private java.lang.Class loadClass(java.lang.String name) {
256:
257: try {
258: return Class.forName(name);
259: } catch (ClassNotFoundException e) {
260: throw new RuntimeException(e);
261: }
262:
263: }
264:
265: /**
266: * <p>Return the <code>PropertyDescriptor</code>s for this bean.</p>
267: */
268: public PropertyDescriptor[] getPropertyDescriptors() {
269:
270: if (propDescriptors != null) {
271: return propDescriptors;
272: }
273: AttributeDescriptor attrib = null;
274:
275: try {
276:
277: PropertyDescriptor prop_class = new PropertyDescriptor(
278: "class", beanClass, "getClass", null);
279: prop_class
280: .setDisplayName(resources
281: .getString("TableRowDataProvider_class_DisplayName"));
282: prop_class
283: .setShortDescription(resources
284: .getString("TableRowDataProvider_class_Description"));
285: prop_class.setExpert(false);
286: prop_class.setHidden(true);
287: prop_class.setPreferred(false);
288: prop_class
289: .setValue(
290: Constants.PropertyDescriptor.CATEGORY,
291: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
292:
293: PropertyDescriptor prop_dataListeners = new PropertyDescriptor(
294: "dataListeners", beanClass, "getDataListeners",
295: null);
296: prop_dataListeners
297: .setDisplayName(resources
298: .getString("TableRowDataProvider_dataListeners_DisplayName"));
299: prop_dataListeners
300: .setShortDescription(resources
301: .getString("TableRowDataProvider_dataListeners_Description"));
302: prop_dataListeners.setExpert(false);
303: prop_dataListeners.setHidden(true);
304: prop_dataListeners.setPreferred(false);
305: prop_dataListeners
306: .setValue(
307: Constants.PropertyDescriptor.CATEGORY,
308: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
309:
310: PropertyDescriptor prop_fieldKeys = new PropertyDescriptor(
311: "fieldKeys", beanClass, "getFieldKeys", null);
312: prop_fieldKeys
313: .setDisplayName(resources
314: .getString("TableRowDataProvider_fieldKeys_DisplayName"));
315: prop_fieldKeys
316: .setShortDescription(resources
317: .getString("TableRowDataProvider_fieldKeys_Description"));
318: prop_fieldKeys.setExpert(false);
319: prop_fieldKeys.setHidden(true);
320: prop_fieldKeys.setPreferred(false);
321: prop_fieldKeys
322: .setValue(
323: Constants.PropertyDescriptor.CATEGORY,
324: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
325:
326: PropertyDescriptor prop_tableDataProvider = new PropertyDescriptor(
327: "tableDataProvider", beanClass,
328: "getTableDataProvider", "setTableDataProvider");
329: prop_tableDataProvider
330: .setDisplayName(resources
331: .getString("TableRowDataProvider_tableDataProvider_DisplayName"));
332: prop_tableDataProvider
333: .setShortDescription(resources
334: .getString("TableRowDataProvider_tableDataProvider_Description"));
335: prop_tableDataProvider
336: .setPropertyEditorClass(loadClass("com.sun.rave.propertyeditors.SelectOneDomainEditor"));
337: prop_tableDataProvider.setExpert(false);
338: prop_tableDataProvider.setHidden(false);
339: prop_tableDataProvider.setPreferred(false);
340: prop_tableDataProvider
341: .setValue(
342: Constants.PropertyDescriptor.CATEGORY,
343: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
344: prop_tableDataProvider
345: .setValue(
346: "com.sun.rave.propertyeditors.DOMAIN_CLASS",
347: loadClass("com.sun.rave.propertyeditors.domains.InstanceVariableDomain"));
348:
349: PropertyDescriptor prop_tableRow = new PropertyDescriptor(
350: "tableRow", beanClass, "getTableRow", "setTableRow");
351: prop_tableRow
352: .setDisplayName(resources
353: .getString("TableRowDataProvider_tableRow_DisplayName"));
354: prop_tableRow
355: .setShortDescription(resources
356: .getString("TableRowDataProvider_tableRow_Description"));
357: prop_tableRow.setExpert(false);
358: prop_tableRow.setHidden(true);
359: prop_tableRow.setPreferred(false);
360: prop_tableRow
361: .setValue(
362: Constants.PropertyDescriptor.CATEGORY,
363: com.sun.rave.designtime.base.CategoryDescriptors.DATA);
364:
365: propDescriptors = new PropertyDescriptor[] { prop_class,
366: prop_dataListeners, prop_fieldKeys,
367: prop_tableDataProvider, prop_tableRow, };
368: return propDescriptors;
369:
370: } catch (IntrospectionException e) {
371: e.printStackTrace();
372: return null;
373: }
374:
375: }
376:
377: }
378: //GEN-END:BeanInfo
|