KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > ws7 > serverresources > beans > WS70ExternalResourceBeanBeanInfo


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
20 /*
21  * WS70ExternalResourceBeanBeanInfo.java
22  */

23
24 package org.netbeans.modules.j2ee.sun.ws7.serverresources.beans;
25
26 import java.beans.*;
27 import org.openide.util.NbBundle;
28 import org.netbeans.modules.j2ee.sun.ide.editors.BooleanEditor;
29
30 /**
31  * @author Administrator
32  */

33 public class WS70ExternalResourceBeanBeanInfo extends SimpleBeanInfo {
34
35     // Bean descriptor information will be obtained from introspection.//GEN-FIRST:BeanDescriptor
36
private static BeanDescriptor beanDescriptor = null;
37     private static BeanDescriptor getBdescriptor(){
38 //GEN-HEADEREND:BeanDescriptor
39
BeanDescriptor beanDescriptor = new BeanDescriptor(WS70ExternalResourceBean.class, null );
40         // Here you can add code for customizing the BeanDescriptor.
41

42         return beanDescriptor; }//GEN-LAST:BeanDescriptor
43

44     static private String JavaDoc getLabel(String JavaDoc key){
45         return NbBundle.getMessage(WS70ExternalResourceBean.class,key);
46     }
47
48     private static final int PROPERTY_jndiName = 0;
49     private static final int PROPERTY_externalJndiName = 1;
50     private static final int PROPERTY_resType = 2;
51     private static final int PROPERTY_factoryClass = 3;
52     private static final int PROPERTY_isEnabled = 4;
53     private static final int PROPERTY_description = 5;
54     private static final int PROPERTY_name = 6;
55     
56     
57     // Properties information will be obtained from introspection.//GEN-FIRST:Properties
58
private static PropertyDescriptor[] properties = null;
59     private static PropertyDescriptor[] getPdescriptor(){
60 //GEN-HEADEREND:Properties
61
try {
62             properties = new PropertyDescriptor[7];
63             properties[PROPERTY_jndiName] = new PropertyDescriptor ( "jndiName", WS70ExternalResourceBean.class, "getJndiName", "setJndiName" );
64             properties[PROPERTY_jndiName].setDisplayName ( getLabel("LBL_ExternalJndi_JndiName") );
65             properties[PROPERTY_jndiName].setShortDescription ( getLabel("DSC_ExternalJndi_JndiName") );
66
67             properties[PROPERTY_externalJndiName] = new PropertyDescriptor ( "externalJndiName", WS70ExternalResourceBean.class, "getExternalJndiName", "setExternalJndiName" );
68             properties[PROPERTY_externalJndiName].setDisplayName ( getLabel("LBL_ExternalJndi") );
69             properties[PROPERTY_externalJndiName].setShortDescription ( getLabel("DSC_ExternalJndi") );
70             properties[PROPERTY_resType] = new PropertyDescriptor ( "resType", WS70ExternalResourceBean.class, "getResType", "setResType" );
71             properties[PROPERTY_resType].setDisplayName ( getLabel("LBL_ResType") );
72             properties[PROPERTY_resType].setShortDescription ( getLabel("DSC_ResType") );
73             properties[PROPERTY_factoryClass] = new PropertyDescriptor ( "factoryClass", WS70ExternalResourceBean.class, "getFactoryClass", "setFactoryClass" );
74             properties[PROPERTY_factoryClass].setDisplayName ( getLabel("LBL_ExternalJndiFactoryClass") );
75             properties[PROPERTY_factoryClass].setShortDescription ( getLabel("DSC_ExternalJndiFactoryClass") );
76             properties[PROPERTY_description] = new PropertyDescriptor ( "description", WS70ExternalResourceBean.class, "getDescription", "setDescription" );
77             properties[PROPERTY_description].setDisplayName ( getLabel("LBL_Description") );
78             properties[PROPERTY_description].setShortDescription ( getLabel("DSC_Description") );
79        
80             properties[PROPERTY_isEnabled] = new PropertyDescriptor ( "isEnabled", WS70ExternalResourceBean.class, "getIsEnabled", "setIsEnabled" );
81             properties[PROPERTY_isEnabled].setDisplayName ( getLabel("LBL_Enabled") );
82             properties[PROPERTY_isEnabled].setShortDescription ( getLabel("DSC_Enabled") );
83             properties[PROPERTY_isEnabled].setPropertyEditorClass ( BooleanEditor.class );
84       
85             properties[PROPERTY_name] = new PropertyDescriptor ( "name", WS70ExternalResourceBean.class, "getName", "setName" );
86             properties[PROPERTY_name].setHidden ( true );
87         }
88         catch( IntrospectionException e){
89         }
90         // Here you can add code for customizing the properties array.
91

92         return properties; }//GEN-LAST:Properties
93

94     // Event set information will be obtained from introspection.//GEN-FIRST:Events
95
private static EventSetDescriptor[] eventSets = null;
96     private static EventSetDescriptor[] getEdescriptor(){
97 //GEN-HEADEREND:Events
98

99         // Here you can add code for customizing the event sets array.
100

101         return eventSets; }//GEN-LAST:Events
102

103     // Method information will be obtained from introspection.//GEN-FIRST:Methods
104
private static MethodDescriptor[] methods = null;
105     private static MethodDescriptor[] getMdescriptor(){
106 //GEN-HEADEREND:Methods
107

108         // Here you can add code for customizing the methods array.
109

110         return methods; }//GEN-LAST:Methods
111

112     
113     private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx
114
private static int defaultEventIndex = -1;//GEN-END:Idx
115

116     
117 //GEN-FIRST:Superclass
118

119     // Here you can add code for customizing the Superclass BeanInfo.
120

121 //GEN-LAST:Superclass
122

123     /**
124      * Gets the bean's <code>BeanDescriptor</code>s.
125      *
126      * @return BeanDescriptor describing the editable
127      * properties of this bean. May return null if the
128      * information should be obtained by automatic analysis.
129      */

130     public BeanDescriptor getBeanDescriptor() {
131         return getBdescriptor();
132     }
133     
134     /**
135      * Gets the bean's <code>PropertyDescriptor</code>s.
136      *
137      * @return An array of PropertyDescriptors describing the editable
138      * properties supported by this bean. May return null if the
139      * information should be obtained by automatic analysis.
140      * <p>
141      * If a property is indexed, then its entry in the result array will
142      * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
143      * A client of getPropertyDescriptors can use "instanceof" to check
144      * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
145      */

146     public PropertyDescriptor[] getPropertyDescriptors() {
147         return getPdescriptor();
148     }
149     
150     /**
151      * Gets the bean's <code>EventSetDescriptor</code>s.
152      *
153      * @return An array of EventSetDescriptors describing the kinds of
154      * events fired by this bean. May return null if the information
155      * should be obtained by automatic analysis.
156      */

157     public EventSetDescriptor[] getEventSetDescriptors() {
158         return getEdescriptor();
159     }
160     
161     /**
162      * Gets the bean's <code>MethodDescriptor</code>s.
163      *
164      * @return An array of MethodDescriptors describing the methods
165      * implemented by this bean. May return null if the information
166      * should be obtained by automatic analysis.
167      */

168     public MethodDescriptor[] getMethodDescriptors() {
169         return getMdescriptor();
170     }
171     
172     /**
173      * A bean may have a "default" property that is the property that will
174      * mostly commonly be initially chosen for update by human's who are
175      * customizing the bean.
176      * @return Index of default property in the PropertyDescriptor array
177      * returned by getPropertyDescriptors.
178      * <P> Returns -1 if there is no default property.
179      */

180     public int getDefaultPropertyIndex() {
181         return defaultPropertyIndex;
182     }
183     
184     /**
185      * A bean may have a "default" event that is the event that will
186      * mostly commonly be used by human's when using the bean.
187      * @return Index of default event in the EventSetDescriptor array
188      * returned by getEventSetDescriptors.
189      * <P> Returns -1 if there is no default event.
190      */

191     public int getDefaultEventIndex() {
192         return defaultEventIndex;
193     }
194 }
195
196
Popular Tags