KickJava   Java API By Example, From Geeks To Geeks.

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


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 JMSBeanBeanInfo extends SimpleBeanInfo {
27
28     
29     static private String JavaDoc getLabel(String JavaDoc key){
30         return NbBundle.getMessage(JMSBean.class,key);
31     }
32      
33     // Property identifiers//GEN-FIRST:Properties
34
private static final int PROPERTY_description = 0;
35     private static final int PROPERTY_isEnabled = 1;
36     private static final int PROPERTY_jndiName = 2;
37     private static final int PROPERTY_name = 3;
38     private static final int PROPERTY_resType = 4;
39
40     private static final int EVENT_propertyChangeListener = 0;
41
42     /**
43      * Gets the bean's <code>BeanDescriptor</code>s.
44      *
45      * @return BeanDescriptor describing the editable
46      * properties of this bean. May return null if the
47      * information should be obtained by automatic analysis.
48      */

49     public BeanDescriptor getBeanDescriptor() {
50         return new BeanDescriptor ( JMSBean.class , null );
51     }
52     
53     /**
54      * Gets the bean's <code>PropertyDescriptor</code>s.
55      *
56      * @return An array of PropertyDescriptors describing the editable
57      * properties supported by this bean. May return null if the
58      * information should be obtained by automatic analysis.
59      * <p>
60      * If a property is indexed, then its entry in the result array will
61      * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
62      * A client of getPropertyDescriptors can use "instanceof" to check
63      * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
64      */

65     public PropertyDescriptor[] getPropertyDescriptors() {
66         PropertyDescriptor[] properties = new PropertyDescriptor[5];
67     
68         try {
69             properties[PROPERTY_description] = new PropertyDescriptor ( "description", JMSBean.class, "getDescription", "setDescription" );
70             properties[PROPERTY_description].setDisplayName ( getLabel("LBL_Description") );
71             properties[PROPERTY_description].setShortDescription ( getLabel("DSC_Description") );
72             properties[PROPERTY_isEnabled] = new PropertyDescriptor ( "isEnabled", JMSBean.class, "getIsEnabled", "setIsEnabled" );
73             properties[PROPERTY_isEnabled].setDisplayName ( getLabel("LBL_Enabled") );
74             properties[PROPERTY_isEnabled].setShortDescription ( getLabel("DSC_Enabled") );
75             properties[PROPERTY_isEnabled].setPropertyEditorClass ( BooleanEditor.class );
76             properties[PROPERTY_jndiName] = new PropertyDescriptor ( "jndiName", JMSBean.class, "getJndiName", "setJndiName" );
77             properties[PROPERTY_jndiName].setDisplayName ( getLabel("LBL_JndiName") );
78             properties[PROPERTY_jndiName].setShortDescription ( getLabel("DSC_JMSJndiName") );
79             properties[PROPERTY_name] = new PropertyDescriptor ( "name", JMSBean.class, "getName", "setName" );
80             properties[PROPERTY_name].setHidden ( true );
81             properties[PROPERTY_resType] = new PropertyDescriptor ( "resType", JMSBean.class, "getResType", "setResType" );
82             properties[PROPERTY_resType].setDisplayName ( getLabel("LBL_JMSResType") );
83             properties[PROPERTY_resType].setShortDescription ( getLabel("DSC_JMSResType") );
84         }
85         catch( IntrospectionException e) {
86             Exceptions.printStackTrace(e);
87         }
88         
89         return properties;
90     }
91     
92     public EventSetDescriptor[] getEventSetDescriptors() {
93         EventSetDescriptor[] eventSets = new EventSetDescriptor[1];
94     
95             try {
96             eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( JMSBean.class, "propertyChangeListener", java.beans.PropertyChangeListener JavaDoc.class, new String JavaDoc[] {"propertyChange"}, "addPropertyChangeListener", "removePropertyChangeListener" );
97         }
98         catch( IntrospectionException e) {
99             Exceptions.printStackTrace(e);
100         }
101         
102         // Here you can add code for customizing the event sets array.
103

104         return eventSets;
105     }
106     
107     public MethodDescriptor[] getMethodDescriptors() {
108         return new MethodDescriptor[0];
109     }
110     
111 }
112
113
Popular Tags