KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > tests > j2eeserver > plugin > jsr88 > ResourceManagerBeanInfo


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.tests.j2eeserver.plugin.jsr88;
20
21 import java.beans.*;
22
23 public class ResourceManagerBeanInfo extends SimpleBeanInfo {
24
25
26     // Bean descriptor//GEN-FIRST:BeanDescriptor
27
/*lazy BeanDescriptor*/;
28     private static BeanDescriptor getBdescriptor(){
29         BeanDescriptor beanDescriptor = new BeanDescriptor ( ResourceManager.class , null );//GEN-HEADEREND:BeanDescriptor
30

31         // Here you can add code for customizing the BeanDescriptor.
32

33         return beanDescriptor; }//GEN-LAST:BeanDescriptor
34

35
36     // Property identifiers//GEN-FIRST:Properties
37
private static final int PROPERTY_resourceName = 0;
38     private static final int PROPERTY_resourceJndiName = 1;
39     private static final int PROPERTY_resourceUrl = 2;
40
41     // Property array
42
/*lazy PropertyDescriptor*/;
43     private static PropertyDescriptor[] getPdescriptor(){
44         PropertyDescriptor[] properties = new PropertyDescriptor[3];
45
46         try {
47             properties[PROPERTY_resourceName] = new PropertyDescriptor ( "resourceName", ResourceManager.class, "getResourceName", null );
48             properties[PROPERTY_resourceJndiName] = new PropertyDescriptor ( "resourceJndiName", ResourceManager.class, "getResourceJndiName", "setResourceJndiName" );
49             properties[PROPERTY_resourceUrl] = new PropertyDescriptor ( "resourceUrl", ResourceManager.class, "getResourceUrl", "setResourceUrl" );
50         }
51         catch( IntrospectionException e) {}//GEN-HEADEREND:Properties
52

53         // Here you can add code for customizing the properties array.
54

55         return properties; }//GEN-LAST:Properties
56

57     // EventSet identifiers//GEN-FIRST:Events
58
private static final int EVENT_propertyChangeListener = 0;
59
60     // EventSet array
61
/*lazy EventSetDescriptor*/;
62     private static EventSetDescriptor[] getEdescriptor(){
63         EventSetDescriptor[] eventSets = new EventSetDescriptor[1];
64
65             try {
66             eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( ResourceManager.class, "propertyChangeListener", java.beans.PropertyChangeListener JavaDoc.class, new String JavaDoc[] {"propertyChange"}, "addPropertyChangeListener", "removePropertyChangeListener" );
67         }
68         catch( IntrospectionException e) {}//GEN-HEADEREND:Events
69

70         // Here you can add code for customizing the event sets array.
71

72         return eventSets; }//GEN-LAST:Events
73

74     // Method identifiers//GEN-FIRST:Methods
75

76     // Method array
77
/*lazy MethodDescriptor*/;
78     private static MethodDescriptor[] getMdescriptor(){
79         MethodDescriptor[] methods = new MethodDescriptor[0];//GEN-HEADEREND:Methods
80

81         // Here you can add code for customizing the methods array.
82

83         return methods; }//GEN-LAST:Methods
84

85
86     private static final int defaultPropertyIndex = -1;//GEN-BEGIN:Idx
87
private static final int defaultEventIndex = -1;//GEN-END:Idx
88

89
90 //GEN-FIRST:Superclass
91

92     // Here you can add code for customizing the Superclass BeanInfo.
93

94 //GEN-LAST:Superclass
95

96     /**
97      * Gets the bean's <code>BeanDescriptor</code>s.
98      *
99      * @return BeanDescriptor describing the editable
100      * properties of this bean. May return null if the
101      * information should be obtained by automatic analysis.
102      */

103     public BeanDescriptor getBeanDescriptor() {
104         return getBdescriptor();
105     }
106
107     /**
108      * Gets the bean's <code>PropertyDescriptor</code>s.
109      *
110      * @return An array of PropertyDescriptors describing the editable
111      * properties supported by this bean. May return null if the
112      * information should be obtained by automatic analysis.
113      * <p>
114      * If a property is indexed, then its entry in the result array will
115      * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
116      * A client of getPropertyDescriptors can use "instanceof" to check
117      * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
118      */

119     public PropertyDescriptor[] getPropertyDescriptors() {
120         return getPdescriptor();
121     }
122
123     /**
124      * Gets the bean's <code>EventSetDescriptor</code>s.
125      *
126      * @return An array of EventSetDescriptors describing the kinds of
127      * events fired by this bean. May return null if the information
128      * should be obtained by automatic analysis.
129      */

130     public EventSetDescriptor[] getEventSetDescriptors() {
131         return getEdescriptor();
132     }
133
134     /**
135      * Gets the bean's <code>MethodDescriptor</code>s.
136      *
137      * @return An array of MethodDescriptors describing the methods
138      * implemented by this bean. May return null if the information
139      * should be obtained by automatic analysis.
140      */

141     public MethodDescriptor[] getMethodDescriptors() {
142         return getMdescriptor();
143     }
144
145     /**
146      * A bean may have a "default" property that is the property that will
147      * mostly commonly be initially chosen for update by human's who are
148      * customizing the bean.
149      * @return Index of default property in the PropertyDescriptor array
150      * returned by getPropertyDescriptors.
151      * <P> Returns -1 if there is no default property.
152      */

153     public int getDefaultPropertyIndex() {
154         return defaultPropertyIndex;
155     }
156
157     /**
158      * A bean may have a "default" event that is the event that will
159      * mostly commonly be used by human's when using the bean.
160      * @return Index of default event in the EventSetDescriptor array
161      * returned by getEventSetDescriptors.
162      * <P> Returns -1 if there is no default event.
163      */

164     public int getDefaultEventIndex() {
165         return defaultEventIndex;
166     }
167 }
168
169
Popular Tags