KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > ide > sunresources > beans > PersistenceManagerBeanBeanInfo


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.j2ee.sun.ide.sunresources.beans;
20
21 import java.beans.*;
22 import org.openide.util.Exceptions;
23 import org.openide.util.NbBundle;
24 import org.netbeans.modules.j2ee.sun.ide.editors.BooleanEditor;
25
26 public class PersistenceManagerBeanBeanInfo extends SimpleBeanInfo {
27
28     static private String JavaDoc getLabel(String JavaDoc key){
29         return NbBundle.getMessage(PersistenceManagerBean.class,key);
30     }
31
32     /**
33      * Gets the bean's <code>BeanDescriptor</code>s.
34      *
35      * @return BeanDescriptor describing the editable
36      * properties of this bean. May return null if the
37      * information should be obtained by automatic analysis.
38      */

39     public BeanDescriptor getBeanDescriptor() {
40         BeanDescriptor beanDescriptor = new BeanDescriptor ( PersistenceManagerBean.class , null );//GEN-HEADEREND:BeanDescriptor
41
return beanDescriptor;
42     }
43     
44     /**
45      * Gets the bean's <code>PropertyDescriptor</code>s.
46      *
47      * @return An array of PropertyDescriptors describing the editable
48      * properties supported by this bean. May return null if the
49      * information should be obtained by automatic analysis.
50      * <p>
51      * If a property is indexed, then its entry in the result array will
52      * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
53      * A client of getPropertyDescriptors can use "instanceof" to check
54      * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
55      */

56     public PropertyDescriptor[] getPropertyDescriptors() {
57         int PROPERTY_datasourceJndiName = 0;
58         int PROPERTY_description = 1;
59         int PROPERTY_factoryClass = 2;
60         int PROPERTY_isEnabled = 3;
61         int PROPERTY_jndiName = 4;
62         int PROPERTY_name = 5;
63         PropertyDescriptor[] properties = new PropertyDescriptor[6];
64
65         try {
66             properties[PROPERTY_datasourceJndiName] = new PropertyDescriptor ( "datasourceJndiName", PersistenceManagerBean.class, "getDatasourceJndiName", "setDatasourceJndiName" );
67             properties[PROPERTY_datasourceJndiName].setDisplayName ( getLabel("LBL_JndiNameInPMF") );
68             properties[PROPERTY_datasourceJndiName].setShortDescription ( getLabel("DSC_JndiNameInPMF") );
69             properties[PROPERTY_description] = new PropertyDescriptor ( "description", PersistenceManagerBean.class, "getDescription", "setDescription" );
70             properties[PROPERTY_description].setDisplayName ( getLabel("LBL_Description") );
71             properties[PROPERTY_description].setShortDescription ( getLabel("DSC_Description") );
72             properties[PROPERTY_factoryClass] = new PropertyDescriptor ( "factoryClass", PersistenceManagerBean.class, "getFactoryClass", "setFactoryClass" );
73             properties[PROPERTY_factoryClass].setDisplayName ( getLabel("LBL_FactoryClass") );
74             properties[PROPERTY_factoryClass].setShortDescription ( getLabel("DSC_FactoryClass") );
75             properties[PROPERTY_isEnabled] = new PropertyDescriptor ( "isEnabled", PersistenceManagerBean.class, "getIsEnabled", "setIsEnabled" );
76             properties[PROPERTY_isEnabled].setDisplayName ( getLabel("LBL_Enabled") );
77             properties[PROPERTY_isEnabled].setShortDescription ( getLabel("DSC_Enabled") );
78             properties[PROPERTY_isEnabled].setPropertyEditorClass ( BooleanEditor.class );
79             properties[PROPERTY_jndiName] = new PropertyDescriptor ( "jndiName", PersistenceManagerBean.class, "getJndiName", "setJndiName" );
80             properties[PROPERTY_jndiName].setDisplayName ( getLabel("LBL_JndiName") );
81             properties[PROPERTY_jndiName].setShortDescription ( getLabel("DSC_PMFJndiName") );
82             properties[PROPERTY_name] = new PropertyDescriptor ( "name", PersistenceManagerBean.class, "getName", "setName" );
83             properties[PROPERTY_name].setHidden ( true );
84         } catch( IntrospectionException e) {
85             Exceptions.printStackTrace(e);
86         }
87         return properties;
88     }
89     
90     /**
91      * Gets the bean's <code>EventSetDescriptor</code>s.
92      *
93      * @return An array of EventSetDescriptors describing the kinds of
94      * events fired by this bean. May return null if the information
95      * should be obtained by automatic analysis.
96      */

97     public EventSetDescriptor[] getEventSetDescriptors() {
98         int EVENT_propertyChangeListener = 0;
99         EventSetDescriptor[] eventSets = new EventSetDescriptor[1];
100             
101         try {
102             eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( org.netbeans.modules.j2ee.sun.ide.sunresources.beans.PersistenceManagerBean.class, "propertyChangeListener", java.beans.PropertyChangeListener JavaDoc.class, new String JavaDoc[] {"propertyChange"}, "addPropertyChangeListener", "removePropertyChangeListener" );
103         } catch( IntrospectionException e) {
104             Exceptions.printStackTrace(e);
105         }
106         return eventSets;
107     }
108     
109     /**
110      * Gets the bean's <code>MethodDescriptor</code>s.
111      *
112      * @return An array of MethodDescriptors describing the methods
113      * implemented by this bean. May return null if the information
114      * should be obtained by automatic analysis.
115      */

116     public MethodDescriptor[] getMethodDescriptors() {
117         return new MethodDescriptor[0];
118     }
119 }
120
Popular Tags