merge the formfield patch from ooo-build
[ooovba.git] / javaunohelper / test / com / sun / star / lib / uno / helper / PropertySet_Test.java
blob6c844fd4cba1157fd0de91e94f5a18df5c3b6ad1
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PropertySet_Test.java,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package com.sun.star.lib.uno.helper;
32 import com.sun.star.lang.EventObject;
33 import com.sun.star.lang.DisposedException;
34 import com.sun.star.uno.Type;
35 import com.sun.star.uno.TypeClass;
36 import com.sun.star.uno.XInterface;
37 import com.sun.star.uno.UnoRuntime;
38 import com.sun.star.uno.Any;
39 import com.sun.star.uno.XWeak;
40 import com.sun.star.beans.XPropertySet;
41 import com.sun.star.beans.UnknownPropertyException;
42 import com.sun.star.beans.Property;
43 import com.sun.star.beans.PropertyAttribute;
44 import com.sun.star.beans.XPropertyChangeListener;
45 import com.sun.star.beans.PropertyVetoException;
46 import com.sun.star.beans.PropertyChangeEvent;
47 import com.sun.star.beans.XVetoableChangeListener;
48 import com.sun.star.beans.XPropertySetInfo;
49 import com.sun.star.beans.XPropertiesChangeListener;
51 import java.util.Arrays;
53 public class PropertySet_Test
56 /** Creates a new instance of PropertySet_Test */
57 public PropertySet_Test()
61 public boolean convertPropertyValue()
63 System.out.println("PropertySet.convertPropertyValue");
64 boolean[] r= new boolean[50];
65 int i= 0;
67 TestClass cl= new TestClass();
68 try {
69 r[i++]= cl.test_convertPropertyValue();
70 }catch(java.lang.Exception e){
71 i++;
73 boolean bOk= true;
74 for (int c= 0; c < i; c++)
75 bOk= bOk && r[c];
76 if (bOk == false)
77 System.out.println("Failed");
78 else
79 System.out.println("Ok");
80 return bOk;
83 public boolean setPropertyValueNoBroadcast()
85 System.out.println("PropertySet.setValueNoBroadcast");
86 boolean[] r= new boolean[50];
87 int i= 0;
89 TestClass cl= new TestClass();
90 try {
91 r[i++]= cl.test_setPropertyValueNoBroadcast();
92 }catch(java.lang.Exception e){
93 i++;
95 boolean bOk= true;
96 for (int c= 0; c < i; c++)
97 bOk= bOk && r[c];
98 if (bOk == false)
99 System.out.println("Failed");
100 else
101 System.out.println("Ok");
102 return bOk;
105 public boolean setPropertyValue()
107 System.out.println("PropertySet.setPropertyValue");
108 boolean[] r= new boolean[150];
109 int i= 0;
111 TestClass cl= new TestClass();
112 try {
113 cl.resetPropertyMembers();
114 Object value;
115 Object ret;
116 value= new Boolean(true);
117 cl.setPropertyValue("PropBoolA", value);
118 ret= cl.getPropertyValue("PropBoolA");
119 r[i++]= ((Boolean) ret).equals( (Boolean) value);
120 value= new Character('A');
121 cl.setPropertyValue("PropCharA",value);
122 ret= cl.getPropertyValue("PropCharA");
123 r[i++]= ((Character) ret).equals((Character) value);
124 value= new Byte((byte) 111);
125 cl.setPropertyValue("PropByteA",value);
126 ret= cl.getPropertyValue("PropByteA");
127 r[i++]= ((Byte) ret).equals((Byte) value);
128 value= new Short((short)112);
129 cl.setPropertyValue("PropShortA", value);
130 ret= cl.getPropertyValue("PropShortA");
131 r[i++]= ((Short) ret).equals((Short) value);
132 value= new Integer(113);
133 cl.setPropertyValue("PropIntA", value);
134 ret= cl.getPropertyValue("PropIntA");
135 r[i++]= ((Integer) ret).equals((Integer) value);
136 value= new Long(115);
137 cl.setPropertyValue("PropLongA", value);
138 ret= cl.getPropertyValue("PropLongA");
139 r[i++]= ((Long) ret).equals((Long) value);
140 value= new Float(3.14);
141 cl.setPropertyValue("PropFloatA", value);
142 ret= cl.getPropertyValue("PropFloatA");
143 r[i++]= ((Float) ret).equals((Float) value);
144 value= new Double(3.145);
145 cl.setPropertyValue("PropDoubleA",value);
146 ret= cl.getPropertyValue("PropDoubleA");
147 r[i++]= ((Double) ret).equals((Double) value);
148 value= new String("string");
149 cl.setPropertyValue("PropStringA",value);
150 ret= cl.getPropertyValue("PropStringA");
151 r[i++]= ((String) ret).equals((String) value);
152 value= new ComponentBase();
153 cl.setPropertyValue("PropXInterfaceA",value);
154 ret= cl.getPropertyValue("PropXInterfaceA");
155 r[i++]= ((XInterface) ret).equals((XInterface) value);
156 value= new ComponentBase();
157 cl.setPropertyValue("PropXWeakA",value);
158 ret= cl.getPropertyValue("PropXWeakA");
159 r[i++]= ((XWeak) ret).equals((XWeak) value);
160 value = com.sun.star.beans.PropertyState.AMBIGUOUS_VALUE;
161 cl.setPropertyValue("PropEnum",value);
162 ret= cl.getPropertyValue("PropEnum");
163 r[i++]= ret == value;
164 value= new byte[]{1,2,3};
165 cl.setPropertyValue("PropArrayByteA", value);
166 ret= cl.getPropertyValue("PropArrayByteA");
167 r[i++]= ((byte[]) ret).equals((byte[]) value);
168 value= new Type(String.class);
169 cl.setPropertyValue("PropTypeA", value);
170 ret= cl.getPropertyValue("PropTypeA");
171 r[i++]= ((Type) ret).equals(value);
173 // test protected,package,private members
174 value= new Boolean(true);
175 cl.setPropertyValue("PropBoolB", value);
176 ret= cl.getPropertyValue("PropBoolB");
177 r[i++]= ((Boolean) ret).equals((Boolean) value);
178 cl.setPropertyValue("PropBoolC", value);
179 ret= cl.getPropertyValue("PropBoolC");
180 r[i++]= ((Boolean) ret).equals((Boolean) value);
182 try{
183 cl.setPropertyValue("PropBoolD", value);
184 i++;
185 }catch (Exception e)
187 r[i++]= true;
189 cl.resetPropertyMembers();
191 value= new Boolean(true);
192 cl.setPropertyValue("PropObjectA", value);
193 ret= cl.getPropertyValue("PropObjectA");
194 r[i++]= ((Boolean) ret).equals((Boolean) value);
195 value= new Character('A');
196 cl.setPropertyValue("PropObjectA",value);
197 ret= cl.getPropertyValue("PropObjectA");
198 r[i++]= ((Character) ret).equals((Character) value);
199 value= new Byte((byte) 111);
200 cl.setPropertyValue("PropObjectA",value);
201 ret= cl.getPropertyValue("PropObjectA");
202 r[i++]= ((Byte) ret).equals((Byte) value);
203 value= new Short((short)112);
204 cl.setPropertyValue("PropObjectA", value);
205 ret= cl.getPropertyValue("PropObjectA");
206 r[i++]= ((Short) ret).equals((Short) value);
207 value= new Integer(113);
208 cl.setPropertyValue("PropObjectA", value);
209 ret= cl.getPropertyValue("PropObjectA");
210 r[i++]= ((Integer) ret).equals((Integer) value);
211 value= new Long(115);
212 cl.setPropertyValue("PropObjectA", value);
213 ret= cl.getPropertyValue("PropObjectA");
214 r[i++]= ((Long) ret).equals((Long) value);
215 value= new Float(3.14);
216 cl.setPropertyValue("PropObjectA", value);
217 ret= cl.getPropertyValue("PropObjectA");
218 r[i++]= ((Float) ret).equals((Float) value);
219 value= new Double(3.145);
220 cl.setPropertyValue("PropObjectA",value);
221 ret= cl.getPropertyValue("PropObjectA");
222 r[i++]= ((Double) ret).equals((Double) value);
223 value= new String("string");
224 cl.setPropertyValue("PropObjectA",value);
225 ret= cl.getPropertyValue("PropObjectA");
226 r[i++]= ((String) ret).equals((String) value);
227 value= new ComponentBase();
228 cl.setPropertyValue("PropObjectA",value);
229 ret= cl.getPropertyValue("PropObjectA");
230 r[i++]= ((XInterface) ret).equals((XInterface) value);
231 value= new ComponentBase();
232 cl.setPropertyValue("PropObjectA",value);
233 ret= cl.getPropertyValue("PropObjectA");
234 r[i++]= ((XWeak) ret).equals((XWeak) value);
235 value= new byte[]{1,2,3};
236 cl.setPropertyValue("PropObjectA", value);
237 ret= cl.getPropertyValue("PropObjectA");
238 r[i++]= ((byte[]) ret).equals((byte[]) value);
239 value= new Type(String.class);
240 cl.setPropertyValue("PropObjectA", value);
241 ret= cl.getPropertyValue("PropObjectA");
242 r[i++]= ((Type) ret).equals(value);
243 cl.setPropertyValue("PropObjectA", new Any( new Type(byte.class), new Byte((byte)1)));
244 ret= cl.getPropertyValue("PropObjectA");
245 r[i++]= ((Byte) ret).byteValue() == 1;
247 cl.resetPropertyMembers();
248 value= new Boolean(true);
249 cl.setPropertyValue("PropAnyA", value);
250 ret= cl.getPropertyValue("PropAnyA");
251 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
252 value= new Character('A');
253 cl.setPropertyValue("PropAnyA",value);
254 ret= cl.getPropertyValue("PropAnyA");
255 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
256 value= new Byte((byte) 111);
257 cl.setPropertyValue("PropAnyA",value);
258 ret= cl.getPropertyValue("PropAnyA");
259 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
260 value= new Short((short)112);
261 cl.setPropertyValue("PropAnyA", value);
262 ret= cl.getPropertyValue("PropAnyA");
263 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
264 value= new Integer(113);
265 cl.setPropertyValue("PropAnyA", value);
266 ret= cl.getPropertyValue("PropAnyA");
267 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
268 value= new Long(115);
269 cl.setPropertyValue("PropAnyA", value);
270 ret= cl.getPropertyValue("PropAnyA");
271 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
272 value= new Float(3.14);
273 cl.setPropertyValue("PropAnyA", value);
274 ret= cl.getPropertyValue("PropAnyA");
275 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
276 value= new Double(3.145);
277 cl.setPropertyValue("PropAnyA",value);
278 ret= cl.getPropertyValue("PropAnyA");
279 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
280 value= new String("string");
281 cl.setPropertyValue("PropAnyA",value);
282 ret= cl.getPropertyValue("PropAnyA");
283 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
284 value= new ComponentBase();
285 cl.setPropertyValue("PropAnyA",value);
286 ret= cl.getPropertyValue("PropAnyA");
287 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
288 value= new ComponentBase();
289 cl.setPropertyValue("PropAnyA",value);
290 ret= cl.getPropertyValue("PropAnyA");
291 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
292 value= new byte[]{1,2,3};
293 cl.setPropertyValue("PropAnyA", value);
294 ret= cl.getPropertyValue("PropAnyA");
295 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
296 value= new Type(String.class);
297 cl.setPropertyValue("PropAnyA", value);
298 ret= cl.getPropertyValue("PropAnyA");
299 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
301 cl.resetPropertyMembers();
302 value= new Any(new Type(boolean.class), new Boolean(true));
303 cl.setPropertyValue("PropBoolA", value);
304 ret= cl.getPropertyValue("PropBoolA");
305 r[i++]= ret instanceof Boolean && util.anyEquals(value, ret);
306 value= new Any (new Type(char.class), new Character('A'));
307 cl.setPropertyValue("PropCharA",value);
308 ret= cl.getPropertyValue("PropCharA");
309 r[i++]= ret instanceof Character && util.anyEquals(value, ret);
310 value= new Any(new Type(byte.class), new Byte((byte) 111));
311 cl.setPropertyValue("PropByteA",value);
312 ret= cl.getPropertyValue("PropByteA");
313 r[i++]= ret instanceof Byte && util.anyEquals(value, ret);
314 value= new Any(new Type(short.class), new Short((short)112));
315 cl.setPropertyValue("PropShortA", value);
316 ret= cl.getPropertyValue("PropShortA");
317 r[i++]= ret instanceof Short && util.anyEquals(value, ret);
318 value= new Any(new Type(int.class), new Integer(113));
319 cl.setPropertyValue("PropIntA", value);
320 ret= cl.getPropertyValue("PropIntA");
321 r[i++]= ret instanceof Integer && util.anyEquals(value, ret);
322 value= new Any(new Type(long.class), new Long(115));
323 cl.setPropertyValue("PropLongA", value);
324 ret= cl.getPropertyValue("PropLongA");
325 r[i++]= ret instanceof Long && util.anyEquals(value, ret);
326 value= new Any(new Type(float.class), new Float(3.14));
327 cl.setPropertyValue("PropFloatA", value);
328 ret= cl.getPropertyValue("PropFloatA");
329 r[i++]= ret instanceof Float && util.anyEquals(value, ret);
330 value= new Any(new Type(double.class),new Double(3.145));
331 cl.setPropertyValue("PropDoubleA",value);
332 ret= cl.getPropertyValue("PropDoubleA");
333 r[i++]= ret instanceof Double && util.anyEquals(value, ret);
334 value= new Any(new Type(String.class), new String("string"));
335 cl.setPropertyValue("PropStringA",value);
336 ret= cl.getPropertyValue("PropStringA");
337 r[i++]= ret instanceof String && util.anyEquals(value, ret);
338 value= new Any(new Type(ComponentBase.class), new ComponentBase());
339 cl.setPropertyValue("PropXInterfaceA",value);
340 ret= cl.getPropertyValue("PropXInterfaceA");
341 r[i++]= ret instanceof ComponentBase && util.anyEquals(value, ret);
342 value= new Any( new Type(ComponentBase.class), new ComponentBase());
343 cl.setPropertyValue("PropXWeakA",value);
344 ret= cl.getPropertyValue("PropXWeakA");
345 r[i++]= ret instanceof ComponentBase && util.anyEquals(value, ret);
346 value= new Any(new Type(byte[].class), new byte[]{1,2,3});
347 cl.setPropertyValue("PropArrayByteA", value);
348 ret= cl.getPropertyValue("PropArrayByteA");
349 r[i++]= ret instanceof byte[] && util.anyEquals(value, ret);
350 value= new Any(new Type(Type.class), new Type(String.class));
351 cl.setPropertyValue("PropTypeA", value);
352 ret= cl.getPropertyValue("PropTypeA");
353 r[i++]= ret instanceof Type && util.anyEquals(value, ret);
356 cl.resetPropertyMembers();
357 value= new Any(new Type(boolean.class), new Boolean(true));
358 cl.setPropertyValue("PropAnyA", value);
359 ret= cl.getPropertyValue("PropAnyA");
360 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
361 value= new Any (new Type(char.class), new Character('A'));
362 cl.setPropertyValue("PropAnyA",value);
363 ret= cl.getPropertyValue("PropAnyA");
364 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
365 value= new Any(new Type(byte.class), new Byte((byte) 111));
366 cl.setPropertyValue("PropAnyA",value);
367 ret= cl.getPropertyValue("PropAnyA");
368 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
369 value= new Any(new Type(short.class), new Short((short)112));
370 cl.setPropertyValue("PropAnyA", value);
371 ret= cl.getPropertyValue("PropAnyA");
372 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
373 value= new Any(new Type(int.class), new Integer(113));
374 cl.setPropertyValue("PropAnyA", value);
375 ret= cl.getPropertyValue("PropAnyA");
376 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
377 value= new Any(new Type(long.class), new Long(115));
378 cl.setPropertyValue("PropAnyA", value);
379 ret= cl.getPropertyValue("PropAnyA");
380 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
381 value= new Any(new Type(float.class), new Float(3.14));
382 cl.setPropertyValue("PropAnyA", value);
383 ret= cl.getPropertyValue("PropAnyA");
384 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
385 value= new Any(new Type(double.class),new Double(3.145));
386 cl.setPropertyValue("PropAnyA",value);
387 ret= cl.getPropertyValue("PropAnyA");
388 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
389 value= new Any(new Type(String.class), new String("string"));
390 cl.setPropertyValue("PropAnyA",value);
391 ret= cl.getPropertyValue("PropAnyA");
392 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
393 value= new Any(new Type(ComponentBase.class), new ComponentBase());
394 cl.setPropertyValue("PropAnyA",value);
395 ret= cl.getPropertyValue("PropAnyA");
396 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
397 value= new Any( new Type(ComponentBase.class), new ComponentBase());
398 cl.setPropertyValue("PropAnyA",value);
399 ret= cl.getPropertyValue("PropAnyA");
400 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
401 value= new Any(new Type(byte[].class), new byte[]{1,2,3});
402 cl.setPropertyValue("PropAnyA", value);
403 ret= cl.getPropertyValue("PropAnyA");
404 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
405 value= new Any(new Type(Type.class), new Type(String.class));
406 cl.setPropertyValue("PropAnyA", value);
407 ret= cl.getPropertyValue("PropAnyA");
408 r[i++]= ret instanceof Any && util.anyEquals(value, ret);
411 // ------------------------------------------------------------------------------
412 cl.resetPropertyMembers();
413 value= new Boolean(true);
414 cl.setPropertyValue("PropBoolClass", value);
415 ret= cl.getPropertyValue("PropBoolClass");
416 r[i++]= ((Boolean) ret).equals( (Boolean) value);
417 value= new Character('A');
418 cl.setPropertyValue("PropCharClass",value);
419 ret= cl.getPropertyValue("PropCharClass");
420 r[i++]= ((Character) ret).equals((Character) value);
421 value= new Byte((byte) 111);
422 cl.setPropertyValue("PropByteClass",value);
423 ret= cl.getPropertyValue("PropByteClass");
424 r[i++]= ((Byte) ret).equals((Byte) value);
425 value= new Short((short)112);
426 cl.setPropertyValue("PropShortClass", value);
427 ret= cl.getPropertyValue("PropShortClass");
428 r[i++]= ((Short) ret).equals((Short) value);
429 value= new Integer(113);
430 cl.setPropertyValue("PropIntClass", value);
431 ret= cl.getPropertyValue("PropIntClass");
432 r[i++]= ((Integer) ret).equals((Integer) value);
433 value= new Long(115);
434 cl.setPropertyValue("PropLongClass", value);
435 ret= cl.getPropertyValue("PropLongClass");
436 r[i++]= ((Long) ret).equals((Long) value);
437 value= new Float(3.14);
438 cl.setPropertyValue("PropFloatClass", value);
439 ret= cl.getPropertyValue("PropFloatClass");
440 r[i++]= ((Float) ret).equals((Float) value);
441 value= new Double(3.145);
442 cl.setPropertyValue("PropDoubleClass",value);
443 ret= cl.getPropertyValue("PropDoubleClass");
444 r[i++]= ((Double) ret).equals((Double) value);
446 cl.resetPropertyMembers();
448 cl.resetPropertyMembers();
449 value= new Any(new Type(boolean.class), new Boolean(true));
450 cl.setPropertyValue("PropBoolClass", value);
451 ret= cl.getPropertyValue("PropBoolClass");
452 r[i++]= ret instanceof Boolean && util.anyEquals(value, ret);
453 value= new Any (new Type(char.class), new Character('A'));
454 cl.setPropertyValue("PropCharClass",value);
455 ret= cl.getPropertyValue("PropCharClass");
456 r[i++]= ret instanceof Character && util.anyEquals(value, ret);
457 value= new Any(new Type(byte.class), new Byte((byte) 111));
458 cl.setPropertyValue("PropByteClass",value);
459 ret= cl.getPropertyValue("PropByteClass");
460 r[i++]= ret instanceof Byte && util.anyEquals(value, ret);
461 value= new Any(new Type(short.class), new Short((short)112));
462 cl.setPropertyValue("PropShortClass", value);
463 ret= cl.getPropertyValue("PropShortClass");
464 r[i++]= ret instanceof Short && util.anyEquals(value, ret);
465 value= new Any(new Type(int.class), new Integer(113));
466 cl.setPropertyValue("PropIntClass", value);
467 ret= cl.getPropertyValue("PropIntClass");
468 r[i++]= ret instanceof Integer && util.anyEquals(value, ret);
469 value= new Any(new Type(long.class), new Long(115));
470 cl.setPropertyValue("PropLongClass", value);
471 ret= cl.getPropertyValue("PropLongClass");
472 r[i++]= ret instanceof Long && util.anyEquals(value, ret);
473 value= new Any(new Type(float.class), new Float(3.14));
474 cl.setPropertyValue("PropFloatClass", value);
475 ret= cl.getPropertyValue("PropFloatClass");
476 r[i++]= ret instanceof Float && util.anyEquals(value, ret);
477 value= new Any(new Type(double.class),new Double(3.145));
478 cl.setPropertyValue("PropDoubleClass",value);
479 ret= cl.getPropertyValue("PropDoubleClass");
480 r[i++]= ret instanceof Double && util.anyEquals(value, ret);
481 value= new Any(new Type(String.class), new String("string"));
485 // PropertyAttribute.READONLY
486 cl.propBoolA.Attributes= PropertyAttribute.READONLY;
487 try{
488 cl.setPropertyValue("PropBoolA", new Boolean(true));
489 i++;
490 }catch (com.sun.star.beans.PropertyVetoException e)
492 r[i++]= true;
494 cl.propBoolA.Attributes= 0;
496 // MAYBEVOID
497 cl.resetPropertyMembers();
498 // first MAYBEVOID not set
500 //primitive members: must not work
502 cl.boolPropA= false;
503 try {
504 cl.setPropertyValue("PropBoolA", null); i++;
505 } catch (com.sun.star.lang.IllegalArgumentException e) {
506 r[i++]= true;
508 try {
509 cl.setPropertyValue("PropBoolA", new Any(new Type(boolean.class), null)); i++;
510 } catch (com.sun.star.lang.IllegalArgumentException e) {
511 r[i++]= true;
513 cl.propBoolA.Attributes= PropertyAttribute.MAYBEVOID;
514 try{
515 cl.setPropertyValue("PropBoolA", null); i++;
516 } catch (com.sun.star.lang.IllegalArgumentException e) {
517 r[i++]= true;
519 cl.propBoolA.Attributes= 0;
521 cl.propBoolClass.Attributes= PropertyAttribute.MAYBEVOID;
522 cl.boolClassProp= null;
523 cl.setPropertyValue("PropBoolClass", null);
524 r[i++]= cl.boolClassProp == null;
525 // the returned value must be a void any
526 Object objAny= cl.getPropertyValue("PropBoolClass");
527 r[i++]= util.isVoidAny( objAny);
529 cl.boolClassProp= new Boolean(true);
530 cl.setPropertyValue("PropBoolClass", null);
531 r[i++]= cl.boolClassProp == null;
532 cl.boolClassProp= new Boolean(false);
533 cl.setPropertyValue("PropBoolClass", new Any(new Type(boolean.class),null));
534 r[i++]= cl.boolClassProp == null;
536 cl.propXWeakA.Attributes= PropertyAttribute.MAYBEVOID;
537 cl.setPropertyValue("PropXWeakA", null);
538 r[i++]= util.isVoidAny(cl.getPropertyValue("PropXWeakA"));
539 cl.propXWeakA.Attributes= 0;
541 cl.anyPropA= null;
542 try{
543 cl.setPropertyValue("PropAnyA", null); i++;
544 }catch (com.sun.star.lang.IllegalArgumentException e) {
545 r[i++]= true;
547 cl.anyPropA= null;
548 cl.propAnyA.Attributes= PropertyAttribute.MAYBEVOID;
550 Type _t= new Type(Object.class);
551 cl.setPropertyValue("PropAnyA", null);
552 r[i++]= cl.anyPropA.getType().equals(new Type(void.class)) &&
553 cl.anyPropA.getObject() == null;
555 cl.anyPropA= new Any(new Type(byte.class),new Byte((byte) 111));
556 cl.setPropertyValue("PropAnyA", null);
557 r[i++]= cl.anyPropA.getType().equals(new Type(byte.class)) &&
558 cl.anyPropA.getObject() == null;
560 cl.anyPropA= null;
561 try{
562 cl.setPropertyValue("PropAnyA", new Object()); i++;
563 }catch (com.sun.star.lang.IllegalArgumentException e)
565 r[i++]= true;
568 cl.propObjectA.Attributes= 0;
569 try{
570 cl.setPropertyValue("PropObjectA", null); i++;
571 }catch (com.sun.star.lang.IllegalArgumentException e)
573 r[i++]= true;
575 try{
576 cl.setPropertyValue("PropObjectA", new Any( new Type(byte.class), null)); i++;
577 } catch (com.sun.star.lang.IllegalArgumentException e)
579 r[i++]= true;
582 cl.propObjectA.Attributes= PropertyAttribute.MAYBEVOID;
583 cl.propObjectA= null;
584 cl.setPropertyValue("PropObjectA", null);
585 r[i++]= cl.propObjectA == null;
587 cl.propObjectA= null;
588 cl.setPropertyValue("PropObjectA", new Any( new Type(byte.class), null));
589 r[i++]= cl.propObjectA == null;
594 }catch(java.lang.Exception e){
595 i++;
597 boolean bOk= true;
598 for (int c= 0; c < i; c++)
599 bOk= bOk && r[c];
600 if (bOk == false)
601 System.out.println("Failed");
602 else
603 System.out.println("Ok");
604 return bOk;
607 public boolean addPropertyChangeListener()
609 System.out.println("PropertySet.addPropertyChangeListener,\n" +
610 "PropertySet.removePropertChangeListener," +
611 "PropertySet.addVetoableChangeListener, \n" +
612 "PropertySet.removeVetoableChangeListener" +
613 "Notification of listeners");
614 boolean[] r= new boolean[50];
615 int i= 0;
616 try {
617 TestClass cl= new TestClass();
618 Listener li= new Listener();
619 cl.addPropertyChangeListener("PropByteA", li);
620 Byte val1= new Byte((byte)115);
621 cl.setPropertyValue("PropByteA", val1);
622 r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 0;
623 cl.propByteA.Attributes = PropertyAttribute.BOUND;
624 cl.addPropertyChangeListener("PropByteA", li);
625 Byte val2= new Byte((byte)116);
626 cl.setPropertyValue("PropByteA", val2);
627 r[i++]= li.nChangeCalled == 1 && li.nVetoCalled == 0;
628 r[i++]= li.evt.OldValue.equals(val1) && li.evt.NewValue.equals(val2) && li.evt.Source == cl;
630 li.reset();
631 Listener li2= new Listener();
632 cl.addPropertyChangeListener("PropByteA", li2);
633 Byte val3= new Byte((byte) 117);
634 cl.setPropertyValue("PropByteA", val3);
635 r[i++]= li.nChangeCalled == 1 && li.nVetoCalled == 0
636 && li2.nChangeCalled == 1 && li2.nVetoCalled == 0;
637 r[i++]= li.evt.OldValue.equals(val2) && li.evt.NewValue.equals(val3) && li.evt.Source == cl
638 && li2.evt.OldValue.equals(val2) && li2.evt.NewValue.equals(val3) && li2.evt.Source == cl ;
640 li.reset();
641 li2.reset();
642 Listener li3= new Listener();
643 val1= new Byte((byte)118);
644 cl.addPropertyChangeListener("", li3);
645 cl.setPropertyValue("PropByteA", val1);
646 r[i++]= li.nChangeCalled == 1 && li.nVetoCalled == 0
647 && li2.nChangeCalled == 1 && li2.nVetoCalled == 0
648 && li3.nChangeCalled == 1 && li3.nVetoCalled == 0;
649 r[i++]= li.evt.OldValue.equals(val3) && li.evt.NewValue.equals(val1) && li.evt.Source == cl;
650 r[i++]= li2.evt.OldValue.equals(val3) && li2.evt.NewValue.equals(val1) && li2.evt.Source == cl;
651 r[i++]= li3.evt.OldValue.equals(val3) && li3.evt.NewValue.equals(val1) && li3.evt.Source == cl ;
653 li.reset();
654 li2.reset();
655 li3.reset();
656 cl.removePropertyChangeListener("PropByteA",li);
657 cl.setPropertyValue("PropByteA", val1);
658 r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 0
659 && li2.nChangeCalled == 1 && li2.nVetoCalled == 0
660 && li3.nChangeCalled == 1 && li3.nVetoCalled == 0;
661 cl.removePropertyChangeListener("PropByteA", li2);
662 li.reset();
663 li2.reset();
664 li3.reset();
665 cl.setPropertyValue("PropByteA", val1);
666 r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 0
667 && li2.nChangeCalled == 0 && li2.nVetoCalled == 0
668 && li3.nChangeCalled == 1 && li3.nVetoCalled == 0;
670 cl.removePropertyChangeListener("", li3);
671 li.reset();
672 li2.reset();
673 li3.reset();
674 cl.setPropertyValue("PropByteA", val2);
675 r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 0
676 && li2.nChangeCalled == 0 && li2.nVetoCalled == 0
677 && li3.nChangeCalled == 0 && li3.nVetoCalled == 0;
679 cl.addPropertyChangeListener("PropByteA", li);
680 cl.addPropertyChangeListener("PropByteA", li2);
681 cl.addPropertyChangeListener("", li3);
682 cl.dispose();
683 li.reset();
684 li2.reset();
685 li3.reset();
686 try {
687 cl.setPropertyValue("PropByteA", val2); i++;
688 }catch (DisposedException e)
690 r[i++]= true;
693 //Vetoable tests
694 cl= new TestClass();
695 li.reset();
696 li2.reset();
697 li3.reset();
698 cl.addVetoableChangeListener("PropByteA", li);
699 val1= new Byte((byte)115);
700 cl.setPropertyValue("PropByteA", val1);
701 r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 0;
702 cl.propByteA.Attributes = PropertyAttribute.CONSTRAINED;
703 cl.addVetoableChangeListener("PropByteA", li);
704 val2= new Byte((byte)116);
705 li.reset();
706 cl.setPropertyValue("PropByteA", val2);
707 r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 1;
708 r[i++]= li.evt.OldValue.equals(val1) && li.evt.NewValue.equals(val2) && li.evt.Source == cl;
710 li.reset();
711 li2.reset();
712 li3.reset();
713 cl.addVetoableChangeListener("PropByteA", li2);
714 val3= new Byte((byte) 117);
715 cl.setPropertyValue("PropByteA", val3);
716 r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 1
717 && li2.nChangeCalled == 0 && li2.nVetoCalled == 1;
718 r[i++]= li.evt.OldValue.equals(val2) && li.evt.NewValue.equals(val3) && li.evt.Source == cl
719 && li2.evt.OldValue.equals(val2) && li2.evt.NewValue.equals(val3) && li2.evt.Source == cl ;
721 li.reset();
722 li2.reset();
723 li3.reset();
724 val1= new Byte((byte)118);
725 cl.addVetoableChangeListener("", li3);
726 cl.setPropertyValue("PropByteA", val1);
727 r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 1
728 && li2.nChangeCalled == 0 && li2.nVetoCalled == 1
729 && li3.nChangeCalled == 0 && li3.nVetoCalled == 1;
730 r[i++]= li.evt.OldValue.equals(val3) && li.evt.NewValue.equals(val1) && li.evt.Source == cl;
731 r[i++]= li2.evt.OldValue.equals(val3) && li2.evt.NewValue.equals(val1) && li2.evt.Source == cl;
732 r[i++]= li3.evt.OldValue.equals(val3) && li3.evt.NewValue.equals(val1) && li3.evt.Source == cl ;
734 li.reset();
735 li2.reset();
736 li3.reset();
737 // Test Veto Exception
738 cl.setPropertyValue("PropByteA", val1);
739 li.bVeto= true;
740 try {
741 cl.setPropertyValue("PropByteA", val2);i++;
742 } catch (PropertyVetoException e)
744 r[i++]= true;
746 r[i++]= cl.bytePropA == val1.byteValue();
747 li.bVeto= false;
749 li.reset();
750 li2.reset();
751 li3.reset();
752 cl.removeVetoableChangeListener("PropByteA",li);
753 cl.setPropertyValue("PropByteA", val1);
754 r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 0
755 && li2.nChangeCalled == 0 && li2.nVetoCalled == 1
756 && li3.nChangeCalled == 0 && li3.nVetoCalled == 1;
757 cl.removeVetoableChangeListener("PropByteA", li2);
758 li.reset();
759 li2.reset();
760 li3.reset();
761 cl.setPropertyValue("PropByteA", val1);
762 r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 0
763 && li2.nChangeCalled == 0 && li2.nVetoCalled == 0
764 && li3.nChangeCalled == 0 && li3.nVetoCalled == 1;
766 cl.removeVetoableChangeListener("", li3);
767 li.reset();
768 li2.reset();
769 li3.reset();
770 cl.setPropertyValue("PropByteA", val2);
771 r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 0
772 && li2.nChangeCalled == 0 && li2.nVetoCalled == 0
773 && li3.nChangeCalled == 0 && li3.nVetoCalled == 0;
775 cl.addVetoableChangeListener("PropByteA", li);
776 cl.addVetoableChangeListener("PropByteA", li2);
777 cl.addVetoableChangeListener("", li3);
778 cl.dispose();
779 li.reset();
780 li2.reset();
781 li3.reset();
782 try {
783 cl.setPropertyValue("PropByteA", val2);
784 }catch (DisposedException e)
786 r[i++]= true;
788 }catch (Exception e)
790 i++;
792 boolean bOk= true;
793 for (int c= 0; c < i; c++)
794 bOk= bOk && r[c];
795 if (bOk == false)
796 System.out.println("Failed");
797 else
798 System.out.println("Ok");
799 return bOk;
802 public boolean getPropertySetInfo()
804 System.out.println("PropertySet.getPropertySetInfo");
805 boolean[] r= new boolean[50];
806 int i= 0;
808 TestClass cl= new TestClass();
809 try {
810 XPropertySetInfo info= cl.getPropertySetInfo();
811 Property[] arProps= info.getProperties();
812 Property[] arRegProps= cl.getRegisteredProperties();
813 r[i++]= arProps.length == arRegProps.length;
814 for (int j= 0; j < arProps.length; j++)
816 boolean bFound= false;
817 for (int k= 0; k < arRegProps.length; k++)
819 if (arProps[j] == arRegProps[k])
821 bFound= true;
822 break;
825 if ( !bFound)
826 r[i++]= false;
829 for (int j= 0; j < arRegProps.length; j++)
831 Property prop= info.getPropertyByName(arRegProps[j].Name);
832 if (prop != arRegProps[j])
833 r[i++]= false;
834 if (! info.hasPropertyByName(arRegProps[j].Name))
835 r[i++]= false;
839 }catch(java.lang.Exception e){
840 System.out.println(e.getMessage());
841 i++;
844 boolean bOk= true;
845 for (int c= 0; c < i; c++)
846 bOk= bOk && r[c];
847 if (bOk == false)
848 System.out.println("Failed");
849 else
850 System.out.println("Ok");
851 return bOk;
854 public boolean setFastPropertyValue()
856 System.out.println("PropertySet.setFastPropertyValue");
857 boolean[] r= new boolean[50];
858 int i= 0;
860 TestClass cl= new TestClass();
861 try {
862 cl.setFastPropertyValue(5, new Integer(111));
863 r[i++]= cl.intPropA == 111;
864 try {
865 cl.setFastPropertyValue(-1, new Integer(1)); i++;
866 } catch(UnknownPropertyException e)
868 r[i++]= true;
870 }catch(java.lang.Exception e){
871 System.out.println(e.getMessage());
872 i++;
875 boolean bOk= true;
876 for (int c= 0; c < i; c++)
877 bOk= bOk && r[c];
878 if (bOk == false)
879 System.out.println("Failed");
880 else
881 System.out.println("Ok");
882 return bOk;
885 public boolean getFastPropertyValue()
887 System.out.println("PropertySet.setFastPropertyValue");
888 boolean[] r= new boolean[50];
889 int i= 0;
891 TestClass cl= new TestClass();
892 try {
893 cl.setFastPropertyValue(5, new Integer(111));
894 Integer aInt= (Integer) cl.getFastPropertyValue(5);
895 r[i++]= aInt.intValue() == 111;
896 }catch(java.lang.Exception e){
897 System.out.println(e.getMessage());
898 i++;
901 boolean bOk= true;
902 for (int c= 0; c < i; c++)
903 bOk= bOk && r[c];
904 if (bOk == false)
905 System.out.println("Failed");
906 else
907 System.out.println("Ok");
908 return bOk;
911 public boolean setPropertyValues()
913 System.out.println("PropertySet.setPropertyValues");
914 boolean[] r= new boolean[50];
915 int i= 0;
917 TestClass cl= new TestClass();
918 try {
919 cl.setPropertyValues(new String[0], new Object[0]);
920 String[] arNames= new String[] {"PropCharA","PropIntClass","PropObjectA"};
921 Character aChar= new Character('A');
922 Integer aInt= new Integer(111);
923 Byte aByte= new Byte((byte)11);
924 Object[] values= new Object[]{aChar, aInt, aByte};
925 cl.setPropertyValues(arNames, values);
926 r[i++]= cl.charPropA == 'A' && cl.intClassProp.intValue() == 111 && ((Byte)cl.objectPropA).byteValue() == 11;
928 arNames= new String[] {"blabla","PropIntClass","PropObjectA"};
929 cl.resetPropertyMembers();
930 cl.setPropertyValues(arNames, values);
931 r[i++]= cl.intClassProp.intValue() == 111 && ((Byte)cl.objectPropA).byteValue() == 11;
932 }catch(java.lang.Exception e){
933 System.out.println(e.getMessage());
934 i++;
936 boolean bOk= true;
937 for (int c= 0; c < i; c++)
938 bOk= bOk && r[c];
939 if (bOk == false)
940 System.out.println("Failed");
941 else
942 System.out.println("Ok");
943 return bOk;
946 public boolean getPropertyValues()
948 System.out.println("PropertySet.getPropertyValues");
949 boolean[] r= new boolean[50];
950 int i= 0;
952 TestClass cl= new TestClass();
953 try {
954 cl.charPropA= 'A';
955 cl.intClassProp= new Integer(111);
956 cl.objectPropA= new Byte((byte)11);
957 Object[] values= cl.getPropertyValues(new String[] {"PropCharA","PropIntClass","PropObjectA"});
959 r[i++]= ((Character) values[0]).charValue() == 'A' && ((Integer) values[1]).intValue() == 111
960 && ((Byte) values[2]).byteValue() == 11;
961 }catch(java.lang.Exception e){
962 System.out.println(e.getMessage());
963 i++;
965 boolean bOk= true;
966 for (int c= 0; c < i; c++)
967 bOk= bOk && r[c];
968 if (bOk == false)
969 System.out.println("Failed");
970 else
971 System.out.println("Ok");
972 return bOk;
975 // Currently the listeners are always notified if one of properties has changed.
976 // The property names in the first argument are ignored.
977 public boolean addPropertiesChangeListener()
979 System.out.println("PropertySet.addPropertiesChangeListener\n" +
980 "PropertySet.removePropertiesChangeListener\n" +
981 "notification of such listeners");
982 boolean[] r= new boolean[50];
983 int i= 0;
985 TestClass cl= new TestClass();
986 try {
987 Listener li1= new Listener();
988 Listener li2= new Listener();
989 cl.addPropertiesChangeListener(new String[]{"PropCharA"}, li1);
990 cl.setPropertyValue("PropCharA", new Character('B'));
991 r[i++]= li1.nPropertiesChange == 0;
992 cl.propCharA.Attributes= PropertyAttribute.BOUND;
993 cl.setPropertyValue("PropCharA", new Character('C'));
994 r[i++]= li1.nPropertiesChange == 1;
996 PropertyChangeEvent evt= li1.arEvt[0];
997 r[i++]= evt.PropertyName.equals("PropCharA") && ((Character)evt.OldValue).charValue() == 'B'
998 && ((Character) evt.NewValue).charValue() == 'C';
999 li1.reset();
1000 cl.removePropertiesChangeListener(li1);
1001 cl.setPropertyValue("PropCharA", new Character('F'));
1002 r[i++]= li1.nPropertiesChange == 0;
1003 }catch(java.lang.Exception e){
1004 System.out.println(e.getMessage());
1005 i++;
1007 boolean bOk= true;
1008 for (int c= 0; c < i; c++)
1009 bOk= bOk && r[c];
1010 if (bOk == false)
1011 System.out.println("Failed");
1012 else
1013 System.out.println("Ok");
1014 return bOk;
1017 public boolean firePropertiesChangeEvent()
1019 System.out.println("PropertySet.firePropertiesChangeEvent");
1020 boolean[] r= new boolean[50];
1021 int i= 0;
1023 TestClass cl= new TestClass();
1024 try {
1025 Listener li1= new Listener();
1026 cl.intClassProp= new Integer(111);
1027 cl.charPropA= 'A';
1028 cl.firePropertiesChangeEvent(new String[]{"PropCharA","PropIntClass"}, li1);
1029 r[i++]= li1.nPropertiesChange == 1;
1030 PropertyChangeEvent[] arEvt= li1.arEvt;
1031 r[i++]= arEvt[0].PropertyName.equals("PropCharA")
1032 && ((Character) arEvt[0].OldValue).charValue() == 'A'
1033 && ((Character) arEvt[0].NewValue).charValue() == 'A';
1034 r[i++]= arEvt[1].PropertyName.equals("PropIntClass")
1035 && ((Integer) arEvt[1].OldValue).intValue() == 111
1036 && ((Integer) arEvt[1].NewValue).intValue() == 111;
1037 }catch(java.lang.Exception e){
1038 System.out.println(e.getMessage());
1039 i++;
1041 boolean bOk= true;
1042 for (int c= 0; c < i; c++)
1043 bOk= bOk && r[c];
1044 if (bOk == false)
1045 System.out.println("Failed");
1046 else
1047 System.out.println("Ok");
1048 return bOk;
1051 public boolean registerProperty1()
1053 TestClass2 cl= new TestClass2();
1054 return cl.test_registerProperty1();
1057 public boolean registerProperty2()
1059 TestClass2 cl= new TestClass2();
1060 return cl.test_registerProperty2();
1063 public static boolean test()
1065 PropertySet_Test test= new PropertySet_Test();
1066 boolean r[]= new boolean[50];
1067 int i= 0;
1068 r[i++]= test.convertPropertyValue();
1069 r[i++]= test.setPropertyValueNoBroadcast();
1070 r[i++]= test.setPropertyValue();
1071 r[i++]= test.addPropertyChangeListener();
1072 r[i++]= test.getPropertySetInfo();
1073 r[i++]= test.setFastPropertyValue();
1074 r[i++]= test.getFastPropertyValue();
1075 r[i++]= test.setPropertyValues();
1076 r[i++]= test.getPropertyValues();
1077 r[i++]= test.addPropertiesChangeListener();
1078 r[i++]= test.firePropertiesChangeEvent();
1079 r[i++]= test.registerProperty1();
1080 r[i++]= test.registerProperty2();
1081 boolean bOk= true;
1082 for (int c= 0; c < i; c++)
1083 bOk= bOk && r[c];
1084 if (bOk == false)
1085 System.out.println("Errors occured!");
1086 else
1087 System.out.println("No errors.");
1088 return bOk;
1090 public static void main(String[] args)
1092 test();
1096 class TestClass extends PropertySet
1098 public Property propBoolA= new Property("PropBoolA", 1, new Type(Boolean.TYPE), (short)0);
1099 public boolean boolPropA;
1100 public Property propCharA= new Property("PropCharA", 2, new Type(Character.TYPE), (short) 0);
1101 public char charPropA;
1102 public Property propByteA= new Property("PropByteA", 3, new Type(Byte.TYPE), (short) 0);
1103 public byte bytePropA;
1104 public Property propShortA= new Property("PropShortA", 4, new Type(Short.TYPE), (short) 0);
1105 public short shortPropA;
1106 public Property propIntA= new Property("PropIntA", 5, new Type(Integer.TYPE), (short) 0);
1107 public int intPropA;
1108 public Property propLongA= new Property("PropLongA", 6, new Type(Long.TYPE), (short) 0);
1109 public long longPropA;
1110 public Property propFloatA= new Property("PropFloatA", 7, new Type(Float.TYPE), (short) 0);
1111 public float floatPropA;
1112 public Property propDoubleA= new Property("PropDoubleA", 8, new Type(Double.TYPE), (short) 0);
1113 public double doublePropA;
1114 public Property propStringA= new Property("PropStringA", 9, new Type(String.class), (short) 0);
1115 public String stringPropA;
1116 public Property propArrayByteA= new Property("PropArrayByteA", 10, new Type(byte[].class), (short) 0);
1117 public byte[] arBytePropA;
1118 public Property propTypeA= new Property("PropTypeA", 11, new Type(Type.class), (short) 0);
1119 public Type typePropA;
1120 public Property propObjectA= new Property("PropObjectA",12, new Type(Object.class), (short) 0);
1121 public Object objectPropA;
1122 public Property propAnyA= new Property("PropAnyA", 13, new Type(Any.class), (short) 0);
1123 public Any anyPropA;
1124 public Property propXInterfaceA= new Property("PropXInterfaceA", 13, new Type(Any.class), (short) 0);
1125 public XInterface xInterfacePropA;
1126 public Property propXWeakA= new Property("PropXWeakA", 13, new Type(Any.class), (short) 0);
1127 public XWeak xWeakPropA;
1128 public Property propEnum =
1129 new Property("PropEnum", 14, new Type("com.sun.star.beans.PropertyState", TypeClass.ENUM), (short)0);
1130 public com.sun.star.beans.PropertyState enumPropertyState = com.sun.star.beans.PropertyState.DEFAULT_VALUE;
1131 // Test private, protected, package access, Anys as arguments and members, members whith a value
1133 public Property propBoolB= new Property("PropBoolB", 101, new Type(Boolean.TYPE), (short) 0);
1134 protected boolean boolPropB;
1136 public Property propBoolC= new Property("PropBoolC", 201, new Type(Boolean.TYPE), (short) 0);
1137 boolean boolPropC;
1139 public Property propBoolD= new Property("PropBoolD", 301, new Type(Boolean.TYPE), (short) 0);
1140 private boolean boolPropD;
1142 public Property propBoolClass= new Property("PropBoolClass", 1001, new Type(Boolean.class), (short) 0);
1143 public Boolean boolClassProp;
1144 public Property propCharClass= new Property("PropCharClass", 1002, new Type(Character.class), (short) 0);
1145 public Character charClassProp;
1146 public Property propByteClass= new Property("PropByteClass", 1003, new Type(Byte.class), (short) 0);
1147 public Byte byteClassProp;
1148 public Property propShortClass= new Property("PropShortClass", 1004, new Type(Short.class), (short) 0);
1149 public Short shortClassProp;
1150 public Property propIntClass= new Property("PropIntClass", 1005, new Type(Integer.class), (short) 0);
1151 public Integer intClassProp;
1152 public Property propLongClass= new Property("PropLongClass", 1006, new Type(Long.class), (short) 0);
1153 public Long longClassProp;
1154 public Property propFloatClass= new Property("PropFloatClass", 1007, new Type(Float.class), (short) 0);
1155 public Float floatClassProp;
1156 public Property propDoubleClass= new Property("PropDoubleClass", 1008, new Type(Double.class), (short) 0);
1157 public Double doubleClassProp;
1160 public TestClass()
1163 super();
1164 // When adding properties then modify the getRegisteredProperties method
1165 //registerProperty(String name, int handle, Type type, short attributes, String memberName)
1166 registerProperty(propBoolA, "boolPropA");
1167 registerProperty(propCharA, "charPropA");
1168 registerProperty(propByteA, "bytePropA");
1169 registerProperty(propShortA, "shortPropA");
1170 registerProperty(propIntA, "intPropA");
1171 registerProperty(propLongA, "longPropA");
1172 registerProperty(propFloatA, "floatPropA");
1173 registerProperty(propDoubleA, "doublePropA");
1174 registerProperty(propStringA, "stringPropA");
1175 registerProperty(propArrayByteA, "arBytePropA");
1176 registerProperty(propTypeA, "typePropA");
1177 registerProperty(propObjectA, "objectPropA");
1178 registerProperty(propAnyA, "anyPropA");
1179 registerProperty(propXInterfaceA, "xInterfacePropA");
1180 registerProperty(propXWeakA, "xWeakPropA");
1181 registerProperty(propEnum,"enumPropertyState");
1182 registerProperty(propBoolB, "boolPropB");
1183 registerProperty(propBoolC, "boolPropC");
1184 registerProperty(propBoolD, "boolPropD");
1185 registerProperty(propBoolClass, "boolClassProp");
1186 registerProperty(propCharClass, "charClassProp");
1187 registerProperty(propByteClass, "byteClassProp");
1188 registerProperty(propShortClass, "shortClassProp");
1189 registerProperty(propIntClass, "intClassProp");
1190 registerProperty(propLongClass, "longClassProp");
1191 registerProperty(propFloatClass, "floatClassProp");
1192 registerProperty(propDoubleClass, "doubleClassProp");
1195 /** When adding properties then modify the getRegisteredProperties method
1197 public Property[] getRegisteredProperties()
1199 return new Property[] {
1200 propBoolA, propCharA, propByteA, propShortA,
1201 propIntA, propLongA, propFloatA, propDoubleA,
1202 propStringA, propArrayByteA, propTypeA, propObjectA,
1203 propAnyA, propXInterfaceA, propXWeakA, propEnum, propBoolB,
1204 propBoolC, propBoolD, propBoolClass, propCharClass,
1205 propByteClass, propShortClass, propIntClass, propLongClass,
1206 propFloatClass, propDoubleClass
1210 public boolean test_convertPropertyValue()
1212 boolean[] r= new boolean[150];
1213 int i= 0;
1215 resetPropertyMembers();
1216 Object[] outOldVal= new Object[1];
1217 Object[] outNewVal= new Object[1];
1219 Object value= new Boolean(true);
1222 r[i++]= convertPropertyValue(propBoolA, outNewVal, outOldVal, value);
1223 r[i++]= outNewVal[0] instanceof Boolean && outNewVal[0].equals(value) && outOldVal[0].equals(new Boolean(false));
1224 value= new Character('A');
1225 r[i++]= convertPropertyValue(propCharA, outNewVal, outOldVal, value);
1226 r[i++]= outNewVal[0] instanceof Character && outNewVal[0].equals(value) && outOldVal[0].equals(new Character((char)0));
1227 charPropA= 'B';
1228 r[i++]= convertPropertyValue(propCharA, outNewVal, outOldVal, value);
1229 r[i++]= outNewVal[0] instanceof Character && outNewVal[0].equals(value) && outOldVal[0].equals(new Character('B'));
1230 value= new Byte((byte) 111);
1231 r[i++]= convertPropertyValue(propByteA, outNewVal, outOldVal, value);
1232 r[i++]= outNewVal[0] instanceof Byte && outNewVal[0].equals(value);
1233 value= new Short((short) 112);
1234 r[i++]= convertPropertyValue(propShortA, outNewVal, outOldVal, value);
1235 r[i++]= outNewVal[0] instanceof Short && outNewVal[0].equals(value);
1236 value= new Integer( 113);
1237 r[i++]= convertPropertyValue(propIntA, outNewVal, outOldVal, value);
1238 r[i++]= outNewVal[0] instanceof Integer && outNewVal[0].equals(value);
1239 value= new Long(114);
1240 r[i++]= convertPropertyValue(propLongA, outNewVal, outOldVal, value);
1241 r[i++]= outNewVal[0] instanceof Long && outNewVal[0].equals(value);
1242 value= new Float(3.14);
1243 r[i++]= convertPropertyValue(propFloatA, outNewVal, outOldVal, value);
1244 r[i++]= outNewVal[0] instanceof Float && outNewVal[0].equals(value);
1245 value= new Double(3.145);
1246 r[i++]= convertPropertyValue(propDoubleA, outNewVal, outOldVal, value);
1247 r[i++]= outNewVal[0] instanceof Double && outNewVal[0].equals(value);
1248 value= "string";
1249 r[i++]= convertPropertyValue(propStringA, outNewVal, outOldVal, value);
1250 r[i++]= outNewVal[0] instanceof String && outNewVal[0].equals(value);
1251 value= new byte[]{1,2,3};
1252 arBytePropA= null;
1253 r[i++]= convertPropertyValue(propArrayByteA, outNewVal, outOldVal, value);
1254 r[i++]= outNewVal[0] instanceof byte[] && outNewVal[0].equals(value) && outOldVal[0] == null;
1255 r[i++]= convertPropertyValue(propArrayByteA, outNewVal, outOldVal, value);
1256 r[i++]= outOldVal[0] == null;
1257 value= new Type(XInterface.class);
1258 r[i++]= convertPropertyValue(propTypeA, outNewVal, outOldVal, value);
1259 r[i++]= outNewVal[0] instanceof Type && outNewVal[0].equals(value);
1261 value= new Object(); // TypeClass.VOID
1262 r[i++]= convertPropertyValue(propObjectA, outNewVal, outOldVal, value);
1263 r[i++]= outNewVal[0] instanceof Object && outNewVal[0].equals(value);
1264 value= new Integer(111);
1265 r[i++]= convertPropertyValue(propObjectA, outNewVal, outOldVal, value);
1266 r[i++]= outNewVal[0] instanceof Integer && outNewVal[0].equals(value);
1267 value= new ComponentBase();
1268 r[i++]= convertPropertyValue(propObjectA, outNewVal, outOldVal, value);
1269 r[i++]= outNewVal[0] instanceof Object && outNewVal[0].equals(value);
1270 value= new Integer(111);
1271 r[i++]= convertPropertyValue(propAnyA, outNewVal, outOldVal, value);
1272 r[i++]= outNewVal[0] instanceof Any && ((Any)outNewVal[0]).getType().equals(new Type(Integer.class))
1273 && ((Any)outNewVal[0]).getObject().equals(value);
1274 XWeak oWeak= new ComponentBase();
1275 value= oWeak;
1276 // The returned Any must contain an XInterface
1277 r[i++]= convertPropertyValue(propAnyA, outNewVal, outOldVal, value);
1278 r[i++]= ((Any) outNewVal[0]).getType().equals(new Type(XInterface.class))
1279 && ((Any) outNewVal[0]).getObject() == oWeak;
1280 value= new ComponentBase();
1281 r[i++]= convertPropertyValue(propXInterfaceA, outNewVal, outOldVal, value);
1282 r[i++]= outNewVal[0] instanceof XInterface && outNewVal[0].equals(value);
1283 r[i++]= convertPropertyValue(propXWeakA, outNewVal, outOldVal, value);
1284 r[i++]= outNewVal[0] instanceof XWeak && outNewVal[0].equals(value);
1286 value = com.sun.star.beans.PropertyState.DIRECT_VALUE;
1287 r[i++]= convertPropertyValue(propEnum, outNewVal, outOldVal, value);
1288 r[i++]= outNewVal[0] instanceof com.sun.star.uno.Enum && outNewVal[0].equals(value);
1290 // Any arguments ------------------------------------------------------------------
1291 value= new Any( new Type(Integer.class),new Integer(111));
1292 r[i++]= convertPropertyValue(propIntA, outNewVal, outOldVal, value);
1293 r[i++]= outNewVal[0] instanceof Integer && ((Integer)outNewVal[0]).equals( ((Any)value).getObject());
1294 value= new Any(new Type(Boolean.class), new Boolean(true));
1295 r[i++]= convertPropertyValue(propBoolA, outNewVal, outOldVal, value);
1296 r[i++]= outNewVal[0] instanceof Boolean && ((Boolean)outNewVal[0]).equals(((Any) value).getObject());
1297 //Character, Byte, Short, Long
1298 // must fail
1299 value= new Any(new Type(Object.class), new Object());
1300 r[i++]= convertPropertyValue(propObjectA, outNewVal, outOldVal, value);
1301 r[i++]= convertPropertyValue(propAnyA, outNewVal, outOldVal, value);
1302 value= new Any(new Type(Integer.class), new Integer(111));
1303 r[i++]= convertPropertyValue(propObjectA, outNewVal, outOldVal, value);
1304 r[i++]= outNewVal[0] instanceof Integer && outNewVal[0].equals( ((Any)value).getObject());
1305 r[i++]= convertPropertyValue(propAnyA, outNewVal, outOldVal, value);
1306 r[i++]= outNewVal[0] instanceof Any && ((Any) outNewVal[0]).getType().equals( ((Any) value).getType())
1307 && ((Any) outNewVal[0]).getObject().equals( ((Any) value).getObject());
1308 value= new Any(new Type(XInterface.class), new ComponentBase());
1309 r[i++]= convertPropertyValue(propObjectA, outNewVal, outOldVal, value);
1310 r[i++]= outNewVal[0] instanceof XInterface && outNewVal[0] == ((Any) value).getObject();
1311 r[i++]= convertPropertyValue(propXInterfaceA, outNewVal, outOldVal, value);
1312 r[i++]= outNewVal[0] == ((Any) value).getObject();
1313 value= new Any(new Type(byte[].class), new byte[]{1,2,3});
1314 r[i++]= convertPropertyValue(propArrayByteA, outNewVal, outOldVal, value);
1315 r[i++]= outNewVal[0] instanceof byte[];
1319 // test private, protected, package fields
1320 value= new Boolean(true);
1321 r[i++]= convertPropertyValue(propBoolB, outNewVal, outOldVal, value);
1322 r[i++]= ((Boolean)value).booleanValue() == ((Boolean) outNewVal[0]).booleanValue();
1323 r[i++]= convertPropertyValue(propBoolC, outNewVal, outOldVal, value);
1324 r[i++]= ((Boolean)value).booleanValue() == ((Boolean) outNewVal[0]).booleanValue();
1325 // must fail because the the member boolPropD is private
1326 try{
1327 convertPropertyValue(propBoolD, outNewVal, outOldVal, value);
1328 i++;
1329 }catch (Exception e)
1331 r[i++]= true;
1334 // Properties member of type Byte,Short etc.
1335 value= new Boolean(true);
1336 r[i++]= convertPropertyValue(propBoolClass, outNewVal, outOldVal, value);
1337 r[i++]= outNewVal[0] instanceof Boolean && outNewVal[0].equals(value);
1338 value= new Character('A');
1339 r[i++]= convertPropertyValue(propCharClass, outNewVal, outOldVal, value);
1340 r[i++]= outNewVal[0] instanceof Character && outNewVal[0].equals(value);
1341 value= new Byte((byte) 111);
1342 r[i++]= convertPropertyValue(propByteClass, outNewVal, outOldVal, value);
1343 r[i++]= outNewVal[0] instanceof Byte && outNewVal[0].equals(value);
1344 value= new Short((short) 112);
1345 r[i++]= convertPropertyValue(propShortClass, outNewVal, outOldVal, value);
1346 r[i++]= outNewVal[0] instanceof Short && outNewVal[0].equals(value);
1347 value= new Integer( 113);
1348 r[i++]= convertPropertyValue(propIntClass, outNewVal, outOldVal, value);
1349 r[i++]= outNewVal[0] instanceof Integer && outNewVal[0].equals(value);
1350 value= new Long(114);
1351 r[i++]= convertPropertyValue(propLongClass, outNewVal, outOldVal, value);
1352 r[i++]= outNewVal[0] instanceof Long && outNewVal[0].equals(value);
1353 value= new Float(3.14);
1354 r[i++]= convertPropertyValue(propFloatClass, outNewVal, outOldVal, value);
1355 r[i++]= outNewVal[0] instanceof Float && outNewVal[0].equals(value);
1356 value= new Double(3.145);
1357 r[i++]= convertPropertyValue(propDoubleA, outNewVal, outOldVal, value);
1358 r[i++]= outNewVal[0] instanceof Double && outNewVal[0].equals(value);
1359 }catch (com.sun.star.uno.Exception e)
1361 i++;
1363 boolean bOk= true;
1364 for (int c= 0; c < i; c++)
1365 bOk= bOk && r[c];
1367 return bOk;
1370 public boolean test_setPropertyValueNoBroadcast()
1372 boolean[] r= new boolean[150];
1373 int i= 0;
1374 resetPropertyMembers();
1375 try {
1376 Object value= new Boolean(true);
1377 setPropertyValueNoBroadcast(propBoolA, value);
1378 r[i++]= boolPropA == ((Boolean) value).booleanValue();
1379 value= new Character('A');
1380 setPropertyValueNoBroadcast(propCharA, value);
1381 r[i++]= charPropA == ((Character) value).charValue();
1382 value= new Byte((byte) 111);
1383 setPropertyValueNoBroadcast(propByteA, value);
1384 r[i++]= bytePropA == ((Byte)value).byteValue();
1385 value= new Short((short) 112);
1386 setPropertyValueNoBroadcast(propShortA, value);
1387 r[i++]= shortPropA == ((Short) value).shortValue();
1388 value= new Integer( 113);
1389 setPropertyValueNoBroadcast(propIntA, value);
1390 r[i++]= intPropA == ((Integer) value).intValue();
1391 value= new Long(114);
1392 setPropertyValueNoBroadcast(propLongA, value);
1393 r[i++]= longPropA == ((Long) value).longValue();
1394 value= new Float(3.14);
1395 setPropertyValueNoBroadcast(propFloatA, value);
1396 r[i++]= floatPropA == ((Float) value).floatValue();
1397 value= new Double(3.145);
1398 setPropertyValueNoBroadcast(propDoubleA, value);
1399 r[i++]= doublePropA == ((Double) value).doubleValue();
1400 value= "string";
1401 setPropertyValueNoBroadcast(propStringA, value);
1402 r[i++]= stringPropA.equals(value);
1403 value= new byte[]{1,2,3};
1404 setPropertyValueNoBroadcast(propArrayByteA, value);
1405 r[i++]= arBytePropA.equals(value);
1406 value= new Type(XInterface.class);
1407 setPropertyValueNoBroadcast(propTypeA, value);
1408 r[i++]= typePropA.equals(value);
1409 value= new Integer(111);
1410 setPropertyValueNoBroadcast(propObjectA, value);
1411 r[i++]= objectPropA.equals(value);
1412 value= (XInterface) new ComponentBase();
1413 setPropertyValueNoBroadcast(propObjectA, value);
1414 r[i++]= objectPropA.equals(value);
1415 value= new Any( new Type(Integer.TYPE), new Integer(111));
1416 setPropertyValueNoBroadcast(propAnyA, value);
1417 r[i++]= util.anyEquals(anyPropA, value);
1418 value= new ComponentBase();
1419 setPropertyValueNoBroadcast(propXInterfaceA, value);
1420 r[i++]= xInterfacePropA instanceof XInterface && xInterfacePropA.equals(value);
1421 setPropertyValueNoBroadcast(propXWeakA, value);
1422 r[i++]= xInterfacePropA instanceof XWeak && xInterfacePropA.equals(value);
1423 value = com.sun.star.beans.PropertyState.AMBIGUOUS_VALUE;
1424 setPropertyValueNoBroadcast(propEnum, value);
1425 r[i++]= enumPropertyState == value;
1426 value= new Boolean(true);
1427 setPropertyValueNoBroadcast(propBoolB, value);
1428 r[i++]= boolPropB == ((Boolean) value).booleanValue();
1429 setPropertyValueNoBroadcast(propBoolC, value);
1430 r[i++]= boolPropC == ((Boolean) value).booleanValue();
1431 // must fail because the the member boolPropD is private
1432 try{
1433 setPropertyValueNoBroadcast(propBoolD, value);
1434 }catch(com.sun.star.lang.WrappedTargetException e)
1436 r[i++]= true;
1438 }catch (java.lang.Exception e)
1440 i++;
1442 boolean bOk= true;
1443 for (int c= 0; c < i; c++)
1444 bOk= bOk && r[c];
1445 return bOk;
1448 void resetPropertyMembers()
1450 boolPropA= false;
1451 charPropA= (char) 0;
1452 bytePropA= 0;
1453 shortPropA= 0;
1454 intPropA= 0;
1455 longPropA= 0;
1456 floatPropA= 0;
1457 doublePropA= 0.;
1458 stringPropA= null;
1459 arBytePropA= null;
1460 typePropA= null;
1461 objectPropA= null;
1462 anyPropA= null;
1463 xInterfacePropA= null;
1464 xWeakPropA= null;
1465 enumPropertyState = com.sun.star.beans.PropertyState.DEFAULT_VALUE;
1466 boolPropB= false;
1467 boolPropC= false;
1468 boolPropD= false;
1469 boolClassProp= null;
1470 charClassProp= null;
1471 byteClassProp= null;
1472 shortClassProp= null;
1473 intClassProp= null;
1474 longClassProp= null;
1475 floatClassProp= null;
1476 doubleClassProp= null;
1480 class TestClass2 extends PropertySet
1483 public char charA;
1484 protected char charB;
1485 char charC;
1487 int intMemberA;
1489 public Character charClassA;
1490 protected Character charClassB;
1491 Character charClassC;
1493 boolean test_registerProperty1()
1495 System.out.println("registerProperty Test 1");
1496 boolean r[]= new boolean[50];
1497 int i= 0;
1499 registerProperty("PropChar", new Type(char.class), (short) 0, "PropChar");
1500 registerProperty("PropInt", new Type(int.class), (short) 0, "PropInt");
1501 registerProperty("PropString", new Type(String.class), (short) 0, "PropString");
1503 XPropertySetInfo info= getPropertySetInfo();
1504 Property[] props= info.getProperties();
1505 for (int j= 0; j < props.length; j++)
1507 Property aProp= props[j];
1508 if (aProp.Name.equals("PropChar") && aProp.Type.equals(new Type(char.class)) &&
1509 aProp.Attributes == 0)
1510 r[i++]= true;
1511 else if (aProp.Name.equals("PropInt") && aProp.Type.equals(new Type(int.class)) &&
1512 aProp.Attributes == 0)
1513 r[i++]= true;
1514 else if (aProp.Name.equals("PropString") && aProp.Type.equals(new Type(String.class)) &&
1515 aProp.Attributes == 0)
1516 r[i++]= true;
1517 else
1518 r[i++]= false;
1521 boolean bOk= true;
1522 for (int c= 0; c < i; c++)
1523 bOk= bOk && r[c];
1524 if (bOk == false)
1525 System.out.println("Failed");
1526 else
1527 System.out.println("Ok");
1528 return bOk;
1531 boolean test_registerProperty2()
1533 System.out.println("registerProperty Test 2");
1534 boolean r[]= new boolean[50];
1535 int i= 0;
1537 registerProperty("charA", "charA", (short) 0);
1538 registerProperty("charB", "charB", (short) 0);
1539 registerProperty("charC", "charC", (short) 0);
1540 registerProperty("charClassB", "charClassB", PropertyAttribute.MAYBEVOID);
1541 registerProperty("IntProp", "intMemberA", (short) 0);
1543 XPropertySetInfo info= getPropertySetInfo();
1544 Property[] props= info.getProperties();
1545 for (int j= 0; j < props.length; j++)
1547 Property aProp= props[j];
1548 if (aProp.Name.equals("charA") && aProp.Type.equals(new Type(char.class)) &&
1549 aProp.Attributes == 0)
1550 r[i++]= true;
1551 else if (aProp.Name.equals("charB") && aProp.Type.equals(new Type(char.class)) &&
1552 aProp.Attributes == 0)
1553 r[i++]= true;
1554 else if (aProp.Name.equals("charC") && aProp.Type.equals(new Type(char.class)) &&
1555 aProp.Attributes == 0)
1556 r[i++]= true;
1557 else if (aProp.Name.equals("charClassB") && aProp.Type.equals(new Type(char.class)) &&
1558 aProp.Attributes == PropertyAttribute.MAYBEVOID)
1559 r[i++]= true;
1560 else if (aProp.Name.equals("IntProp") && aProp.Type.equals(new Type(int.class)) &&
1561 aProp.Attributes == 0)
1562 r[i++]= true;
1563 else
1564 r[i++]= false;
1566 Object ret;
1567 Object val= new Character('A');
1568 try{
1569 setPropertyValue("charA", val);
1570 ret= getPropertyValue("charA");
1571 r[i++]= val.equals(ret);
1572 setPropertyValue("charClassB",val);
1573 ret= getPropertyValue("charClassB");
1574 r[i++]= val.equals(ret);
1575 val= new Integer(111);
1576 setPropertyValue("IntProp",val);
1577 ret= getPropertyValue("IntProp");
1578 r[i++]= val.equals(ret);
1580 catch(Exception e)
1582 r[i++]=false;
1584 boolean bOk= true;
1585 for (int c= 0; c < i; c++)
1586 bOk= bOk && r[c];
1587 if (bOk == false)
1588 System.out.println("Failed");
1589 else
1590 System.out.println("Ok");
1591 return bOk;
1596 class util
1598 // An Object is considered an Any with TypeClass.VOID and no value.
1599 static boolean anyEquals(Object val1, Object val2)
1601 Object obj1= null;
1602 Object obj2= null;
1603 Type t1= null;
1604 Type t2= null;
1605 if (val1 instanceof Any)
1607 obj1= ((Any) val1).getObject();
1608 t1= ((Any) val1).getType();
1610 else
1611 obj1= val1;
1613 if (val2 instanceof Any)
1615 obj2= ((Any) val2).getObject();
1616 t2= ((Any) val2).getType();
1618 else
1619 obj2= val2;
1621 if (obj1 != null && obj1.equals(obj2))
1622 return true;
1623 else if ((obj1 == null && obj2 == null) && t1 != null && t1.equals(t2))
1624 return true;
1625 return false;
1628 // returns true if obj is an any that contains a void or interface type and the
1629 // object is null
1630 static boolean isVoidAny(Object obj)
1632 boolean ret= false;
1633 if( obj != null && obj instanceof Any)
1635 Any a= (Any) obj;
1636 if( a.getType().getTypeClass().equals( TypeClass.INTERFACE)
1637 && a.getObject() == null) {
1638 ret= true;
1640 else if( a.getType().equals( new Type(void.class)) && a.getObject() == null) {
1641 ret= true;
1644 return ret;
1648 class Listener implements XPropertyChangeListener, XVetoableChangeListener,
1649 XPropertiesChangeListener
1651 int nChangeCalled;
1652 int nPropertiesChange;
1653 int nVetoCalled;
1654 int nDisposingCalled;
1655 boolean bVeto= false;
1656 PropertyChangeEvent evt;
1657 PropertyChangeEvent[] arEvt;
1658 // XPropertyChangeListener
1659 public void propertyChange(PropertyChangeEvent evt )
1661 nChangeCalled++;
1662 this.evt= evt;
1665 //VetoableChangeListener
1666 public void vetoableChange(PropertyChangeEvent evt ) throws PropertyVetoException
1668 nVetoCalled++;
1669 this.evt= evt;
1670 if (bVeto)
1671 throw new PropertyVetoException();
1674 public void disposing( /*IN*/EventObject Source )
1676 nDisposingCalled++;
1679 public void reset()
1681 nChangeCalled= 0;
1682 nPropertiesChange= 0;
1683 nVetoCalled= 0;
1684 nDisposingCalled= 0;
1685 evt= null;
1686 arEvt= null;
1687 bVeto= false;
1689 // XPropertiesChangeListener
1690 public void propertiesChange(PropertyChangeEvent[] propertyChangeEvent)
1692 nPropertiesChange++;
1693 arEvt= propertyChangeEvent;