KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > settings > examples > JavaCompilerSettingBeanInfo


1 package org.netbeans.modules.settings.examples;
2
3 import java.beans.*;
4
5 public class JavaCompilerSettingBeanInfo extends SimpleBeanInfo {
6     
7     // Bean descriptor //GEN-FIRST:BeanDescriptor
8
/*lazy BeanDescriptor*/;
9     private static BeanDescriptor getBdescriptor(){
10         BeanDescriptor beanDescriptor = new BeanDescriptor ( JavaCompilerSetting.class , null );
11         beanDescriptor.setDisplayName ( "External Compiler" );//GEN-HEADEREND:BeanDescriptor
12

13         // Here you can add code for customizing the BeanDescriptor.
14

15         return beanDescriptor; }//GEN-LAST:BeanDescriptor
16

17     
18     // Property identifiers //GEN-FIRST:Properties
19
private static final int PROPERTY_classpath = 0;
20     private static final int PROPERTY_path = 1;
21     private static final int PROPERTY_deprecation = 2;
22     private static final int PROPERTY_debug = 3;
23
24     // Property array
25
/*lazy PropertyDescriptor*/;
26     private static PropertyDescriptor[] getPdescriptor(){
27         PropertyDescriptor[] properties = new PropertyDescriptor[4];
28     
29         try {
30             properties[PROPERTY_classpath] = new PropertyDescriptor ( "classpath", JavaCompilerSetting.class, "getClasspath", "setClasspath" );
31             properties[PROPERTY_classpath].setDisplayName ( "Class Path" );
32             properties[PROPERTY_path] = new PropertyDescriptor ( "path", JavaCompilerSetting.class, "getPath", "setPath" );
33             properties[PROPERTY_path].setDisplayName ( "Path to javac" );
34             properties[PROPERTY_deprecation] = new PropertyDescriptor ( "deprecation", JavaCompilerSetting.class, "isDeprecation", "setDeprecation" );
35             properties[PROPERTY_deprecation].setDisplayName ( "Deprecation" );
36             properties[PROPERTY_debug] = new PropertyDescriptor ( "debug", JavaCompilerSetting.class, "isDebug", "setDebug" );
37             properties[PROPERTY_debug].setDisplayName ( "Debug" );
38         }
39         catch( IntrospectionException e) {}//GEN-HEADEREND:Properties
40

41         // Here you can add code for customizing the properties array.
42

43         return properties; }//GEN-LAST:Properties
44

45     // EventSet identifiers//GEN-FIRST:Events
46
private static final int EVENT_propertyChangeListener = 0;
47
48     // EventSet array
49
/*lazy EventSetDescriptor*/;
50     private static EventSetDescriptor[] getEdescriptor(){
51         EventSetDescriptor[] eventSets = new EventSetDescriptor[1];
52     
53             try {
54             eventSets[EVENT_propertyChangeListener] = new EventSetDescriptor ( org.netbeans.modules.settings.examples.JavaCompilerSetting.class, "propertyChangeListener", java.beans.PropertyChangeListener JavaDoc.class, new String JavaDoc[] {"propertyChange"}, "addPropertyChangeListener", "removePropertyChangeListener" );
55         }
56         catch( IntrospectionException e) {}//GEN-HEADEREND:Events
57

58         // Here you can add code for customizing the event sets array.
59

60         return eventSets; }//GEN-LAST:Events
61

62     // Method identifiers //GEN-FIRST:Methods
63

64     // Method array
65
/*lazy MethodDescriptor*/;
66     private static MethodDescriptor[] getMdescriptor(){
67         MethodDescriptor[] methods = new MethodDescriptor[0];//GEN-HEADEREND:Methods
68

69         // Here you can add code for customizing the methods array.
70

71         return methods; }//GEN-LAST:Methods
72

73     
74     private static final int defaultPropertyIndex = -1;//GEN-BEGIN:Idx
75
private static final int defaultEventIndex = -1;//GEN-END:Idx
76

77     
78  //GEN-FIRST:Superclass
79

80     // Here you can add code for customizing the Superclass BeanInfo.
81

82  //GEN-LAST:Superclass
83

84     /**
85      * Gets the bean's <code>BeanDescriptor</code>s.
86      *
87      * @return BeanDescriptor describing the editable
88      * properties of this bean. May return null if the
89      * information should be obtained by automatic analysis.
90      */

91     public BeanDescriptor getBeanDescriptor() {
92         return getBdescriptor();
93     }
94     
95     /**
96      * Gets the bean's <code>PropertyDescriptor</code>s.
97      *
98      * @return An array of PropertyDescriptors describing the editable
99      * properties supported by this bean. May return null if the
100      * information should be obtained by automatic analysis.
101      * <p>
102      * If a property is indexed, then its entry in the result array will
103      * belong to the IndexedPropertyDescriptor subclass of PropertyDescriptor.
104      * A client of getPropertyDescriptors can use "instanceof" to check
105      * if a given PropertyDescriptor is an IndexedPropertyDescriptor.
106      */

107     public PropertyDescriptor[] getPropertyDescriptors() {
108         return getPdescriptor();
109     }
110     
111     /**
112      * Gets the bean's <code>EventSetDescriptor</code>s.
113      *
114      * @return An array of EventSetDescriptors describing the kinds of
115      * events fired by this bean. May return null if the information
116      * should be obtained by automatic analysis.
117      */

118     public EventSetDescriptor[] getEventSetDescriptors() {
119         return getEdescriptor();
120     }
121     
122     /**
123      * Gets the bean's <code>MethodDescriptor</code>s.
124      *
125      * @return An array of MethodDescriptors describing the methods
126      * implemented by this bean. May return null if the information
127      * should be obtained by automatic analysis.
128      */

129     public MethodDescriptor[] getMethodDescriptors() {
130         return getMdescriptor();
131     }
132     
133     /**
134      * A bean may have a "default" property that is the property that will
135      * mostly commonly be initially chosen for update by human's who are
136      * customizing the bean.
137      * @return Index of default property in the PropertyDescriptor array
138      * returned by getPropertyDescriptors.
139      * <P> Returns -1 if there is no default property.
140      */

141     public int getDefaultPropertyIndex() {
142         return defaultPropertyIndex;
143     }
144     
145     /**
146      * A bean may have a "default" event that is the event that will
147      * mostly commonly be used by human's when using the bean.
148      * @return Index of default event in the EventSetDescriptor array
149      * returned by getEventSetDescriptors.
150      * <P> Returns -1 if there is no default event.
151      */

152     public int getDefaultEventIndex() {
153         return defaultEventIndex;
154     }
155 }
156
157
Popular Tags