Source Code Cross Referenced for DesignEventTest.java in  » IDE-Netbeans » vmd.analyzer » org » netbeans » modules » vmd » api » model » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » vmd.analyzer » org.netbeans.modules.vmd.api.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:        package org.netbeans.modules.vmd.api.model;
042:
043:        import java.util.Collection;
044:        import java.util.HashSet;
045:
046:        import junit.framework.Test;
047:        import junit.framework.TestCase;
048:        import junit.framework.TestSuite;
049:        import org.netbeans.modules.vmd.api.model.common.TypesSupport;
050:
051:        import org.netbeans.modules.vmd.api.model.descriptors.FirstCD;
052:        import org.netbeans.modules.vmd.api.model.listeners.TestDesignListener;
053:        import org.netbeans.modules.vmd.api.model.utils.ModelTestUtil;
054:
055:        import static org.netbeans.modules.vmd.api.model.utils.TestTypes.*;
056:
057:        /**
058:         *
059:         * @author Karol Harezlak
060:         */
061:        public class DesignEventTest extends TestCase {
062:            private DesignDocument document;
063:            private Long comp1ID = null;
064:            private Long comp2ID = null;
065:            private Long comp3ID = null;
066:            private Long comp4ID = null;
067:
068:            public DesignEventTest(String testName) {
069:                super (testName);
070:            }
071:
072:            protected void setUp() throws Exception {
073:                document = ModelTestUtil.createTestDesignDocument();
074:            }
075:
076:            protected void tearDown() throws Exception {
077:            }
078:
079:            public static Test suite() {
080:                TestSuite suite = new TestSuite(DesignEventTest.class);
081:                return suite;
082:            }
083:
084:            /**
085:             * Test of getEventID method, of class org.netbeans.modules.vmd.api.model.DesignEvent.
086:             */
087:            public void testGetEventID() {
088:                System.out.println("getEventID"); // NOI18N
089:
090:                document.getTransactionManager().writeAccess(new Runnable() {
091:                    public void run() {
092:                        //createComponent
093:                        final DesignComponent comp1 = document
094:                                .createComponent(FirstCD.TYPEID_CLASS);
095:                        document.getListenerManager().addDesignListener(
096:                                new DesignListener() {
097:                                    public void designChanged(DesignEvent event) {
098:                                        boolean result = event.getEventID() >= 0;
099:                                        assertTrue(result);
100:                                    }
101:                                },
102:                                new DesignEventFilter().addComponentFilter(
103:                                        comp1, false));
104:                        // rising events
105:                        comp1
106:                                .writeProperty(
107:                                        FirstCD.PROPERTY_TEST,
108:                                        TypesSupport
109:                                                .createStringValue(DesignComponentTest.PROPERTY1_VALUE_STRING)); // NOI18N
110:                    }
111:                });
112:            }
113:
114:            /**
115:             * Test of getFullyAffectedComponents method, of class org.netbeans.modules.vmd.api.model.DesignEvent.
116:             */
117:            public void testGetFullyAffectedComponents() {
118:                final String methodName = ("getFullyAffectedComponents"); // NOI18N
119:                System.out.println(methodName);
120:                final TestDesignListener designListener = new TestDesignListener(
121:                        methodName);
122:
123:                document.getTransactionManager().writeAccess(new Runnable() {
124:                    public void run() {
125:                        //create components
126:                        final DesignComponent comp1 = document
127:                                .createComponent(FirstCD.TYPEID_CLASS);
128:                        comp1ID = comp1.getComponentID();
129:                        final DesignComponent comp2 = document
130:                                .createComponent(FirstCD.TYPEID_CLASS);
131:                        comp2ID = comp2.getComponentID();
132:                        document.getListenerManager().addDesignListener(
133:                                designListener,
134:                                new DesignEventFilter().addComponentFilter(
135:                                        comp1, false));
136:                        // rising events
137:                        comp1
138:                                .writeProperty(
139:                                        FirstCD.PROPERTY_TEST,
140:                                        TypesSupport
141:                                                .createStringValue(DesignComponentTest.PROPERTY1_VALUE_STRING));
142:                        comp2
143:                                .writeProperty(
144:                                        FirstCD.PROPERTY_TEST,
145:                                        TypesSupport
146:                                                .createStringValue(DesignComponentTest.PROPERTY3_VALUE_STRING));
147:                    }
148:                });
149:                //Check if event has been rised
150:                assertTrue(designListener.isDesignChangeFlag());
151:                //there should be two fully affected components during this writeAccess
152:                assertTrue(designListener.getEvent()
153:                        .getFullyAffectedComponents().size() == 2);
154:                //Event shouldntbe rised after following writeProperty method
155:                designListener.setDesignChangeFlag(false);
156:                document.getTransactionManager().writeAccess(new Runnable() {
157:                    public void run() {
158:                        //checking if comp1 is in the collection of fully affected components
159:                        assertTrue(designListener.getEvent()
160:                                .getFullyAffectedComponents().contains(
161:                                        document.getComponentByUID(comp1ID)));
162:                        DesignComponent comp2 = document
163:                                .getComponentByUID(comp2ID);
164:                        //Event shouldnbe rised after following writeProperty method
165:                        comp2
166:                                .writeProperty(
167:                                        FirstCD.PROPERTY_TEST,
168:                                        TypesSupport
169:                                                .createStringValue(DesignComponentTest.PROPERTY4_VALUE_STRING));
170:                    }
171:                });
172:                //Check if event has been rised shouldn be in last writeAccess!
173:                assertFalse(designListener.isDesignChangeFlag());
174:                cleanUpCompIDs();
175:            }
176:
177:            /**
178:             * Test of getFullyAffectedHierarchies method, of class org.netbeans.modules.vmd.api.model.DesignEvent.
179:             */
180:            public void testGetFullyAffectedHierarchies_getPartlyAffectedHierarchies() {
181:                final String methodName = "getFullyAffectedHierarchies, getPartlyAffectedHierarchies"; // NOI18N
182:                final TestDesignListener designListener = new TestDesignListener(
183:                        methodName);
184:
185:                System.out.println(methodName);
186:
187:                //PART I Checking fully affected hierahy
188:                document.getTransactionManager().writeAccess(new Runnable() {
189:                    public void run() {
190:                        //createComponent
191:                        final DesignComponent comp1 = document
192:                                .createComponent(FirstCD.TYPEID_CLASS);
193:                        comp1ID = comp1.getComponentID();
194:                        final DesignComponent comp2 = document
195:                                .createComponent(FirstCD.TYPEID_CLASS);
196:                        comp2ID = comp2.getComponentID();
197:                        final DesignComponent comp3 = document
198:                                .createComponent(FirstCD.TYPEID_CLASS);
199:                        comp3ID = comp3.getComponentID();
200:                        final DesignComponent comp4 = document
201:                                .createComponent(FirstCD.TYPEID_CLASS);
202:                        comp4ID = comp4.getComponentID();
203:
204:                        document.setRootComponent(comp1);
205:                        document.getListenerManager().addDesignListener(
206:                                designListener,
207:                                new DesignEventFilter().addHierarchyFilter(
208:                                        comp1, true));
209:                        // rising events
210:                        comp1.addComponent(comp2);
211:                        comp2.addComponent(comp3);
212:                        comp3.addComponent(comp4);
213:                    }
214:                });
215:                //Check if event has been rised
216:                assertTrue(designListener.isDesignChangeFlag());
217:                //Testing fully affected components
218:                assertTrue(designListener.getEvent()
219:                        .getFullyAffectedHierarchies().size() == 4);
220:                //PART II Checking partly affected hierahy
221:                document.getTransactionManager().writeAccess(new Runnable() {
222:                    public void run() {
223:                        designListener.setDesignChangeFlag(false);
224:                        DesignComponent comp1 = document
225:                                .getComponentByUID(comp1ID);
226:                        DesignComponent comp2 = document
227:                                .getComponentByUID(comp2ID);
228:                        //checking if comp1 is in the collection of fully affected components
229:                        comp1.removeComponent(comp2);
230:                        Debug.dumpDocument(document);
231:                    }
232:                });
233:                //Check if event has been rised
234:                assertTrue(designListener.isDesignChangeFlag());
235:                //Testing fully affected components
236:                assertTrue(designListener.getEvent()
237:                        .getFullyAffectedHierarchies().size() == 2);
238:                //Testing fully affected components
239:                assertTrue(designListener.getEvent()
240:                        .getPartlyAffectedHierarchies().size() == 4);
241:                cleanUpCompIDs();
242:            }
243:
244:            /**
245:             * Test of getPartlyAffectedComponents method, of class org.netbeans.modules.vmd.api.model.DesignEvent.
246:             */
247:            public void testGetPartlyAffectedComponents() {
248:                final String methodName = "getPartlyAffectedComponents"; // NOI18N
249:                final TestDesignListener designListener = new TestDesignListener(
250:                        methodName);
251:
252:                System.out.println(methodName);
253:
254:                document.getTransactionManager().writeAccess(new Runnable() {
255:                    public void run() {
256:                        //createComponent
257:                        DesignComponent comp1 = document
258:                                .createComponent(FirstCD.TYPEID_CLASS);
259:                        comp1ID = comp1.getComponentID();
260:                        DesignComponent comp2 = document
261:                                .createComponent(FirstCD.TYPEID_CLASS);
262:                        comp2ID = comp2.getComponentID();
263:                        document.getListenerManager().addDesignListener(
264:                                designListener,
265:                                new DesignEventFilter().addComponentFilter(
266:                                        comp2, true));
267:                        document.setRootComponent(comp1);
268:                        comp1.addComponent(comp2);
269:                        // rising event
270:                        comp2
271:                                .writeProperty(
272:                                        FirstCD.PROPERTY_TEST,
273:                                        TypesSupport
274:                                                .createStringValue(DesignComponentTest.PROPERTY3_VALUE_STRING)); // NOI18N
275:                    }
276:                });
277:                //Check if event has been rised
278:                assertTrue(designListener.isDesignChangeFlag());
279:                //Checking size of collection
280:                assertTrue(designListener.getEvent()
281:                        .getPartlyAffectedComponents().size() == 2);
282:                //there should be only one fully affected component during this writeAccess
283:                assertTrue(designListener.getEvent()
284:                        .getFullyAffectedComponents().size() == 1);
285:                //Event shouldnt be rised after following writeProperty method
286:                document.getTransactionManager().writeAccess(new Runnable() {
287:                    public void run() {
288:                        DesignComponent comp1 = document
289:                                .getComponentByUID(comp1ID);
290:                        DesignComponent comp2 = document
291:                                .getComponentByUID(comp2ID);
292:
293:                        //checking if comp1 is in the collection of partly affected components
294:                        assertTrue(designListener.getEvent()
295:                                .getPartlyAffectedComponents().contains(comp1));
296:                        //Checking fully affected components
297:                        assertTrue(designListener.getEvent()
298:                                .getFullyAffectedComponents().contains(comp2));
299:                        //clean up designListener
300:                        designListener.setDesignChangeFlag(false);
301:                        //rising new events
302:                        comp1
303:                                .writeProperty(
304:                                        FirstCD.PROPERTY_TEST,
305:                                        TypesSupport
306:                                                .createStringValue(DesignComponentTest.PROPERTY3_VALUE_STRING)); // NOI18N
307:                    }
308:                });
309:                //check if event has been raised, it shouldnt be cause it's only partly affected component
310:                assertFalse(designListener.isDesignChangeFlag());
311:                cleanUpCompIDs();
312:            }
313:
314:            /**
315:             * Test of getDescriptorChangedComponents method, of class org.netbeans.modules.vmd.api.model.DesignEvent.
316:             */
317:            public void testGetDescriptorChangedComponents() {
318:                final String methodName = "getDescriptorChangedComponents"; // NOI18N
319:                final TestDesignListener designListener = new TestDesignListener(
320:                        methodName);
321:
322:                System.out.println(methodName);
323:
324:                document.getTransactionManager().writeAccess(new Runnable() {
325:                    public void run() {
326:                        // rising events
327:                        DesignComponent comp1 = document
328:                                .createComponent(FirstCD.TYPEID_CLASS);
329:                        DesignComponent comp2 = document
330:                                .createComponent(FirstCD.TYPEID_CLASS);
331:
332:                        document.getListenerManager().addDesignListener(
333:                                designListener,
334:                                new DesignEventFilter()
335:                                        .addDescriptorFilter(comp1));
336:                    }
337:                });
338:                //Check if event has been rised
339:                assertTrue(designListener.isDesignChangeFlag());
340:                //Checking getDescriptorChangedComponents()
341:                assertTrue(designListener.getEvent()
342:                        .getDescriptorChangedComponents().size() == 2);
343:            }
344:
345:            /**
346:             * Test of getOldPropertyValue method, of class org.netbeans.modules.vmd.api.model.DesignEvent.
347:             */
348:
349:            public void testGetOldPropertyValue() {
350:                String methodName = "getOldPropertyValue"; // NOI18N
351:                final TestDesignListener designListener = new TestDesignListener(
352:                        methodName);
353:
354:                System.out.println(methodName);
355:
356:                document.getTransactionManager().writeAccess(new Runnable() {
357:                    public void run() {
358:                        //createComponent
359:                        DesignComponent comp1 = document
360:                                .createComponent(FirstCD.TYPEID_CLASS);
361:                        comp1ID = comp1.getComponentID();
362:                        document.getListenerManager().addDesignListener(
363:                                designListener,
364:                                new DesignEventFilter().addComponentFilter(
365:                                        comp1, true));
366:                        // rising events
367:                        comp1
368:                                .writeProperty(
369:                                        FirstCD.PROPERTY_TEST,
370:                                        TypesSupport
371:                                                .createStringValue(DesignComponentTest.PROPERTY4_VALUE_STRING));
372:                    }
373:                });
374:                //Check if event has been rised
375:                assertTrue(designListener.isDesignChangeFlag());
376:                document.getTransactionManager().writeAccess(new Runnable() {
377:                    public void run() {
378:                        DesignComponent comp1 = document
379:                                .getComponentByUID(comp1ID);
380:                        //Check value
381:                        assertTrue(comp1.readProperty(FirstCD.PROPERTY_TEST)
382:                                .getValue() == DesignComponentTest.PROPERTY4_VALUE_STRING);
383:                        comp1.resetToDefault(FirstCD.PROPERTY_TEST);
384:                        //Checking if oldValue equals deafult value of instance Name property
385:                        assertTrue(comp1.readProperty(FirstCD.PROPERTY_TEST)
386:                                .getValue() == designListener.getEvent()
387:                                .getOldPropertyValue(comp1,
388:                                        FirstCD.PROPERTY_TEST).getValue());
389:                    }
390:                });
391:                cleanUpCompIDs();
392:            }
393:
394:            /**
395:             * Test of isComponentPropertyChanged method, of class org.netbeans.modules.vmd.api.model.DesignEvent.
396:             * Using DescentFilter and ComponentFilter
397:             */
398:            public void testIsComponentPropertyChanged() {
399:                String methodName = "isComponentPropertyChanged"; // NOI18N
400:                final TestDesignListener listenerComponentFilter = new TestDesignListener(
401:                        methodName);
402:                final TestDesignListener listenerDescentFilter = new TestDesignListener(
403:                        methodName);
404:
405:                System.out.println(methodName);
406:
407:                document.getTransactionManager().writeAccess(new Runnable() {
408:                    public void run() {
409:                        //createComponent
410:                        DesignComponent comp1 = document
411:                                .createComponent(FirstCD.TYPEID_CLASS);
412:                        comp1ID = comp1.getComponentID();
413:                        DesignComponent comp2 = document
414:                                .createComponent(FirstCD.TYPEID_CLASS);
415:                        comp2ID = comp2.getComponentID();
416:                        document.getListenerManager().addDesignListener(
417:                                listenerComponentFilter,
418:                                new DesignEventFilter().addComponentFilter(
419:                                        comp1, true));
420:                        //TODO event for DescentFilter doesnt work
421:                        document.getListenerManager().addDesignListener(
422:                                listenerDescentFilter,
423:                                new DesignEventFilter().addDescentFilter(comp1,
424:                                        FirstCD.PROPERTY_TEST));
425:                        comp1
426:                                .writeProperty(
427:                                        FirstCD.PROPERTY_TEST,
428:                                        TypesSupport
429:                                                .createStringValue(DesignComponentTest.PROPERTY3_VALUE_STRING));
430:                    }
431:                });
432:                //Check if event has been rised
433:                assertTrue(listenerComponentFilter.isDesignChangeFlag());
434:                assertTrue(listenerDescentFilter.isDesignChangeFlag());
435:                document.getTransactionManager().writeAccess(new Runnable() {
436:                    public void run() {
437:                        //createComponent
438:                        DesignComponent comp1 = document
439:                                .getComponentByUID(comp1ID);
440:                        DesignComponent comp2 = document
441:                                .getComponentByUID(comp2ID);
442:
443:                        //check if property of comp1 has been changed
444:                        assertTrue(listenerComponentFilter.getEvent()
445:                                .isComponentPropertyChanged(comp1,
446:                                        FirstCD.PROPERTY_TEST));
447:                        //check if property of comp2 has NOT been changed
448:                        assertFalse(listenerComponentFilter.getEvent()
449:                                .isComponentPropertyChanged(comp2,
450:                                        FirstCD.PROPERTY_TEST));
451:                        //check if property of comp1 has been changed
452:                        assertTrue(listenerDescentFilter.getEvent()
453:                                .isComponentPropertyChanged(comp1,
454:                                        FirstCD.PROPERTY_TEST));
455:                        //check if property of comp2 has NOT been changed
456:                        assertFalse(listenerDescentFilter.getEvent()
457:                                .isComponentPropertyChanged(comp2,
458:                                        FirstCD.PROPERTY_TEST));
459:                    }
460:                });
461:                cleanUpCompIDs();
462:            }
463:
464:            /**
465:             * Test of isSelectionChanged method, of class org.netbeans.modules.vmd.api.model.DesignEvent.
466:             */
467:            public void testIsSelectionChanged() {
468:                final String methodName = "isSelectionChanged"; // NOI18N
469:                final TestDesignListener designListener = new TestDesignListener(
470:                        methodName);
471:
472:                System.out.println(methodName);
473:
474:                document.getTransactionManager().writeAccess(new Runnable() {
475:                    public void run() {
476:                        //createComponent
477:                        DesignComponent comp1 = document
478:                                .createComponent(FirstCD.TYPEID_CLASS);
479:                        DesignComponent comp2 = document
480:                                .createComponent(FirstCD.TYPEID_CLASS);
481:
482:                        document.getListenerManager().addDesignListener(
483:                                designListener,
484:                                new DesignEventFilter().setSelection(true));
485:                        // rising events
486:                        Collection<DesignComponent> selectedComponents = new HashSet<DesignComponent>();
487:                        selectedComponents.add(comp1);
488:                        document.setSelectedComponents("Test_Source_ID",
489:                                selectedComponents); // NOI18N
490:                    }
491:                });
492:                //Check if event has been rised
493:                assertTrue(designListener.isDesignChangeFlag());
494:                //Check if selection changed
495:                assertTrue(designListener.getEvent().isSelectionChanged());
496:            }
497:
498:            /**
499:             * Test of isStructureChanged method, of class org.netbeans.modules.vmd.api.model.DesignEvent.
500:             */
501:            public void testIsStructureChanged() {
502:                final String methodName = "   isStructureChanged"; // NOI18N
503:                final TestDesignListener designListener = new TestDesignListener(
504:                        methodName);
505:
506:                System.out.println(methodName);
507:
508:                document.getTransactionManager().writeAccess(new Runnable() {
509:                    public void run() {
510:                        //createComponent
511:                        DesignComponent comp1 = document
512:                                .createComponent(FirstCD.TYPEID_CLASS);
513:                        DesignComponent comp2 = document
514:                                .createComponent(FirstCD.TYPEID_CLASS);
515:                        document.getListenerManager().addDesignListener(
516:                                designListener,
517:                                new DesignEventFilter().setGlobal(true));
518:                        // rising events
519:                        document.setRootComponent(comp2);
520:                        comp2.addComponent(comp1);
521:                    }
522:                });
523:                //Check if event has been rised
524:                assertTrue(designListener.isDesignChangeFlag());
525:                //Check if selection changed
526:                assertTrue(designListener.getEvent().isStructureChanged());
527:            }
528:
529:            private void cleanUpCompIDs() {
530:                comp1ID = null;
531:                comp2ID = null;
532:                comp3ID = null;
533:                comp4ID = null;
534:            }
535:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.