KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > share > configbean > ResourceRefBeanInfo


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 package org.netbeans.modules.j2ee.sun.share.configbean;
21
22 import java.beans.*;
23 import org.openide.util.Exceptions;
24
25 public class ResourceRefBeanInfo extends SimpleBeanInfo {
26     
27     
28     /** Return an appropriate icon (currently, only 16x16 color is available)
29      */

30     public java.awt.Image JavaDoc getIcon(int iconKind) {
31         return loadImage("resources/ResourceRefIcon16.gif"); // NOI18N
32
}
33     
34     /**
35      * Gets the bean's <code>BeanDescriptor</code>s.
36      *
37      * @return BeanDescriptor describing the editable
38      * properties of this bean. May return null if the
39      * information should be obtained by automatic analysis.
40      */

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

58     public PropertyDescriptor[] getPropertyDescriptors() {
59             int PROPERTY_identity = 0;
60             int PROPERTY_jndiName = 1;
61             int PROPERTY_principalName = 2;
62             int PROPERTY_principalPassword = 3;
63             int PROPERTY_resRefName = 4;
64             PropertyDescriptor[] properties = new PropertyDescriptor[5];
65
66             try {
67                 properties[PROPERTY_identity] = new PropertyDescriptor ( "identity", ResourceRef.class, "getIdentity", "setIdentity" );
68                 properties[PROPERTY_jndiName] = new PropertyDescriptor ( "jndiName", ResourceRef.class, "getJndiName", "setJndiName" );
69                 properties[PROPERTY_principalName] = new PropertyDescriptor ( "principalName", ResourceRef.class, "getPrincipalName", "setPrincipalName" );
70                 properties[PROPERTY_principalPassword] = new PropertyDescriptor ( "principalPassword", ResourceRef.class, "getPrincipalPassword", "setPrincipalPassword" );
71                 properties[PROPERTY_resRefName] = new PropertyDescriptor ( "resRefName", ResourceRef.class, "getResRefName", null );
72             }
73             catch( IntrospectionException e) {
74                 Exceptions.printStackTrace(e);
75             }
76             return properties;
77     }
78     
79     /**
80      * Gets the bean's <code>EventSetDescriptor</code>s.
81      *
82      * @return An array of EventSetDescriptors describing the kinds of
83      * events fired by this bean. May return null if the information
84      * should be obtained by automatic analysis.
85      */

86     public EventSetDescriptor[] getEventSetDescriptors() {
87             int EVENT_propertyChangeListener = 0;
88             int EVENT_vetoableChangeListener = 1;
89
90             EventSetDescriptor[] eventSets = new EventSetDescriptor[2];
91
92                 try {
93                 eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( org.netbeans.modules.j2ee.sun.share.configbean.ResourceRef.class, "propertyChangeListener", java.beans.PropertyChangeListener JavaDoc.class, new String JavaDoc[] {"propertyChange"}, "addPropertyChangeListener", "removePropertyChangeListener" );
94                 eventSets[EVENT_vetoableChangeListener] = new EventSetDescriptor ( org.netbeans.modules.j2ee.sun.share.configbean.ResourceRef.class, "vetoableChangeListener", java.beans.VetoableChangeListener JavaDoc.class, new String JavaDoc[] {"vetoableChange"}, "addVetoableChangeListener", "removeVetoableChangeListener" );
95             }
96             catch( IntrospectionException e) {
97                 Exceptions.printStackTrace(e);
98             }
99             return eventSets;
100     }
101     
102     /**
103      * Gets the bean's <code>MethodDescriptor</code>s.
104      *
105      * @return An array of MethodDescriptors describing the methods
106      * implemented by this bean. May return null if the information
107      * should be obtained by automatic analysis.
108      */

109     public MethodDescriptor[] getMethodDescriptors() {
110             return new MethodDescriptor[0];
111     }
112 }
113
114
Popular Tags