1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package com.cosylab.gui.components.introspection;
21
22
23
24
25
26
27
28 public class MethodSelectionPanelBeanInfo extends java.beans.SimpleBeanInfo {
29
30
31
32
33
34
35
36
37 public static java.lang.reflect.Method findMethod(java.lang.Class aClass, java.lang.String methodName, int parameterCount) {
38 try {
39
40
41 java.lang.reflect.Method methods[] = aClass.getMethods();
42 for (int index = 0; index < methods.length; index++){
43 java.lang.reflect.Method method = methods[index];
44 if ((method.getParameterTypes().length == parameterCount) && (method.getName().equals(methodName))) {
45 return method;
46 }
47 }
48 } catch (java.lang.Throwable exception) {
49 return null;
50 }
51 return null;
52 }
53
54
55
56
57
58 public java.beans.BeanInfo[] getAdditionalBeanInfo() {
59 java.lang.Class superClass;
60 java.beans.BeanInfo superBeanInfo = null;
61
62 try {
63 superClass = getBeanDescriptor().getBeanClass().getSuperclass();
64 } catch (java.lang.Throwable exception) {
65 return null;
66 }
67
68 try {
69 superBeanInfo = java.beans.Introspector.getBeanInfo(superClass);
70 } catch (java.beans.IntrospectionException ie) {}
71
72 if (superBeanInfo != null) {
73 java.beans.BeanInfo[] ret = new java.beans.BeanInfo[1];
74 ret[0] = superBeanInfo;
75 return ret;
76 }
77 return null;
78 }
79
80
81
82
83 public static java.lang.Class getBeanClass() {
84 return com.cosylab.gui.components.introspection.MethodSelectionPanel.class;
85 }
86
87
88
89
90 public static java.lang.String getBeanClassName() {
91 return "com.cosylab.gui.adapters.infobus.MethodSelectionPanel";
92 }
93
94
95
96
97 public java.beans.BeanDescriptor getBeanDescriptor() {
98 java.beans.BeanDescriptor aDescriptor = null;
99 try {
100
101 aDescriptor = new java.beans.BeanDescriptor(com.cosylab.gui.components.introspection.MethodSelectionPanel.class);
102
103
104
105 } catch (Throwable exception) {
106 };
107 return aDescriptor;
108 }
109
110
111
112
113
114 public java.beans.EventSetDescriptor[] getEventSetDescriptors() {
115 try {
116 java.beans.EventSetDescriptor aDescriptorList[] = {};
117 return aDescriptorList;
118 } catch (Throwable exception) {
119 handleException(exception);
120 };
121 return null;
122 }
123
124
125
126
127
128 public java.beans.MethodDescriptor[] getMethodDescriptors() {
129 try {
130 java.beans.MethodDescriptor aDescriptorList[] = {
131 main_javalangString__MethodDescriptor()
132 };
133 return aDescriptorList;
134 } catch (Throwable exception) {
135 handleException(exception);
136 };
137 return null;
138 }
139
140
141
142
143
144 public java.beans.PropertyDescriptor[] getPropertyDescriptors() {
145 try {
146 java.beans.PropertyDescriptor aDescriptorList[] = {
147 inspectedClassPropertyDescriptor()
148 ,memberFilterPropertyDescriptor()
149 ,modePropertyDescriptor()
150 ,selectedMemberPropertyDescriptor()
151 };
152 return aDescriptorList;
153 } catch (Throwable exception) {
154 handleException(exception);
155 };
156 return null;
157 }
158
159
160
161
162 private void handleException(java.lang.Throwable exception) {
163
164
165
166
167 }
168
169
170
171
172 public java.beans.PropertyDescriptor inspectedClassPropertyDescriptor() {
173 java.beans.PropertyDescriptor aDescriptor = null;
174 try {
175 try {
176
177 java.lang.reflect.Method aGetMethod = null;
178 try {
179
180 java.lang.Class aGetMethodParameterTypes[] = {};
181 aGetMethod = getBeanClass().getMethod("getInspectedClass", aGetMethodParameterTypes);
182 } catch (Throwable exception) {
183
184 handleException(exception);
185 aGetMethod = findMethod(getBeanClass(), "getInspectedClass", 0);
186 };
187 java.lang.reflect.Method aSetMethod = null;
188 try {
189
190 java.lang.Class aSetMethodParameterTypes[] = {
191 java.lang.Class.class
192 };
193 aSetMethod = getBeanClass().getMethod("setInspectedClass", aSetMethodParameterTypes);
194 } catch (Throwable exception) {
195
196 handleException(exception);
197 aSetMethod = findMethod(getBeanClass(), "setInspectedClass", 1);
198 };
199 aDescriptor = new java.beans.PropertyDescriptor("inspectedClass"
200 , aGetMethod, aSetMethod);
201 } catch (Throwable exception) {
202
203 handleException(exception);
204 aDescriptor = new java.beans.PropertyDescriptor("inspectedClass"
205 , getBeanClass());
206 };
207
208
209
210 aDescriptor.setShortDescription("the class that user selects methods from");
211
212
213 aDescriptor.setValue("preferred", new Boolean(true));
214
215 } catch (Throwable exception) {
216 handleException(exception);
217 };
218 return aDescriptor;
219 }
220
221
222
223
224 public java.beans.MethodDescriptor main_javalangString__MethodDescriptor() {
225 java.beans.MethodDescriptor aDescriptor = null;
226 try {
227
228 java.lang.reflect.Method aMethod = null;
229 try {
230
231 java.lang.Class aParameterTypes[] = {
232 java.lang.String[].class
233 };
234 aMethod = getBeanClass().getMethod("main", aParameterTypes);
235 } catch (Throwable exception) {
236
237 handleException(exception);
238 aMethod = findMethod(getBeanClass(), "main", 1);
239 };
240 try {
241
242 java.beans.ParameterDescriptor aParameterDescriptor1 = new java.beans.ParameterDescriptor();
243 aParameterDescriptor1.setName("arg1");
244 aParameterDescriptor1.setDisplayName("args");
245 java.beans.ParameterDescriptor aParameterDescriptors[] = {
246 aParameterDescriptor1
247 };
248 aDescriptor = new java.beans.MethodDescriptor(aMethod, aParameterDescriptors);
249 } catch (Throwable exception) {
250
251 handleException(exception);
252 aDescriptor = new java.beans.MethodDescriptor(aMethod);
253 };
254
255
256
257
258
259 } catch (Throwable exception) {
260 handleException(exception);
261 };
262 return aDescriptor;
263 }
264
265
266
267
268 public java.beans.PropertyDescriptor modePropertyDescriptor() {
269 java.beans.PropertyDescriptor aDescriptor = null;
270 try {
271 try {
272
273 java.lang.reflect.Method aGetMethod = null;
274 try {
275
276 java.lang.Class aGetMethodParameterTypes[] = {};
277 aGetMethod = getBeanClass().getMethod("getMode", aGetMethodParameterTypes);
278 } catch (Throwable exception) {
279
280 handleException(exception);
281 aGetMethod = findMethod(getBeanClass(), "getMode", 0);
282 };
283 java.lang.reflect.Method aSetMethod = null;
284 try {
285
286 java.lang.Class aSetMethodParameterTypes[] = {
287 short.class
288 };
289 aSetMethod = getBeanClass().getMethod("setMode", aSetMethodParameterTypes);
290 } catch (Throwable exception) {
291
292 handleException(exception);
293 aSetMethod = findMethod(getBeanClass(), "setMode", 1);
294 };
295 aDescriptor = new java.beans.PropertyDescriptor("mode"
296 , aGetMethod, aSetMethod);
297 } catch (Throwable exception) {
298
299 handleException(exception);
300 aDescriptor = new java.beans.PropertyDescriptor("mode"
301 , getBeanClass());
302 };
303 aDescriptor.setBound(true);
304
305
306
307
308
309
310
311 aDescriptor.setValue("enumerationValues", new Object[] {
312 "COMBO",new Short((short)0),"((short)0)",
313 "LIST",new Short((short)1),"((short)1)",
314 });
315 } catch (Throwable exception) {
316 handleException(exception);
317 };
318 return aDescriptor;
319 }
320
321
322
323
324
325 public java.beans.PropertyDescriptor memberFilterPropertyDescriptor() {
326 java.beans.PropertyDescriptor aDescriptor = null;
327 try {
328 try {
329
330 java.lang.reflect.Method aGetMethod = null;
331 try {
332
333 java.lang.Class aGetMethodParameterTypes[] = {};
334 aGetMethod = getBeanClass().getMethod("getMemberFilter", aGetMethodParameterTypes);
335 } catch (Throwable exception) {
336
337 handleException(exception);
338 aGetMethod = findMethod(getBeanClass(), "getMemberFilter", 0);
339 };
340 java.lang.reflect.Method aSetMethod = null;
341 try {
342
343 java.lang.Class aSetMethodParameterTypes[] = {
344 com.cosylab.introspection.MemberFilter.class
345 };
346 aSetMethod = getBeanClass().getMethod("setMemberFilter", aSetMethodParameterTypes);
347 } catch (Throwable exception) {
348
349 handleException(exception);
350 aSetMethod = findMethod(getBeanClass(), "setMemberFilter", 1);
351 };
352 aDescriptor = new java.beans.PropertyDescriptor("memberFilter"
353 , aGetMethod, aSetMethod);
354 } catch (Throwable exception) {
355
356 handleException(exception);
357 aDescriptor = new java.beans.PropertyDescriptor("memberFilter"
358 , getBeanClass());
359 };
360
361
362
363
364
365
366
367
368 } catch (Throwable exception) {
369 handleException(exception);
370 };
371 return aDescriptor;
372 }
373
374
375
376
377
378 public java.beans.PropertyDescriptor selectedMemberPropertyDescriptor() {
379 java.beans.PropertyDescriptor aDescriptor = null;
380 try {
381 try {
382
383 java.lang.reflect.Method aGetMethod = null;
384 try {
385
386 java.lang.Class aGetMethodParameterTypes[] = {};
387 aGetMethod = getBeanClass().getMethod("getSelectedMember", aGetMethodParameterTypes);
388 } catch (Throwable exception) {
389
390 handleException(exception);
391 aGetMethod = findMethod(getBeanClass(), "getSelectedMember", 0);
392 };
393 java.lang.reflect.Method aSetMethod = null;
394 aDescriptor = new java.beans.PropertyDescriptor("selectedMember"
395 , aGetMethod, aSetMethod);
396 } catch (Throwable exception) {
397
398 handleException(exception);
399 aDescriptor = new java.beans.PropertyDescriptor("selectedMember"
400 , getBeanClass());
401 };
402 aDescriptor.setBound(true);
403
404
405
406
407
408
409
410 } catch (Throwable exception) {
411 handleException(exception);
412 };
413 return aDescriptor;
414 }
415 }