PageRenderTime 58ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 1ms

/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java

https://bitbucket.org/markjenkins/libreoffice_ubuntu-debian-fixes
Java | 1678 lines | 1508 code | 121 blank | 49 comment | 425 complexity | 2853f0029b61cf1b3347dc2b2e197c57 MD5 | raw file
Possible License(s): GPL-3.0, LGPL-3.0, MPL-2.0-no-copyleft-exception, LGPL-2.1, BSD-3-Clause-No-Nuclear-License-2014

Large files files are truncated, but you can click here to view the full file

  1. /*
  2. * This file is part of the LibreOffice project.
  3. *
  4. * This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  7. *
  8. * This file incorporates work covered by the following license notice:
  9. *
  10. * Licensed to the Apache Software Foundation (ASF) under one or more
  11. * contributor license agreements. See the NOTICE file distributed
  12. * with this work for additional information regarding copyright
  13. * ownership. The ASF licenses this file to you under the Apache
  14. * License, Version 2.0 (the "License"); you may not use this file
  15. * except in compliance with the License. You may obtain a copy of
  16. * the License at http://www.apache.org/licenses/LICENSE-2.0 .
  17. */
  18. package com.sun.star.lib.uno.helper;
  19. import com.sun.star.lang.EventObject;
  20. import com.sun.star.lang.DisposedException;
  21. import com.sun.star.uno.Type;
  22. import com.sun.star.uno.TypeClass;
  23. import com.sun.star.uno.XInterface;
  24. import com.sun.star.uno.Any;
  25. import com.sun.star.uno.XWeak;
  26. import com.sun.star.beans.UnknownPropertyException;
  27. import com.sun.star.beans.Property;
  28. import com.sun.star.beans.PropertyAttribute;
  29. import com.sun.star.beans.XPropertyChangeListener;
  30. import com.sun.star.beans.PropertyVetoException;
  31. import com.sun.star.beans.PropertyChangeEvent;
  32. import com.sun.star.beans.XVetoableChangeListener;
  33. import com.sun.star.beans.XPropertySetInfo;
  34. import com.sun.star.beans.XPropertiesChangeListener;
  35. public class PropertySet_Test
  36. {
  37. /** Creates a new instance of PropertySet_Test */
  38. public PropertySet_Test()
  39. {
  40. }
  41. public boolean convertPropertyValue()
  42. {
  43. System.out.println("PropertySet.convertPropertyValue");
  44. boolean[] r= new boolean[50];
  45. int i= 0;
  46. TestClass cl= new TestClass();
  47. try {
  48. r[i++]= cl.test_convertPropertyValue();
  49. }catch(java.lang.Exception e){
  50. i++;
  51. }
  52. boolean bOk= true;
  53. for (int c= 0; c < i; c++)
  54. bOk= bOk && r[c];
  55. if (bOk == false)
  56. System.out.println("Failed");
  57. else
  58. System.out.println("Ok");
  59. return bOk;
  60. }
  61. public boolean setPropertyValueNoBroadcast()
  62. {
  63. System.out.println("PropertySet.setValueNoBroadcast");
  64. boolean[] r= new boolean[50];
  65. int i= 0;
  66. TestClass cl= new TestClass();
  67. try {
  68. r[i++]= cl.test_setPropertyValueNoBroadcast();
  69. }catch(java.lang.Exception e){
  70. i++;
  71. }
  72. boolean bOk= true;
  73. for (int c= 0; c < i; c++)
  74. bOk= bOk && r[c];
  75. if (bOk == false)
  76. System.out.println("Failed");
  77. else
  78. System.out.println("Ok");
  79. return bOk;
  80. }
  81. public boolean setPropertyValue()
  82. {
  83. System.out.println("PropertySet.setPropertyValue");
  84. boolean[] r= new boolean[150];
  85. int i= 0;
  86. TestClass cl= new TestClass();
  87. try {
  88. cl.resetPropertyMembers();
  89. Object value;
  90. Object ret;
  91. value= new Boolean(true);
  92. cl.setPropertyValue("PropBoolA", value);
  93. ret= cl.getPropertyValue("PropBoolA");
  94. r[i++]= ((Boolean) ret).equals( value);
  95. value= new Character('A');
  96. cl.setPropertyValue("PropCharA",value);
  97. ret= cl.getPropertyValue("PropCharA");
  98. r[i++]= ((Character) ret).equals(value);
  99. value= new Byte((byte) 111);
  100. cl.setPropertyValue("PropByteA",value);
  101. ret= cl.getPropertyValue("PropByteA");
  102. r[i++]= ((Byte) ret).equals(value);
  103. value= new Short((short)112);
  104. cl.setPropertyValue("PropShortA", value);
  105. ret= cl.getPropertyValue("PropShortA");
  106. r[i++]= ((Short) ret).equals(value);
  107. value= new Integer(113);
  108. cl.setPropertyValue("PropIntA", value);
  109. ret= cl.getPropertyValue("PropIntA");
  110. r[i++]= ((Integer) ret).equals(value);
  111. value= new Long(115);
  112. cl.setPropertyValue("PropLongA", value);
  113. ret= cl.getPropertyValue("PropLongA");
  114. r[i++]= ((Long) ret).equals(value);
  115. value= new Float(3.14);
  116. cl.setPropertyValue("PropFloatA", value);
  117. ret= cl.getPropertyValue("PropFloatA");
  118. r[i++]= ((Float) ret).equals(value);
  119. value= new Double(3.145);
  120. cl.setPropertyValue("PropDoubleA",value);
  121. ret= cl.getPropertyValue("PropDoubleA");
  122. r[i++]= ((Double) ret).equals(value);
  123. value= new String("string");
  124. cl.setPropertyValue("PropStringA",value);
  125. ret= cl.getPropertyValue("PropStringA");
  126. r[i++]= ((String) ret).equals(value);
  127. value= new ComponentBase();
  128. cl.setPropertyValue("PropXInterfaceA",value);
  129. ret= cl.getPropertyValue("PropXInterfaceA");
  130. r[i++]= ((XInterface) ret).equals(value);
  131. value= new ComponentBase();
  132. cl.setPropertyValue("PropXWeakA",value);
  133. ret= cl.getPropertyValue("PropXWeakA");
  134. r[i++]= ((XWeak) ret).equals(value);
  135. value = com.sun.star.beans.PropertyState.AMBIGUOUS_VALUE;
  136. cl.setPropertyValue("PropEnum",value);
  137. ret= cl.getPropertyValue("PropEnum");
  138. r[i++]= ret == value;
  139. value= new byte[]{1,2,3};
  140. cl.setPropertyValue("PropArrayByteA", value);
  141. ret= cl.getPropertyValue("PropArrayByteA");
  142. r[i++]= ((byte[]) ret).equals(value);
  143. value= new Type(String.class);
  144. cl.setPropertyValue("PropTypeA", value);
  145. ret= cl.getPropertyValue("PropTypeA");
  146. r[i++]= ((Type) ret).equals(value);
  147. // test protected,package,private members
  148. value= new Boolean(true);
  149. cl.setPropertyValue("PropBoolB", value);
  150. ret= cl.getPropertyValue("PropBoolB");
  151. r[i++]= ((Boolean) ret).equals(value);
  152. cl.setPropertyValue("PropBoolC", value);
  153. ret= cl.getPropertyValue("PropBoolC");
  154. r[i++]= ((Boolean) ret).equals(value);
  155. try{
  156. cl.setPropertyValue("PropBoolD", value);
  157. i++;
  158. }catch (Exception e)
  159. {
  160. r[i++]= true;
  161. }
  162. cl.resetPropertyMembers();
  163. value= new Boolean(true);
  164. cl.setPropertyValue("PropObjectA", value);
  165. ret= cl.getPropertyValue("PropObjectA");
  166. r[i++]= ((Boolean) ret).equals(value);
  167. value= new Character('A');
  168. cl.setPropertyValue("PropObjectA",value);
  169. ret= cl.getPropertyValue("PropObjectA");
  170. r[i++]= ((Character) ret).equals(value);
  171. value= new Byte((byte) 111);
  172. cl.setPropertyValue("PropObjectA",value);
  173. ret= cl.getPropertyValue("PropObjectA");
  174. r[i++]= ((Byte) ret).equals(value);
  175. value= new Short((short)112);
  176. cl.setPropertyValue("PropObjectA", value);
  177. ret= cl.getPropertyValue("PropObjectA");
  178. r[i++]= ((Short) ret).equals(value);
  179. value= new Integer(113);
  180. cl.setPropertyValue("PropObjectA", value);
  181. ret= cl.getPropertyValue("PropObjectA");
  182. r[i++]= ((Integer) ret).equals(value);
  183. value= new Long(115);
  184. cl.setPropertyValue("PropObjectA", value);
  185. ret= cl.getPropertyValue("PropObjectA");
  186. r[i++]= ((Long) ret).equals(value);
  187. value= new Float(3.14);
  188. cl.setPropertyValue("PropObjectA", value);
  189. ret= cl.getPropertyValue("PropObjectA");
  190. r[i++]= ((Float) ret).equals(value);
  191. value= new Double(3.145);
  192. cl.setPropertyValue("PropObjectA",value);
  193. ret= cl.getPropertyValue("PropObjectA");
  194. r[i++]= ((Double) ret).equals(value);
  195. value= new String("string");
  196. cl.setPropertyValue("PropObjectA",value);
  197. ret= cl.getPropertyValue("PropObjectA");
  198. r[i++]= ((String) ret).equals(value);
  199. value= new ComponentBase();
  200. cl.setPropertyValue("PropObjectA",value);
  201. ret= cl.getPropertyValue("PropObjectA");
  202. r[i++]= ((XInterface) ret).equals(value);
  203. value= new ComponentBase();
  204. cl.setPropertyValue("PropObjectA",value);
  205. ret= cl.getPropertyValue("PropObjectA");
  206. r[i++]= ((XWeak) ret).equals(value);
  207. value= new byte[]{1,2,3};
  208. cl.setPropertyValue("PropObjectA", value);
  209. ret= cl.getPropertyValue("PropObjectA");
  210. r[i++]= ((byte[]) ret).equals(value);
  211. value= new Type(String.class);
  212. cl.setPropertyValue("PropObjectA", value);
  213. ret= cl.getPropertyValue("PropObjectA");
  214. r[i++]= ((Type) ret).equals(value);
  215. cl.setPropertyValue("PropObjectA", new Any( new Type(byte.class), new Byte((byte)1)));
  216. ret= cl.getPropertyValue("PropObjectA");
  217. r[i++]= ((Byte) ret).byteValue() == 1;
  218. cl.resetPropertyMembers();
  219. value= new Boolean(true);
  220. cl.setPropertyValue("PropAnyA", value);
  221. ret= cl.getPropertyValue("PropAnyA");
  222. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  223. value= new Character('A');
  224. cl.setPropertyValue("PropAnyA",value);
  225. ret= cl.getPropertyValue("PropAnyA");
  226. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  227. value= new Byte((byte) 111);
  228. cl.setPropertyValue("PropAnyA",value);
  229. ret= cl.getPropertyValue("PropAnyA");
  230. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  231. value= new Short((short)112);
  232. cl.setPropertyValue("PropAnyA", value);
  233. ret= cl.getPropertyValue("PropAnyA");
  234. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  235. value= new Integer(113);
  236. cl.setPropertyValue("PropAnyA", value);
  237. ret= cl.getPropertyValue("PropAnyA");
  238. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  239. value= new Long(115);
  240. cl.setPropertyValue("PropAnyA", value);
  241. ret= cl.getPropertyValue("PropAnyA");
  242. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  243. value= new Float(3.14);
  244. cl.setPropertyValue("PropAnyA", value);
  245. ret= cl.getPropertyValue("PropAnyA");
  246. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  247. value= new Double(3.145);
  248. cl.setPropertyValue("PropAnyA",value);
  249. ret= cl.getPropertyValue("PropAnyA");
  250. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  251. value= new String("string");
  252. cl.setPropertyValue("PropAnyA",value);
  253. ret= cl.getPropertyValue("PropAnyA");
  254. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  255. value= new ComponentBase();
  256. cl.setPropertyValue("PropAnyA",value);
  257. ret= cl.getPropertyValue("PropAnyA");
  258. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  259. value= new ComponentBase();
  260. cl.setPropertyValue("PropAnyA",value);
  261. ret= cl.getPropertyValue("PropAnyA");
  262. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  263. value= new byte[]{1,2,3};
  264. cl.setPropertyValue("PropAnyA", value);
  265. ret= cl.getPropertyValue("PropAnyA");
  266. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  267. value= new Type(String.class);
  268. cl.setPropertyValue("PropAnyA", value);
  269. ret= cl.getPropertyValue("PropAnyA");
  270. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  271. cl.resetPropertyMembers();
  272. value= new Any(new Type(boolean.class), new Boolean(true));
  273. cl.setPropertyValue("PropBoolA", value);
  274. ret= cl.getPropertyValue("PropBoolA");
  275. r[i++]= ret instanceof Boolean && util.anyEquals(value, ret);
  276. value= new Any (new Type(char.class), new Character('A'));
  277. cl.setPropertyValue("PropCharA",value);
  278. ret= cl.getPropertyValue("PropCharA");
  279. r[i++]= ret instanceof Character && util.anyEquals(value, ret);
  280. value= new Any(new Type(byte.class), new Byte((byte) 111));
  281. cl.setPropertyValue("PropByteA",value);
  282. ret= cl.getPropertyValue("PropByteA");
  283. r[i++]= ret instanceof Byte && util.anyEquals(value, ret);
  284. value= new Any(new Type(short.class), new Short((short)112));
  285. cl.setPropertyValue("PropShortA", value);
  286. ret= cl.getPropertyValue("PropShortA");
  287. r[i++]= ret instanceof Short && util.anyEquals(value, ret);
  288. value= new Any(new Type(int.class), new Integer(113));
  289. cl.setPropertyValue("PropIntA", value);
  290. ret= cl.getPropertyValue("PropIntA");
  291. r[i++]= ret instanceof Integer && util.anyEquals(value, ret);
  292. value= new Any(new Type(long.class), new Long(115));
  293. cl.setPropertyValue("PropLongA", value);
  294. ret= cl.getPropertyValue("PropLongA");
  295. r[i++]= ret instanceof Long && util.anyEquals(value, ret);
  296. value= new Any(new Type(float.class), new Float(3.14));
  297. cl.setPropertyValue("PropFloatA", value);
  298. ret= cl.getPropertyValue("PropFloatA");
  299. r[i++]= ret instanceof Float && util.anyEquals(value, ret);
  300. value= new Any(new Type(double.class),new Double(3.145));
  301. cl.setPropertyValue("PropDoubleA",value);
  302. ret= cl.getPropertyValue("PropDoubleA");
  303. r[i++]= ret instanceof Double && util.anyEquals(value, ret);
  304. value= new Any(new Type(String.class), new String("string"));
  305. cl.setPropertyValue("PropStringA",value);
  306. ret= cl.getPropertyValue("PropStringA");
  307. r[i++]= ret instanceof String && util.anyEquals(value, ret);
  308. value= new Any(new Type(ComponentBase.class), new ComponentBase());
  309. cl.setPropertyValue("PropXInterfaceA",value);
  310. ret= cl.getPropertyValue("PropXInterfaceA");
  311. r[i++]= ret instanceof ComponentBase && util.anyEquals(value, ret);
  312. value= new Any( new Type(ComponentBase.class), new ComponentBase());
  313. cl.setPropertyValue("PropXWeakA",value);
  314. ret= cl.getPropertyValue("PropXWeakA");
  315. r[i++]= ret instanceof ComponentBase && util.anyEquals(value, ret);
  316. value= new Any(new Type(byte[].class), new byte[]{1,2,3});
  317. cl.setPropertyValue("PropArrayByteA", value);
  318. ret= cl.getPropertyValue("PropArrayByteA");
  319. r[i++]= ret instanceof byte[] && util.anyEquals(value, ret);
  320. value= new Any(new Type(Type.class), new Type(String.class));
  321. cl.setPropertyValue("PropTypeA", value);
  322. ret= cl.getPropertyValue("PropTypeA");
  323. r[i++]= ret instanceof Type && util.anyEquals(value, ret);
  324. cl.resetPropertyMembers();
  325. value= new Any(new Type(boolean.class), new Boolean(true));
  326. cl.setPropertyValue("PropAnyA", value);
  327. ret= cl.getPropertyValue("PropAnyA");
  328. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  329. value= new Any (new Type(char.class), new Character('A'));
  330. cl.setPropertyValue("PropAnyA",value);
  331. ret= cl.getPropertyValue("PropAnyA");
  332. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  333. value= new Any(new Type(byte.class), new Byte((byte) 111));
  334. cl.setPropertyValue("PropAnyA",value);
  335. ret= cl.getPropertyValue("PropAnyA");
  336. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  337. value= new Any(new Type(short.class), new Short((short)112));
  338. cl.setPropertyValue("PropAnyA", value);
  339. ret= cl.getPropertyValue("PropAnyA");
  340. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  341. value= new Any(new Type(int.class), new Integer(113));
  342. cl.setPropertyValue("PropAnyA", value);
  343. ret= cl.getPropertyValue("PropAnyA");
  344. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  345. value= new Any(new Type(long.class), new Long(115));
  346. cl.setPropertyValue("PropAnyA", value);
  347. ret= cl.getPropertyValue("PropAnyA");
  348. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  349. value= new Any(new Type(float.class), new Float(3.14));
  350. cl.setPropertyValue("PropAnyA", value);
  351. ret= cl.getPropertyValue("PropAnyA");
  352. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  353. value= new Any(new Type(double.class),new Double(3.145));
  354. cl.setPropertyValue("PropAnyA",value);
  355. ret= cl.getPropertyValue("PropAnyA");
  356. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  357. value= new Any(new Type(String.class), new String("string"));
  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(ComponentBase.class), new ComponentBase());
  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(ComponentBase.class), new ComponentBase());
  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(byte[].class), new byte[]{1,2,3});
  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(Type.class), new Type(String.class));
  374. cl.setPropertyValue("PropAnyA", value);
  375. ret= cl.getPropertyValue("PropAnyA");
  376. r[i++]= ret instanceof Any && util.anyEquals(value, ret);
  377. // ------------------------------------------------------------------------------
  378. cl.resetPropertyMembers();
  379. value= new Boolean(true);
  380. cl.setPropertyValue("PropBoolClass", value);
  381. ret= cl.getPropertyValue("PropBoolClass");
  382. r[i++]= ((Boolean) ret).equals( value);
  383. value= new Character('A');
  384. cl.setPropertyValue("PropCharClass",value);
  385. ret= cl.getPropertyValue("PropCharClass");
  386. r[i++]= ((Character) ret).equals(value);
  387. value= new Byte((byte) 111);
  388. cl.setPropertyValue("PropByteClass",value);
  389. ret= cl.getPropertyValue("PropByteClass");
  390. r[i++]= ((Byte) ret).equals(value);
  391. value= new Short((short)112);
  392. cl.setPropertyValue("PropShortClass", value);
  393. ret= cl.getPropertyValue("PropShortClass");
  394. r[i++]= ((Short) ret).equals(value);
  395. value= new Integer(113);
  396. cl.setPropertyValue("PropIntClass", value);
  397. ret= cl.getPropertyValue("PropIntClass");
  398. r[i++]= ((Integer) ret).equals(value);
  399. value= new Long(115);
  400. cl.setPropertyValue("PropLongClass", value);
  401. ret= cl.getPropertyValue("PropLongClass");
  402. r[i++]= ((Long) ret).equals(value);
  403. value= new Float(3.14);
  404. cl.setPropertyValue("PropFloatClass", value);
  405. ret= cl.getPropertyValue("PropFloatClass");
  406. r[i++]= ((Float) ret).equals(value);
  407. value= new Double(3.145);
  408. cl.setPropertyValue("PropDoubleClass",value);
  409. ret= cl.getPropertyValue("PropDoubleClass");
  410. r[i++]= ((Double) ret).equals(value);
  411. cl.resetPropertyMembers();
  412. cl.resetPropertyMembers();
  413. value= new Any(new Type(boolean.class), new Boolean(true));
  414. cl.setPropertyValue("PropBoolClass", value);
  415. ret= cl.getPropertyValue("PropBoolClass");
  416. r[i++]= ret instanceof Boolean && util.anyEquals(value, ret);
  417. value= new Any (new Type(char.class), new Character('A'));
  418. cl.setPropertyValue("PropCharClass",value);
  419. ret= cl.getPropertyValue("PropCharClass");
  420. r[i++]= ret instanceof Character && util.anyEquals(value, ret);
  421. value= new Any(new Type(byte.class), new Byte((byte) 111));
  422. cl.setPropertyValue("PropByteClass",value);
  423. ret= cl.getPropertyValue("PropByteClass");
  424. r[i++]= ret instanceof Byte && util.anyEquals(value, ret);
  425. value= new Any(new Type(short.class), new Short((short)112));
  426. cl.setPropertyValue("PropShortClass", value);
  427. ret= cl.getPropertyValue("PropShortClass");
  428. r[i++]= ret instanceof Short && util.anyEquals(value, ret);
  429. value= new Any(new Type(int.class), new Integer(113));
  430. cl.setPropertyValue("PropIntClass", value);
  431. ret= cl.getPropertyValue("PropIntClass");
  432. r[i++]= ret instanceof Integer && util.anyEquals(value, ret);
  433. value= new Any(new Type(long.class), new Long(115));
  434. cl.setPropertyValue("PropLongClass", value);
  435. ret= cl.getPropertyValue("PropLongClass");
  436. r[i++]= ret instanceof Long && util.anyEquals(value, ret);
  437. value= new Any(new Type(float.class), new Float(3.14));
  438. cl.setPropertyValue("PropFloatClass", value);
  439. ret= cl.getPropertyValue("PropFloatClass");
  440. r[i++]= ret instanceof Float && util.anyEquals(value, ret);
  441. value= new Any(new Type(double.class),new Double(3.145));
  442. cl.setPropertyValue("PropDoubleClass",value);
  443. ret= cl.getPropertyValue("PropDoubleClass");
  444. r[i++]= ret instanceof Double && util.anyEquals(value, ret);
  445. value= new Any(new Type(String.class), new String("string"));
  446. // PropertyAttribute.READONLY
  447. cl.propBoolA.Attributes= PropertyAttribute.READONLY;
  448. try{
  449. cl.setPropertyValue("PropBoolA", new Boolean(true));
  450. i++;
  451. }catch (com.sun.star.beans.PropertyVetoException e)
  452. {
  453. r[i++]= true;
  454. }
  455. cl.propBoolA.Attributes= 0;
  456. // MAYBEVOID
  457. cl.resetPropertyMembers();
  458. // first MAYBEVOID not set
  459. //primitive members: must not work
  460. cl.boolPropA= false;
  461. try {
  462. cl.setPropertyValue("PropBoolA", null); i++;
  463. } catch (com.sun.star.lang.IllegalArgumentException e) {
  464. r[i++]= true;
  465. }
  466. try {
  467. cl.setPropertyValue("PropBoolA", new Any(new Type(boolean.class), null)); i++;
  468. } catch (com.sun.star.lang.IllegalArgumentException e) {
  469. r[i++]= true;
  470. }
  471. cl.propBoolA.Attributes= PropertyAttribute.MAYBEVOID;
  472. try{
  473. cl.setPropertyValue("PropBoolA", null); i++;
  474. } catch (com.sun.star.lang.IllegalArgumentException e) {
  475. r[i++]= true;
  476. }
  477. cl.propBoolA.Attributes= 0;
  478. cl.propBoolClass.Attributes= PropertyAttribute.MAYBEVOID;
  479. cl.boolClassProp= null;
  480. cl.setPropertyValue("PropBoolClass", null);
  481. r[i++]= cl.boolClassProp == null;
  482. // the returned value must be a void any
  483. Object objAny= cl.getPropertyValue("PropBoolClass");
  484. r[i++]= util.isVoidAny( objAny);
  485. cl.boolClassProp= new Boolean(true);
  486. cl.setPropertyValue("PropBoolClass", null);
  487. r[i++]= cl.boolClassProp == null;
  488. cl.boolClassProp= new Boolean(false);
  489. cl.setPropertyValue("PropBoolClass", new Any(new Type(boolean.class),null));
  490. r[i++]= cl.boolClassProp == null;
  491. cl.propXWeakA.Attributes= PropertyAttribute.MAYBEVOID;
  492. cl.setPropertyValue("PropXWeakA", null);
  493. r[i++]= util.isVoidAny(cl.getPropertyValue("PropXWeakA"));
  494. cl.propXWeakA.Attributes= 0;
  495. cl.anyPropA= null;
  496. try{
  497. cl.setPropertyValue("PropAnyA", null); i++;
  498. }catch (com.sun.star.lang.IllegalArgumentException e) {
  499. r[i++]= true;
  500. }
  501. cl.anyPropA= null;
  502. cl.propAnyA.Attributes= PropertyAttribute.MAYBEVOID;
  503. Type _t= new Type(Object.class);
  504. cl.setPropertyValue("PropAnyA", null);
  505. r[i++]= cl.anyPropA.getType().equals(new Type(void.class)) &&
  506. cl.anyPropA.getObject() == null;
  507. cl.anyPropA= new Any(new Type(byte.class),new Byte((byte) 111));
  508. cl.setPropertyValue("PropAnyA", null);
  509. r[i++]= cl.anyPropA.getType().equals(new Type(byte.class)) &&
  510. cl.anyPropA.getObject() == null;
  511. cl.anyPropA= null;
  512. try{
  513. cl.setPropertyValue("PropAnyA", new Object()); i++;
  514. }catch (com.sun.star.lang.IllegalArgumentException e)
  515. {
  516. r[i++]= true;
  517. }
  518. cl.propObjectA.Attributes= 0;
  519. try{
  520. cl.setPropertyValue("PropObjectA", null); i++;
  521. }catch (com.sun.star.lang.IllegalArgumentException e)
  522. {
  523. r[i++]= true;
  524. }
  525. try{
  526. cl.setPropertyValue("PropObjectA", new Any( new Type(byte.class), null)); i++;
  527. } catch (com.sun.star.lang.IllegalArgumentException e)
  528. {
  529. r[i++]= true;
  530. }
  531. cl.propObjectA.Attributes= PropertyAttribute.MAYBEVOID;
  532. cl.propObjectA= null;
  533. cl.setPropertyValue("PropObjectA", null);
  534. r[i++]= cl.propObjectA == null;
  535. cl.propObjectA= null;
  536. cl.setPropertyValue("PropObjectA", new Any( new Type(byte.class), null));
  537. r[i++]= cl.propObjectA == null;
  538. //
  539. }catch(java.lang.Exception e){
  540. i++;
  541. }
  542. boolean bOk= true;
  543. for (int c= 0; c < i; c++)
  544. bOk= bOk && r[c];
  545. if (bOk == false)
  546. System.out.println("Failed");
  547. else
  548. System.out.println("Ok");
  549. return bOk;
  550. }
  551. public boolean addPropertyChangeListener()
  552. {
  553. System.out.println("PropertySet.addPropertyChangeListener,\n" +
  554. "PropertySet.removePropertChangeListener," +
  555. "PropertySet.addVetoableChangeListener, \n" +
  556. "PropertySet.removeVetoableChangeListener" +
  557. "Notification of listeners");
  558. boolean[] r= new boolean[50];
  559. int i= 0;
  560. try {
  561. TestClass cl= new TestClass();
  562. Listener li= new Listener();
  563. cl.addPropertyChangeListener("PropByteA", li);
  564. Byte val1= new Byte((byte)115);
  565. cl.setPropertyValue("PropByteA", val1);
  566. r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 0;
  567. cl.propByteA.Attributes = PropertyAttribute.BOUND;
  568. cl.addPropertyChangeListener("PropByteA", li);
  569. Byte val2= new Byte((byte)116);
  570. cl.setPropertyValue("PropByteA", val2);
  571. r[i++]= li.nChangeCalled == 1 && li.nVetoCalled == 0;
  572. r[i++]= li.evt.OldValue.equals(val1) && li.evt.NewValue.equals(val2) && li.evt.Source == cl;
  573. li.reset();
  574. Listener li2= new Listener();
  575. cl.addPropertyChangeListener("PropByteA", li2);
  576. Byte val3= new Byte((byte) 117);
  577. cl.setPropertyValue("PropByteA", val3);
  578. r[i++]= li.nChangeCalled == 1 && li.nVetoCalled == 0
  579. && li2.nChangeCalled == 1 && li2.nVetoCalled == 0;
  580. r[i++]= li.evt.OldValue.equals(val2) && li.evt.NewValue.equals(val3) && li.evt.Source == cl
  581. && li2.evt.OldValue.equals(val2) && li2.evt.NewValue.equals(val3) && li2.evt.Source == cl ;
  582. li.reset();
  583. li2.reset();
  584. Listener li3= new Listener();
  585. val1= new Byte((byte)118);
  586. cl.addPropertyChangeListener("", li3);
  587. cl.setPropertyValue("PropByteA", val1);
  588. r[i++]= li.nChangeCalled == 1 && li.nVetoCalled == 0
  589. && li2.nChangeCalled == 1 && li2.nVetoCalled == 0
  590. && li3.nChangeCalled == 1 && li3.nVetoCalled == 0;
  591. r[i++]= li.evt.OldValue.equals(val3) && li.evt.NewValue.equals(val1) && li.evt.Source == cl;
  592. r[i++]= li2.evt.OldValue.equals(val3) && li2.evt.NewValue.equals(val1) && li2.evt.Source == cl;
  593. r[i++]= li3.evt.OldValue.equals(val3) && li3.evt.NewValue.equals(val1) && li3.evt.Source == cl ;
  594. li.reset();
  595. li2.reset();
  596. li3.reset();
  597. cl.removePropertyChangeListener("PropByteA",li);
  598. cl.setPropertyValue("PropByteA", val1);
  599. r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 0
  600. && li2.nChangeCalled == 1 && li2.nVetoCalled == 0
  601. && li3.nChangeCalled == 1 && li3.nVetoCalled == 0;
  602. cl.removePropertyChangeListener("PropByteA", li2);
  603. li.reset();
  604. li2.reset();
  605. li3.reset();
  606. cl.setPropertyValue("PropByteA", val1);
  607. r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 0
  608. && li2.nChangeCalled == 0 && li2.nVetoCalled == 0
  609. && li3.nChangeCalled == 1 && li3.nVetoCalled == 0;
  610. cl.removePropertyChangeListener("", li3);
  611. li.reset();
  612. li2.reset();
  613. li3.reset();
  614. cl.setPropertyValue("PropByteA", val2);
  615. r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 0
  616. && li2.nChangeCalled == 0 && li2.nVetoCalled == 0
  617. && li3.nChangeCalled == 0 && li3.nVetoCalled == 0;
  618. cl.addPropertyChangeListener("PropByteA", li);
  619. cl.addPropertyChangeListener("PropByteA", li2);
  620. cl.addPropertyChangeListener("", li3);
  621. cl.dispose();
  622. li.reset();
  623. li2.reset();
  624. li3.reset();
  625. try {
  626. cl.setPropertyValue("PropByteA", val2); i++;
  627. }catch (DisposedException e)
  628. {
  629. r[i++]= true;
  630. }
  631. //Vetoable tests
  632. cl= new TestClass();
  633. li.reset();
  634. li2.reset();
  635. li3.reset();
  636. cl.addVetoableChangeListener("PropByteA", li);
  637. val1= new Byte((byte)115);
  638. cl.setPropertyValue("PropByteA", val1);
  639. r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 0;
  640. cl.propByteA.Attributes = PropertyAttribute.CONSTRAINED;
  641. cl.addVetoableChangeListener("PropByteA", li);
  642. val2= new Byte((byte)116);
  643. li.reset();
  644. cl.setPropertyValue("PropByteA", val2);
  645. r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 1;
  646. r[i++]= li.evt.OldValue.equals(val1) && li.evt.NewValue.equals(val2) && li.evt.Source == cl;
  647. li.reset();
  648. li2.reset();
  649. li3.reset();
  650. cl.addVetoableChangeListener("PropByteA", li2);
  651. val3= new Byte((byte) 117);
  652. cl.setPropertyValue("PropByteA", val3);
  653. r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 1
  654. && li2.nChangeCalled == 0 && li2.nVetoCalled == 1;
  655. r[i++]= li.evt.OldValue.equals(val2) && li.evt.NewValue.equals(val3) && li.evt.Source == cl
  656. && li2.evt.OldValue.equals(val2) && li2.evt.NewValue.equals(val3) && li2.evt.Source == cl ;
  657. li.reset();
  658. li2.reset();
  659. li3.reset();
  660. val1= new Byte((byte)118);
  661. cl.addVetoableChangeListener("", li3);
  662. cl.setPropertyValue("PropByteA", val1);
  663. r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 1
  664. && li2.nChangeCalled == 0 && li2.nVetoCalled == 1
  665. && li3.nChangeCalled == 0 && li3.nVetoCalled == 1;
  666. r[i++]= li.evt.OldValue.equals(val3) && li.evt.NewValue.equals(val1) && li.evt.Source == cl;
  667. r[i++]= li2.evt.OldValue.equals(val3) && li2.evt.NewValue.equals(val1) && li2.evt.Source == cl;
  668. r[i++]= li3.evt.OldValue.equals(val3) && li3.evt.NewValue.equals(val1) && li3.evt.Source == cl ;
  669. li.reset();
  670. li2.reset();
  671. li3.reset();
  672. // Test Veto Exception
  673. cl.setPropertyValue("PropByteA", val1);
  674. li.bVeto= true;
  675. try {
  676. cl.setPropertyValue("PropByteA", val2);i++;
  677. } catch (PropertyVetoException e)
  678. {
  679. r[i++]= true;
  680. }
  681. r[i++]= cl.bytePropA == val1.byteValue();
  682. li.bVeto= false;
  683. li.reset();
  684. li2.reset();
  685. li3.reset();
  686. cl.removeVetoableChangeListener("PropByteA",li);
  687. cl.setPropertyValue("PropByteA", val1);
  688. r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 0
  689. && li2.nChangeCalled == 0 && li2.nVetoCalled == 1
  690. && li3.nChangeCalled == 0 && li3.nVetoCalled == 1;
  691. cl.removeVetoableChangeListener("PropByteA", li2);
  692. li.reset();
  693. li2.reset();
  694. li3.reset();
  695. cl.setPropertyValue("PropByteA", val1);
  696. r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 0
  697. && li2.nChangeCalled == 0 && li2.nVetoCalled == 0
  698. && li3.nChangeCalled == 0 && li3.nVetoCalled == 1;
  699. cl.removeVetoableChangeListener("", li3);
  700. li.reset();
  701. li2.reset();
  702. li3.reset();
  703. cl.setPropertyValue("PropByteA", val2);
  704. r[i++]= li.nChangeCalled == 0 && li.nVetoCalled == 0
  705. && li2.nChangeCalled == 0 && li2.nVetoCalled == 0
  706. && li3.nChangeCalled == 0 && li3.nVetoCalled == 0;
  707. cl.addVetoableChangeListener("PropByteA", li);
  708. cl.addVetoableChangeListener("PropByteA", li2);
  709. cl.addVetoableChangeListener("", li3);
  710. cl.dispose();
  711. li.reset();
  712. li2.reset();
  713. li3.reset();
  714. try {
  715. cl.setPropertyValue("PropByteA", val2);
  716. }catch (DisposedException e)
  717. {
  718. r[i++]= true;
  719. }
  720. }catch (Exception e)
  721. {
  722. i++;
  723. }
  724. boolean bOk= true;
  725. for (int c= 0; c < i; c++)
  726. bOk= bOk && r[c];
  727. if (bOk == false)
  728. System.out.println("Failed");
  729. else
  730. System.out.println("Ok");
  731. return bOk;
  732. }
  733. public boolean getPropertySetInfo()
  734. {
  735. System.out.println("PropertySet.getPropertySetInfo");
  736. boolean[] r= new boolean[50];
  737. int i= 0;
  738. TestClass cl= new TestClass();
  739. try {
  740. XPropertySetInfo info= cl.getPropertySetInfo();
  741. Property[] arProps= info.getProperties();
  742. Property[] arRegProps= cl.getRegisteredProperties();
  743. r[i++]= arProps.length == arRegProps.length;
  744. for (int j= 0; j < arProps.length; j++)
  745. {
  746. boolean bFound= false;
  747. for (int k= 0; k < arRegProps.length; k++)
  748. {
  749. if (arProps[j] == arRegProps[k])
  750. {
  751. bFound= true;
  752. break;
  753. }
  754. }
  755. if ( !bFound)
  756. r[i++]= false;
  757. }
  758. for (int j= 0; j < arRegProps.length; j++)
  759. {
  760. Property prop= info.getPropertyByName(arRegProps[j].Name);
  761. if (prop != arRegProps[j])
  762. r[i++]= false;
  763. if (! info.hasPropertyByName(arRegProps[j].Name))
  764. r[i++]= false;
  765. }
  766. }catch(java.lang.Exception e){
  767. System.out.println(e.getMessage());
  768. i++;
  769. }
  770. boolean bOk= true;
  771. for (int c= 0; c < i; c++)
  772. bOk= bOk && r[c];
  773. if (bOk == false)
  774. System.out.println("Failed");
  775. else
  776. System.out.println("Ok");
  777. return bOk;
  778. }
  779. public boolean setFastPropertyValue()
  780. {
  781. System.out.println("PropertySet.setFastPropertyValue");
  782. boolean[] r= new boolean[50];
  783. int i= 0;
  784. TestClass cl= new TestClass();
  785. try {
  786. cl.setFastPropertyValue(5, new Integer(111));
  787. r[i++]= cl.intPropA == 111;
  788. try {
  789. cl.setFastPropertyValue(-1, new Integer(1)); i++;
  790. } catch(UnknownPropertyException e)
  791. {
  792. r[i++]= true;
  793. }
  794. }catch(java.lang.Exception e){
  795. System.out.println(e.getMessage());
  796. i++;
  797. }
  798. boolean bOk= true;
  799. for (int c= 0; c < i; c++)
  800. bOk= bOk && r[c];
  801. if (bOk == false)
  802. System.out.println("Failed");
  803. else
  804. System.out.println("Ok");
  805. return bOk;
  806. }
  807. public boolean getFastPropertyValue()
  808. {
  809. System.out.println("PropertySet.setFastPropertyValue");
  810. boolean[] r= new boolean[50];
  811. int i= 0;
  812. TestClass cl= new TestClass();
  813. try {
  814. cl.setFastPropertyValue(5, new Integer(111));
  815. Integer aInt= (Integer) cl.getFastPropertyValue(5);
  816. r[i++]= aInt.intValue() == 111;
  817. }catch(java.lang.Exception e){
  818. System.out.println(e.getMessage());
  819. i++;
  820. }
  821. boolean bOk= true;
  822. for (int c= 0; c < i; c++)
  823. bOk= bOk && r[c];
  824. if (bOk == false)
  825. System.out.println("Failed");
  826. else
  827. System.out.println("Ok");
  828. return bOk;
  829. }
  830. public boolean setPropertyValues()
  831. {
  832. System.out.println("PropertySet.setPropertyValues");
  833. boolean[] r= new boolean[50];
  834. int i= 0;
  835. TestClass cl= new TestClass();
  836. try {
  837. cl.setPropertyValues(new String[0], new Object[0]);
  838. String[] arNames= new String[] {"PropCharA","PropIntClass","PropObjectA"};
  839. Character aChar= new Character('A');
  840. Integer aInt= new Integer(111);
  841. Byte aByte= new Byte((byte)11);
  842. Object[] values= new Object[]{aChar, aInt, aByte};
  843. cl.setPropertyValues(arNames, values);
  844. r[i++]= cl.charPropA == 'A' && cl.intClassProp.intValue() == 111 && ((Byte)cl.objectPropA).byteValue() == 11;
  845. arNames= new String[] {"blabla","PropIntClass","PropObjectA"};
  846. cl.resetPropertyMembers();
  847. cl.setPropertyValues(arNames, values);
  848. r[i++]= cl.intClassProp.intValue() == 111 && ((Byte)cl.objectPropA).byteValue() == 11;
  849. }catch(java.lang.Exception e){
  850. System.out.println(e.getMessage());
  851. i++;
  852. }
  853. boolean bOk= true;
  854. for (int c= 0; c < i; c++)
  855. bOk= bOk && r[c];
  856. if (bOk == false)
  857. System.out.println("Failed");
  858. else
  859. System.out.println("Ok");
  860. return bOk;
  861. }
  862. public boolean getPropertyValues()
  863. {
  864. System.out.println("PropertySet.getPropertyValues");
  865. boolean[] r= new boolean[50];
  866. int i= 0;
  867. TestClass cl= new TestClass();
  868. try {
  869. cl.charPropA= 'A';
  870. cl.intClassProp= new Integer(111);
  871. cl.objectPropA= new Byte((byte)11);
  872. Object[] values= cl.getPropertyValues(new String[] {"PropCharA","PropIntClass","PropObjectA"});
  873. r[i++]= ((Character) values[0]).charValue() == 'A' && ((Integer) values[1]).intValue() == 111
  874. && ((Byte) values[2]).byteValue() == 11;
  875. }catch(java.lang.Exception e){
  876. System.out.println(e.getMessage());
  877. i++;
  878. }
  879. boolean bOk= true;
  880. for (int c= 0; c < i; c++)
  881. bOk= bOk && r[c];
  882. if (bOk == false)
  883. System.out.println("Failed");
  884. else
  885. System.out.println("Ok");
  886. return bOk;
  887. }
  888. // Currently the listeners are always notified if one of properties has changed.
  889. // The property names in the first argument are ignored.
  890. public boolean addPropertiesChangeListener()
  891. {
  892. System.out.println("PropertySet.addPropertiesChangeListener\n" +
  893. "PropertySet.removePropertiesChangeListener\n" +
  894. "notification of such listeners");
  895. boolean[] r= new boolean[50];
  896. int i= 0;
  897. TestClass cl= new TestClass();
  898. try {
  899. Listener li1= new Listener();
  900. Listener li2= new Listener();
  901. cl.addPropertiesChangeListener(new String[]{"PropCharA"}, li1);
  902. cl.setPropertyValue("PropCharA", new Character('B'));
  903. r[i++]= li1.nPropertiesChange == 0;
  904. cl.propCharA.Attributes= PropertyAttribute.BOUND;
  905. cl.setPropertyValue("PropCharA", new Character('C'));
  906. r[i++]= li1.nPropertiesChange == 1;
  907. PropertyChangeEvent evt= li1.arEvt[0];
  908. r[i++]= evt.PropertyName.equals("PropCharA") && ((Character)evt.OldValue).charValue() == 'B'
  909. && ((Character) evt.NewValue).charValue() == 'C';
  910. li1.reset();
  911. cl.removePropertiesChangeListener(li1);
  912. cl.setPropertyValue("PropCharA", new Character('F'));
  913. r[i++]= li1.nPropertiesChange == 0;
  914. }catch(java.lang.Exception e){
  915. System.out.println(e.getMessage());
  916. i++;
  917. }
  918. boolean bOk= true;
  919. for (int c= 0; c < i; c++)
  920. bOk= bOk && r[c];
  921. if (bOk == false)
  922. System.out.println("Failed");
  923. else
  924. System.out.println("Ok");
  925. return bOk;
  926. }
  927. public boolean firePropertiesChangeEvent()
  928. {
  929. System.out.println("PropertySet.firePropertiesChangeEvent");
  930. boolean[] r= new boolean[50];
  931. int i= 0;
  932. TestClass cl= new TestClass();
  933. try {
  934. Listener li1= new Listener();
  935. cl.intClassProp= new Integer(111);
  936. cl.charPropA= 'A';
  937. cl.firePropertiesChangeEvent(new String[]{"PropCharA","PropIntClass"}, li1);
  938. r[i++]= li1.nPropertiesChange == 1;
  939. PropertyChangeEvent[] arEvt= li1.arEvt;
  940. r[i++]= arEvt[0].PropertyName.equals("PropCharA")
  941. && ((Character) arEvt[0].OldValue).charValue() == 'A'
  942. && ((Character) arEvt[0].NewValue).charValue() == 'A';
  943. r[i++]= arEvt[1].PropertyName.equals("PropIntClass")
  944. && ((Integer) arEvt[1].OldValue).intValue() == 111
  945. && ((Integer) arEvt[1].NewValue).intValue() == 111;
  946. }catch(java.lang.Exception e){
  947. System.out.println(e.getMessage());
  948. i++;
  949. }
  950. boolean bOk= true;
  951. for (int c= 0; c < i; c++)
  952. bOk= bOk && r[c];
  953. if (bOk == false)
  954. System.out.println("Failed");
  955. else
  956. System.out.println("Ok");
  957. return bOk;
  958. }
  959. public boolean registerProperty1()
  960. {
  961. TestClass2 cl= new TestClass2();
  962. return cl.test_registerProperty1();
  963. }
  964. public boolean registerProperty2()
  965. {
  966. TestClass2 cl= new TestClass2();
  967. return cl.test_registerProperty2();
  968. }
  969. public static boolean test()
  970. {
  971. PropertySet_Test test= new PropertySet_Test();
  972. boolean r[]= new boolean[50];
  973. int i= 0;
  974. r[i++]= test.convertPropertyValue();
  975. r[i++]= test.setPropertyValueNoBroadcast();
  976. r[i++]= test.setPropertyValue();
  977. r[i++]= test.addPropertyChangeListener();
  978. r[i++]= test.getPropertySetInfo();
  979. r[i++]= test.setFastPropertyValue();
  980. r[i++]= test.getFastPropertyValue();
  981. r[i++]= test.setPropertyValues();
  982. r[i++]= test.getPropertyValues();
  983. r[i++]= test.addPropertiesChangeListener();
  984. r[i++]= test.firePropertiesChangeEvent();
  985. r[i++]= test.registerProperty1();
  986. r[i++]= test.registerProperty2();
  987. boolean bOk= true;
  988. for (int c= 0; c < i; c++)
  989. bOk= bOk && r[c];
  990. if (bOk == false)
  991. System.out.println("Errors occurred!");
  992. else
  993. System.out.println("No errors.");
  994. return bOk;
  995. }
  996. public static void main(String[] args)
  997. {
  998. test();
  999. }
  1000. }
  1001. class TestClass extends PropertySet
  1002. {
  1003. public Property propBoolA= new Property("PropBoolA", 1, new Type(Boolean.TYPE), (short)0);
  1004. public boolean boolPropA;
  1005. public Property propCharA= new Property("PropCharA", 2, new Type(Character.TYPE), (short) 0);
  1006. public char charPropA;
  1007. public Property propByteA= new Property("PropByteA", 3, new Type(Byte.TYPE), (short) 0);
  1008. public byte bytePropA;
  1009. public Property propShortA= new Property("PropShortA", 4, new Type(Short.TYPE), (short) 0);
  1010. public short shortPropA;
  1011. public Property propIntA= new Property("PropIntA", 5, new Type(Integer.TYPE), (short) 0);
  1012. public int intPropA;
  1013. public Property propLongA= new Property("PropLongA", 6, new Type(Long.TYPE), (short) 0);
  1014. public long longPropA;
  1015. public Property propFloatA= new Property("PropFloatA", 7, new Type(Float.TYPE), (short) 0);
  1016. public float floatPropA;
  1017. public Property propDoubleA= new Property("PropDoubleA", 8, new Type(Double.TYPE), (short) 0);
  1018. public double doublePropA;
  1019. public Property propStringA= new Property("PropStringA", 9, new Type(String.class), (short) 0);
  1020. public String stringPropA;
  1021. public Property propArrayByteA= new Property("PropArrayByteA", 10, new Type(byte[].class), (short) 0);
  1022. public byte[] arBytePropA;
  1023. public Property propTypeA= new Property("PropTypeA", 11, new Type(Type.class), (short) 0);
  1024. public Type typePropA;
  1025. public Property propObjectA= new Property("PropObjectA",12, new Type(Object.class), (short) 0);
  1026. public Object objectPropA;
  1027. public Property propAnyA= new Property("PropAnyA", 13, new Type(Any.class), (short) 0);
  1028. public Any anyPropA;
  1029. public Property propXInterfaceA= new Property("PropXInterfaceA", 13, new Type(Any.class), (short) 0);
  1030. public XInterface xInterfacePropA;
  1031. public Property propXWeakA= new Property("PropXWeakA", 13, new Type(Any.class), (short) 0);
  1032. public XWeak xWeakPropA;
  1033. public Property propEnum =
  1034. new Property("PropEnum", 14, new Type("com.sun.star.beans.PropertyState", TypeClass.ENUM), (short)0);
  1035. public com.sun.star.beans.PropertyState enumPropertyState = com.sun.star.beans.PropertyState.DEFAULT_VALUE;
  1036. // Test private, protected, package access, Anys as arguments and members, members whith a value
  1037. public Property propBoolB= new Property("PropBoolB", 101, new Type(Boolean.TYPE), (short) 0);
  1038. protected boolean boolPropB;
  1039. public Property propBoolC= new Property("PropBoolC", 201, new Type(Boolean.TYPE), (short) 0);
  1040. boolean boolPropC;
  1041. public Property propBoolD= new Property("PropBoolD", 301, new Type(Boolean.TYPE), (short) 0);
  1042. public Property propBoolClass= new Property("PropBoolClass", 1001, new Type(Boolean.class), (short) 0);
  1043. public Boolean boolClassProp;
  1044. public Property propCharClass= new Property("PropCharClass", 1002, new Type(Character.class), (short) 0);
  1045. public Character charClassProp;
  1046. public Property propByteClass= new Property("PropByteClass", 1003, new Type(Byte.class), (short) 0);
  1047. public Byte byteClassProp;
  1048. public Property propShortClass= new Property("PropShortClass", 1004, new Type(Short.class), (short) 0);
  1049. public Short shortClassProp;
  1050. public Property propIntClass= new Property("PropIntClass", 1005, new Type(Integer.class), (short) 0);
  1051. public Integer intClassProp;
  1052. public Property propLongClass= new Property("PropLongClass", 1006, new Type(Long.class), (short) 0);
  1053. public Long longClassProp;
  1054. public Property propFloatClass= new Property("PropFloatClass", 1007, new Type(Float.class), (short) 0);
  1055. public Float floatClassProp;
  1056. public Property propDoubleClass= new Property("PropDoubleClass", 1008, new Type(Double.class), (short) 0);
  1057. public Double doubleClassProp;
  1058. public TestClass()
  1059. {
  1060. super();
  1061. // When adding properties then modify the getRegisteredProperties method
  1062. //registerProperty(String name, int handle, Type type, short attributes, String memberName)
  1063. registerProperty(propBoolA, "boolPropA");
  1064. registerProperty(propCharA, "charPropA");
  1065. registerProperty(propByteA, "bytePropA");
  1066. registerProperty(propShortA, "shortPropA");
  1067. registerProperty(propIntA, "intPropA");
  1068. registerProperty(propLongA, "longPropA");
  1069. registerProperty(propFloatA, "floatPropA");
  1070. registerProperty(propDoubleA, "doublePropA");
  1071. registerProperty(propStringA, "stringPropA");
  1072. registerProperty(propArrayByteA, "arBytePropA");
  1073. registerPr

Large files files are truncated, but you can click here to view the full file