KickJava   Java API By Example, From Geeks To Geeks.

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


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  * WS70CustomResourceBeanBeanInfo.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 WS70CustomResourceBeanBeanInfo 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 ( WS70CustomResourceBean.class , null );
40         // Here you can add code for customizing the BeanDescriptor.
41

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

86         return properties; }//GEN-LAST:Properties
87

88     // Event set information will be obtained from introspection.//GEN-FIRST:Events
89
private static EventSetDescriptor[] eventSets = null;
90     private static EventSetDescriptor[] getEdescriptor(){
91 //GEN-HEADEREND:Events
92

93         // Here you can add code for customizing the event sets array.
94

95         return eventSets; }//GEN-LAST:Events
96

97     // Method information will be obtained from introspection.//GEN-FIRST:Methods
98
private static MethodDescriptor[] methods = null;
99     private static MethodDescriptor[] getMdescriptor(){
100 //GEN-HEADEREND:Methods
101

102         // Here you can add code for customizing the methods array.
103

104         return methods; }//GEN-LAST:Methods
105

106     
107     private static int defaultPropertyIndex = -1;//GEN-BEGIN:Idx
108
private static int defaultEventIndex = -1;//GEN-END:Idx
109

110     
111 //GEN-FIRST:Superclass
112

113     // Here you can add code for customizing the Superclass BeanInfo.
114

115 //GEN-LAST:Superclass
116

117     /**
118      * Gets the bean's <code>BeanDescriptor</code>s.
119      *
120      * @return BeanDescriptor describing the editable
121      * properties of this bean. May return null if the
122      * information should be obtained by automatic analysis.
123      */

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

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

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

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

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

185     public int getDefaultEventIndex() {
186         return defaultEventIndex;
187     }
188 }
189
190
Popular Tags