Source Code Cross Referenced for DiagramCreation.java in  » IDE-Netbeans » uml » org » netbeans » test » umllib » tests » 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 » uml » org.netbeans.test.umllib.tests 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003:         *
0004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
0005:         *
0006:         * The contents of this file are subject to the terms of either the GNU
0007:         * General Public License Version 2 only ("GPL") or the Common
0008:         * Development and Distribution License("CDDL") (collectively, the
0009:         * "License"). You may not use this file except in compliance with the
0010:         * License. You can obtain a copy of the License at
0011:         * http://www.netbeans.org/cddl-gplv2.html
0012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
0013:         * specific language governing permissions and limitations under the
0014:         * License.  When distributing the software, include this License Header
0015:         * Notice in each file and include the License file at
0016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
0017:         * particular file as subject to the "Classpath" exception as provided
0018:         * by Sun in the GPL Version 2 section of the License file that
0019:         * accompanied this code. If applicable, add the following below the
0020:         * License Header, with the fields enclosed by brackets [] replaced by
0021:         * your own identifying information:
0022:         * "Portions Copyrighted [year] [name of copyright owner]"
0023:         *
0024:         * Contributor(s):
0025:         *
0026:         * The Original Software is NetBeans. The Initial Developer of the Original
0027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
0028:         * Microsystems, Inc. All Rights Reserved.
0029:         *
0030:         * If you wish your version of this file to be governed by only the CDDL
0031:         * or only the GPL Version 2, indicate your decision by adding
0032:         * "[Contributor] elects to include this software in this distribution
0033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
0034:         * single choice of license, a recipient has the option to distribute
0035:         * your version of this file under either the CDDL, the GPL Version 2 or
0036:         * to extend the choice of license to its licensees as provided above.
0037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
0038:         * Version 2 license, then the option applies only if the new code is
0039:         * made subject to such option by the copyright holder.
0040:         */
0041:
0042:        package org.netbeans.test.umllib.tests;
0043:
0044:        import java.awt.Component;
0045:        import java.awt.event.KeyEvent;
0046:        import org.netbeans.jellytools.MainWindowOperator;
0047:        import org.netbeans.jellytools.ProjectsTabOperator;
0048:        import org.netbeans.jellytools.nodes.Node;
0049:        import org.netbeans.jellytools.nodes.ProjectRootNode;
0050:        import org.netbeans.jemmy.ComponentChooser;
0051:        import org.netbeans.jemmy.EventTool;
0052:        import org.netbeans.jemmy.operators.ComponentOperator;
0053:        import org.netbeans.jemmy.operators.ContainerOperator;
0054:        import org.netbeans.jemmy.operators.JButtonOperator;
0055:        import org.netbeans.jemmy.operators.JDialogOperator;
0056:        import org.netbeans.jemmy.operators.JMenuItemOperator;
0057:        import org.netbeans.jemmy.operators.JPopupMenuOperator;
0058:        import org.netbeans.jemmy.operators.JTreeOperator;
0059:
0060:        import org.netbeans.junit.NbTestSuite;
0061:        import org.netbeans.test.umllib.DiagramElementOperator;
0062:        import org.netbeans.test.umllib.DiagramOperator;
0063:        import org.netbeans.test.umllib.ElementTypes;
0064:        import org.netbeans.test.umllib.NewDiagramWizardOperator;
0065:        import org.netbeans.test.umllib.NewPackageWizardOperator;
0066:        import org.netbeans.test.umllib.exceptions.UMLCommonException;
0067:        import org.netbeans.test.umllib.testcases.UMLTestCase;
0068:
0069:        /**
0070:         *
0071:         * @author psb
0072:         * @spec UML/ComponentDiagram.xml
0073:         */
0074:        public abstract class DiagramCreation extends UMLTestCase {
0075:
0076:            //some system properties
0077:            private static String contextPropItemName = "Properties";
0078:            private static String umlPropertyWindowTitle = "Project Properties";
0079:            private static String umlSourcePackagesLabel = "Source Packages";
0080:            private static String umlSourcePackagesColumn = "Folder Label";
0081:            private static String umlSourceUsageColumn = "Model?";
0082:            private static String mainTreeTabName = "Projects";
0083:            public static String diagramType = null;//NewDiagramWizardOperator.ACTIVITY_DIAGRAM;
0084:            public static String childClassName = null;
0085:            private static ElementTypes elToPlace = null;
0086:            private static String elToPlaceName = null;
0087:            //common test properties
0088:            public static String prName = null;// "ActivityDiagramProjectADC";
0089:            public static String project = null;//prName+"|Model";
0090:            private static String sourceProject = "source";
0091:            private static boolean codeSync = false;
0092:            private ProjectsTabOperator pto = null;
0093:            private Node lastDiagramNode = null;
0094:            private String lastTestCase = null;
0095:            private JTreeOperator prTree = null;
0096:            private static String workdir = System.getProperty("xtest.workdir");
0097:            private static long elCount = 0;
0098:
0099:            /**  */
0100:            public DiagramCreation(String name, String type, String prNm,
0101:                    String childClName, ElementTypes elToPlace, String elName) {
0102:                super (name);
0103:                diagramType = type;
0104:                prName = prNm;
0105:                project = prName + "|Model";
0106:                childClassName = childClName;
0107:                this .elToPlace = elToPlace;
0108:            }
0109:
0110:            /**
0111:             * by default all diagrams are checked with COMMENT i.e. most common element
0112:             */
0113:            public DiagramCreation(String name, String type, String prNm,
0114:                    String childClName) {
0115:                this (name, type, prNm, childClName, ElementTypes.COMMENT, "");
0116:            }
0117:
0118:            /* public DiagramCreation(String name) {
0119:                 super(name);
0120:             }*/
0121:            /*public static NbTestSuite suite() {
0122:               NbTestSuite suite = new NbTestSuite(org.netbeans.test.umllib.tests.DiagramCreation.class);
0123:               return suite;
0124:            }*/
0125:
0126:            public void setUp() {
0127:                System.out.println("########  " + getName() + "  #######");
0128:                pto = ProjectsTabOperator.invoke();
0129:                if (!codeSync) {
0130:                    if (prName == null)
0131:                        throw new UMLCommonException("Project is null");
0132:                    org.netbeans.test.umllib.tests.utils.Utils
0133:                            .commonTestsSetup(workdir, prName, "Yes");
0134:                    //
0135:                    codeSync = true;
0136:                }
0137:            }
0138:
0139:            public void testAddDiagramModel() {
0140:                lastTestCase = getCurrentTestMethodName();
0141:                elCount++;
0142:                String diagramName = "testD" + elCount;
0143:                String workPkg = "pkg" + elCount;
0144:                //
0145:                ProjectsTabOperator pto = ProjectsTabOperator.invoke();
0146:                new EventTool().waitNoEvent(1000);
0147:                ProjectRootNode root = new ProjectRootNode(pto.tree(), project);
0148:                //*workaround for some fails in jelly
0149:                root.tree().waitVisible(root.getTreePath());
0150:                root.tree().expandPath(root.getTreePath());
0151:                root.tree().waitExpanded(root.getTreePath());
0152:                try {
0153:                    Thread.sleep(1000);
0154:                } catch (Exception ex) {
0155:                }
0156:                java.awt.Rectangle pth = root.tree().getPathBounds(
0157:                        root.getTreePath());
0158:                root.tree().moveMouse(pth.x + pth.width / 3,
0159:                        pth.y + pth.height / 2);
0160:                new EventTool().waitNoEvent(1000);
0161:                //*workaround finished
0162:                root.select();
0163:                root.tree().waitSelected(root.getTreePath());
0164:                root.callPopup().pushMenuNoBlock("New|Diagram");
0165:                NewDiagramWizardOperator nw = new NewDiagramWizardOperator();
0166:                nw.setDiagramType(diagramType);
0167:                nw.setDiagramName(diagramName);
0168:                nw.clickFinish();
0169:                //
0170:                DiagramOperator ad = new DiagramOperator(diagramName);
0171:                new Node(root, diagramName);
0172:                root = new ProjectRootNode(pto.tree(), prName + "|Diagram");
0173:                root.expand();
0174:                root.waitExpanded();
0175:                new Node(root, diagramName);
0176:            }
0177:
0178:            public void testAddDiagramDiagram() {
0179:                lastTestCase = getCurrentTestMethodName();
0180:                elCount++;
0181:                String diagramName = "testD" + elCount;
0182:                String workPkg = "pkg" + elCount;
0183:                //
0184:                ProjectsTabOperator pto = ProjectsTabOperator.invoke();
0185:                new EventTool().waitNoEvent(1000);
0186:                ProjectRootNode root = new ProjectRootNode(pto.tree(), prName
0187:                        + "|Diagram");
0188:                //*workaround for some fails in jelly
0189:                root.tree().waitVisible(root.getTreePath());
0190:                root.tree().expandPath(root.getTreePath());
0191:                root.tree().waitExpanded(root.getTreePath());
0192:                try {
0193:                    Thread.sleep(1000);
0194:                } catch (Exception ex) {
0195:                }
0196:                java.awt.Rectangle pth = root.tree().getPathBounds(
0197:                        root.getTreePath());
0198:                root.tree().moveMouse(pth.x + pth.width / 3,
0199:                        pth.y + pth.height / 2);
0200:                new EventTool().waitNoEvent(1000);
0201:                //*workaround finished
0202:                root.select();
0203:                root.tree().waitSelected(root.getTreePath());
0204:                root.callPopup().pushMenuNoBlock("New|Diagram");
0205:                NewDiagramWizardOperator nw = new NewDiagramWizardOperator();
0206:                nw.setDiagramType(diagramType);
0207:                nw.setDiagramName(diagramName);
0208:                nw.clickFinish();
0209:                //
0210:                DiagramOperator ad = new DiagramOperator(diagramName);
0211:                new Node(root, diagramName);
0212:                root = new ProjectRootNode(pto.tree(), prName + "|Model");
0213:                root.expand();
0214:                root.waitExpanded();
0215:                new Node(root, diagramName);
0216:            }
0217:
0218:            public void testAddPackageWithDiagram() {
0219:                lastTestCase = getCurrentTestMethodName();
0220:                elCount++;
0221:                String diagramName = "testD" + elCount;
0222:                String workPkg = "pkg" + elCount;
0223:                //
0224:                ProjectsTabOperator pto = ProjectsTabOperator.invoke();
0225:                new EventTool().waitNoEvent(1000);
0226:                ProjectRootNode root = new ProjectRootNode(pto.tree(), project);
0227:                //*workaround for some fails in jelly
0228:                root.tree().waitVisible(root.getTreePath());
0229:                root.tree().expandPath(root.getTreePath());
0230:                root.tree().waitExpanded(root.getTreePath());
0231:                try {
0232:                    Thread.sleep(1000);
0233:                } catch (Exception ex) {
0234:                }
0235:                java.awt.Rectangle pth = root.tree().getPathBounds(
0236:                        root.getTreePath());
0237:                root.tree().moveMouse(pth.x + pth.width / 3,
0238:                        pth.y + pth.height / 2);
0239:                new EventTool().waitNoEvent(1000);
0240:                //*workaround finished
0241:                root.select();
0242:                root.tree().waitSelected(root.getTreePath());
0243:                JPopupMenuOperator pop = root.callPopup();
0244:                pop.waitComponentVisible(true);
0245:                pop.waitComponentShowing(true);
0246:                pop.pushMenuNoBlock("New|Package");
0247:                NewPackageWizardOperator nw = new NewPackageWizardOperator();
0248:                nw.setScopedDiagram(workPkg, diagramName, diagramType);
0249:                nw.clickFinish();
0250:                //
0251:                DiagramOperator ad = new DiagramOperator(diagramName);
0252:            }
0253:
0254:            public void testOpenExistingWithDoubleClick() {
0255:                lastTestCase = getCurrentTestMethodName();
0256:                elCount++;
0257:                String diagramName = "testD" + elCount;
0258:                String workPkg = "pkg" + elCount;
0259:                //
0260:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
0261:                        .createDiagram(project, workPkg, diagramName,
0262:                                diagramType);
0263:                lastDiagramNode = rt.lastDiagramNode;
0264:                rt.dOp.pushMenuOnTab("Close Window");
0265:                rt.dOp.waitClosed();
0266:                try {
0267:                    Thread.sleep(100);
0268:                } catch (Exception ex) {
0269:                }
0270:                lastDiagramNode.tree().clickOnPath(
0271:                        lastDiagramNode.getTreePath(), 2);
0272:                try {
0273:                    Thread.sleep(100);
0274:                } catch (Exception ex) {
0275:                }
0276:                new DiagramOperator(diagramName);
0277:            }
0278:
0279:            public void testOpenExistingWithOpen() {
0280:                lastTestCase = getCurrentTestMethodName();
0281:                elCount++;
0282:                String diagramName = "testD" + elCount;
0283:                String workPkg = "pkg" + elCount;
0284:                //
0285:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
0286:                        .createDiagram(project, workPkg, diagramName,
0287:                                diagramType);
0288:                lastDiagramNode = rt.lastDiagramNode;
0289:                rt.dOp.close();
0290:                rt.dOp.waitClosed();
0291:                try {
0292:                    Thread.sleep(100);
0293:                } catch (Exception ex) {
0294:                }
0295:                lastDiagramNode.performPopupAction("Open");
0296:                try {
0297:                    Thread.sleep(100);
0298:                } catch (Exception ex) {
0299:                }
0300:                new DiagramOperator(diagramName);
0301:            }
0302:
0303:            public void testOpenExistingWithEnter() {
0304:                lastTestCase = getCurrentTestMethodName();
0305:                elCount++;
0306:                String diagramName = "testD" + elCount;
0307:                String workPkg = "pkg" + elCount;
0308:                //
0309:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
0310:                        .createDiagram(project, workPkg, diagramName,
0311:                                diagramType);
0312:                lastDiagramNode = rt.lastDiagramNode;
0313:                rt.dOp.close();
0314:                rt.dOp.waitClosed();
0315:                try {
0316:                    Thread.sleep(100);
0317:                } catch (Exception ex) {
0318:                }
0319:                lastDiagramNode.select();
0320:                lastDiagramNode.tree().waitSelected(
0321:                        lastDiagramNode.getTreePath());
0322:                lastDiagramNode.tree().pushKey(KeyEvent.VK_ENTER);
0323:                try {
0324:                    Thread.sleep(100);
0325:                } catch (Exception ex) {
0326:                }
0327:                new DiagramOperator(diagramName);
0328:            }
0329:
0330:            public void testChanges() {
0331:                lastTestCase = getCurrentTestMethodName();
0332:                elCount++;
0333:                String diagramName = "testD" + elCount;
0334:                String workPkg = "pkg" + elCount;
0335:                //
0336:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
0337:                        .createDiagram(project, workPkg, diagramName,
0338:                                diagramType);
0339:                lastDiagramNode = rt.lastDiagramNode;
0340:                rt.dOp.close();
0341:                rt.dOp.waitClosed();
0342:                try {
0343:                    Thread.sleep(100);
0344:                } catch (Exception ex) {
0345:                }
0346:                lastDiagramNode.performPopupAction("Open");
0347:                try {
0348:                    Thread.sleep(100);
0349:                } catch (Exception ex) {
0350:                }
0351:                DiagramOperator dr = new DiagramOperator(diagramName);
0352:                dr.putElementOnDiagram(elToPlaceName, elToPlace);
0353:                try {
0354:                    Thread.sleep(100);
0355:                } catch (Exception ex) {
0356:                }
0357:                JPopupMenuOperator pm = dr.callMenuOnTab();
0358:                JMenuItemOperator mi = new JMenuItemOperator(pm,
0359:                        "Save Document");
0360:                assertTrue("Save disabled", mi.isEnabled());
0361:                pm.pushKey(KeyEvent.VK_ESCAPE);
0362:                ContainerOperator tlb = MainWindowOperator.getDefault()
0363:                        .getToolbar("File");
0364:                JButtonOperator sa = MainWindowOperator.getDefault()
0365:                        .getToolbarButton(tlb, "Save All");
0366:                sa.waitState(new ChooseEnabledState(true));
0367:            }
0368:
0369:            public void testSaveChangesSaveAll() {
0370:                lastTestCase = getCurrentTestMethodName();
0371:                elCount++;
0372:                String diagramName = "testD" + elCount;
0373:                String workPkg = "pkg" + elCount;
0374:                //
0375:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
0376:                        .createDiagram(project, workPkg, diagramName,
0377:                                diagramType);
0378:                lastDiagramNode = rt.lastDiagramNode;
0379:                lastDiagramNode.expand();
0380:                lastDiagramNode.waitExpanded();
0381:                rt.dOp.close();
0382:                rt.dOp.waitClosed();
0383:                try {
0384:                    Thread.sleep(100);
0385:                } catch (Exception ex) {
0386:                }
0387:                lastDiagramNode.performPopupAction("Open");
0388:                try {
0389:                    Thread.sleep(100);
0390:                } catch (Exception ex) {
0391:                }
0392:                DiagramOperator dr = new DiagramOperator(diagramName);
0393:                dr.putElementOnDiagram(elToPlaceName, elToPlace);
0394:                try {
0395:                    Thread.sleep(100);
0396:                } catch (Exception ex) {
0397:                }
0398:                JPopupMenuOperator pm = dr.callMenuOnTab();
0399:                JMenuItemOperator mi = new JMenuItemOperator(pm,
0400:                        "Save Document");
0401:                assertTrue("Save disabled", mi.isEnabled());
0402:                pm.pushKey(KeyEvent.VK_ESCAPE);
0403:                ContainerOperator tlb = MainWindowOperator.getDefault()
0404:                        .getToolbar("File");
0405:                JButtonOperator sa = MainWindowOperator.getDefault()
0406:                        .getToolbarButton(tlb, "Save All");
0407:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
0408:                sa.push();
0409:                try {
0410:                    Thread.sleep(100);
0411:                } catch (Exception ex) {
0412:                }
0413:                sa.waitState(new ChooseEnabledState(false));
0414:                assertFalse("Save all toolbar button enabled after save ", sa
0415:                        .isEnabled());
0416:                dr.close();
0417:                try {
0418:                    Thread.sleep(100);
0419:                } catch (Exception ex) {
0420:                }
0421:                dr.waitClosed();
0422:                //
0423:                lastDiagramNode.performPopupAction("Open");
0424:                try {
0425:                    Thread.sleep(100);
0426:                } catch (Exception ex) {
0427:                }
0428:                dr = new DiagramOperator(diagramName);
0429:                new DiagramElementOperator(dr, elToPlaceName, elToPlace);
0430:                pm = dr.callMenuOnTab();
0431:                mi = new JMenuItemOperator(pm, "Save Document");
0432:                assertFalse("Save enabled", mi.isEnabled());
0433:                pm.pushKey(KeyEvent.VK_ESCAPE);
0434:                tlb = MainWindowOperator.getDefault().getToolbar("File");
0435:                sa = MainWindowOperator.getDefault().getToolbarButton(tlb,
0436:                        "Save All");
0437:                assertFalse("Save all toolbar button enabled", sa.isEnabled());
0438:            }
0439:
0440:            public void testSaveChangesSaveDocument() {
0441:                lastTestCase = getCurrentTestMethodName();
0442:                elCount++;
0443:                String diagramName = "testD" + elCount;
0444:                String workPkg = "pkg" + elCount;
0445:                //
0446:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
0447:                        .createDiagram(project, workPkg, diagramName,
0448:                                diagramType);
0449:                lastDiagramNode = rt.lastDiagramNode;
0450:                rt.dOp.close();
0451:                rt.dOp.waitClosed();
0452:                try {
0453:                    Thread.sleep(100);
0454:                } catch (Exception ex) {
0455:                }
0456:                lastDiagramNode.performPopupAction("Open");
0457:                try {
0458:                    Thread.sleep(100);
0459:                } catch (Exception ex) {
0460:                }
0461:                DiagramOperator dr = new DiagramOperator(diagramName);
0462:                dr.putElementOnDiagram(elToPlaceName, elToPlace);
0463:                try {
0464:                    Thread.sleep(100);
0465:                } catch (Exception ex) {
0466:                }
0467:                JPopupMenuOperator pm = dr.callMenuOnTab();
0468:                JMenuItemOperator mi = new JMenuItemOperator(pm,
0469:                        "Save Document");
0470:                assertTrue("Save disabled", mi.isEnabled());
0471:                pm.pushKey(KeyEvent.VK_ESCAPE);
0472:                ContainerOperator tlb = MainWindowOperator.getDefault()
0473:                        .getToolbar("File");
0474:                JButtonOperator sa = MainWindowOperator.getDefault()
0475:                        .getToolbarButton(tlb, "Save All");
0476:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
0477:                dr.callMenuOnTab().pushMenu("Save Document");
0478:                try {
0479:                    Thread.sleep(100);
0480:                } catch (Exception ex) {
0481:                }
0482:                //sa.waitState(new ChooseEnabledState(false));
0483:                pm = dr.callMenuOnTab();
0484:                mi = new JMenuItemOperator(pm, "Save Document");
0485:                assertFalse("Save enabled", mi.isEnabled());
0486:                pm.pushKey(KeyEvent.VK_ESCAPE);
0487:                try {
0488:                    Thread.sleep(100);
0489:                } catch (Exception ex) {
0490:                }
0491:                //assertFalse("Save all toolbar button enabled after save ",sa.isEnabled());
0492:                dr.close();
0493:                try {
0494:                    Thread.sleep(100);
0495:                } catch (Exception ex) {
0496:                }
0497:                dr.waitClosed();
0498:                //
0499:                lastDiagramNode.performPopupAction("Open");
0500:                try {
0501:                    Thread.sleep(100);
0502:                } catch (Exception ex) {
0503:                }
0504:                dr = new DiagramOperator(diagramName);
0505:                new DiagramElementOperator(dr, elToPlaceName, elToPlace);
0506:                pm = dr.callMenuOnTab();
0507:                mi = new JMenuItemOperator(pm, "Save Document");
0508:                assertFalse("Save enabled", mi.isEnabled());
0509:                pm.pushKey(KeyEvent.VK_ESCAPE);
0510:                tlb = MainWindowOperator.getDefault().getToolbar("File");
0511:                sa = MainWindowOperator.getDefault().getToolbarButton(tlb,
0512:                        "Save All");
0513:                assertTrue(
0514:                        "Save all toolbar button disabled when only diagram was saved",
0515:                        sa.isEnabled());
0516:            }
0517:
0518:            public void testSaveNewWithSaveDocument() {
0519:                lastTestCase = getCurrentTestMethodName();
0520:                elCount++;
0521:                String diagramName = "testD" + elCount;
0522:                String workPkg = "pkg" + elCount;
0523:                //
0524:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
0525:                        .createDiagram(project, workPkg, diagramName,
0526:                                diagramType);
0527:                lastDiagramNode = rt.lastDiagramNode;
0528:                DiagramOperator dr = new DiagramOperator(diagramName);
0529:                dr.putElementOnDiagram(elToPlaceName, elToPlace);
0530:                try {
0531:                    Thread.sleep(100);
0532:                } catch (Exception ex) {
0533:                }
0534:                JPopupMenuOperator pm = dr.callMenuOnTab();
0535:                JMenuItemOperator mi = new JMenuItemOperator(pm,
0536:                        "Save Document");
0537:                assertTrue("Save disabled", mi.isEnabled());
0538:                pm.pushKey(KeyEvent.VK_ESCAPE);
0539:                ContainerOperator tlb = MainWindowOperator.getDefault()
0540:                        .getToolbar("File");
0541:                JButtonOperator sa = MainWindowOperator.getDefault()
0542:                        .getToolbarButton(tlb, "Save All");
0543:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
0544:                dr.callMenuOnTab().pushMenu("Save Document");
0545:                try {
0546:                    Thread.sleep(100);
0547:                } catch (Exception ex) {
0548:                }
0549:                //sa.waitState(new ChooseEnabledState(false));
0550:                //assertFalse("Save all toolbar button enabled after save ",sa.isEnabled());
0551:                pm = dr.callMenuOnTab();
0552:                mi = new JMenuItemOperator(pm, "Save Document");
0553:                assertFalse("Save enabled", mi.isEnabled());
0554:                pm.pushKey(KeyEvent.VK_ESCAPE);
0555:                try {
0556:                    Thread.sleep(100);
0557:                } catch (Exception ex) {
0558:                }
0559:                dr.close();
0560:                try {
0561:                    Thread.sleep(100);
0562:                } catch (Exception ex) {
0563:                }
0564:                dr.waitClosed();
0565:                //
0566:                lastDiagramNode.performPopupAction("Open");
0567:                try {
0568:                    Thread.sleep(100);
0569:                } catch (Exception ex) {
0570:                }
0571:                dr = new DiagramOperator(diagramName);
0572:                new DiagramElementOperator(dr, elToPlaceName, elToPlace);
0573:                pm = dr.callMenuOnTab();
0574:                mi = new JMenuItemOperator(pm, "Save Document");
0575:                assertFalse("Save enabled", mi.isEnabled());
0576:                pm.pushKey(KeyEvent.VK_ESCAPE);
0577:                tlb = MainWindowOperator.getDefault().getToolbar("File");
0578:                sa = MainWindowOperator.getDefault().getToolbarButton(tlb,
0579:                        "Save All");
0580:                assertTrue(
0581:                        "Save all toolbar button enabled when only diagram was saved",
0582:                        sa.isEnabled());
0583:            }
0584:
0585:            public void testSaveChangesAfterCloseDocument() {
0586:                lastTestCase = getCurrentTestMethodName();
0587:                elCount++;
0588:                String diagramName = "testD" + elCount;
0589:                String workPkg = "pkg" + elCount;
0590:                //
0591:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
0592:                        .createDiagram(project, workPkg, diagramName,
0593:                                diagramType);
0594:                lastDiagramNode = rt.lastDiagramNode;
0595:                rt.dOp.close();
0596:                rt.dOp.waitClosed();
0597:                try {
0598:                    Thread.sleep(100);
0599:                } catch (Exception ex) {
0600:                }
0601:                lastDiagramNode.performPopupAction("Open");
0602:                try {
0603:                    Thread.sleep(100);
0604:                } catch (Exception ex) {
0605:                }
0606:                final DiagramOperator dr = new DiagramOperator(diagramName);
0607:                dr.putElementOnDiagram(elToPlaceName, elToPlace);
0608:                try {
0609:                    Thread.sleep(100);
0610:                } catch (Exception ex) {
0611:                }
0612:                JPopupMenuOperator pm = dr.callMenuOnTab();
0613:                JMenuItemOperator mi = new JMenuItemOperator(pm,
0614:                        "Save Document");
0615:                assertTrue("Save disabled", mi.isEnabled());
0616:                pm.pushKey(KeyEvent.VK_ESCAPE);
0617:                ContainerOperator tlb = MainWindowOperator.getDefault()
0618:                        .getToolbar("File");
0619:                JButtonOperator sa = MainWindowOperator.getDefault()
0620:                        .getToolbarButton(tlb, "Save All");
0621:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
0622:                new Thread() {
0623:                    public void run() {
0624:                        dr.close();//I hope should be similar to cross pressing
0625:                    }
0626:                }.start();
0627:                try {
0628:                    Thread.sleep(100);
0629:                } catch (Exception ex) {
0630:                }
0631:                new Thread() {
0632:                    public void run() {
0633:                        new JButtonOperator(new JDialogOperator("Save"), "Save")
0634:                                .push();
0635:                    }
0636:                }.start();
0637:                dr.waitClosed();
0638:                sa.waitState(new ChooseEnabledState(true));
0639:                //
0640:                lastDiagramNode.performPopupAction("Open");
0641:                try {
0642:                    Thread.sleep(100);
0643:                } catch (Exception ex) {
0644:                }
0645:                DiagramOperator dr2 = new DiagramOperator(diagramName);
0646:                new DiagramElementOperator(dr2, elToPlaceName, elToPlace);
0647:                pm = dr2.callMenuOnTab();
0648:                mi = new JMenuItemOperator(pm, "Save Document");
0649:                assertFalse("Save disabled", mi.isEnabled());
0650:                pm.pushKey(KeyEvent.VK_ESCAPE);
0651:            }
0652:
0653:            public void testSaveChangesAfterCloseAll() {
0654:                lastTestCase = getCurrentTestMethodName();
0655:                elCount++;
0656:                String diagramName = "testD" + elCount;
0657:                String workPkg = "pkg" + elCount;
0658:                //
0659:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
0660:                        .createDiagram(project, workPkg, diagramName,
0661:                                diagramType);
0662:                lastDiagramNode = rt.lastDiagramNode;
0663:                rt.dOp.close();
0664:                rt.dOp.waitClosed();
0665:                try {
0666:                    Thread.sleep(100);
0667:                } catch (Exception ex) {
0668:                }
0669:                lastDiagramNode.performPopupAction("Open");
0670:                try {
0671:                    Thread.sleep(100);
0672:                } catch (Exception ex) {
0673:                }
0674:                final DiagramOperator dr = new DiagramOperator(diagramName);
0675:                dr.putElementOnDiagram(elToPlaceName, elToPlace);
0676:                try {
0677:                    Thread.sleep(100);
0678:                } catch (Exception ex) {
0679:                }
0680:                JPopupMenuOperator pm = dr.callMenuOnTab();
0681:                JMenuItemOperator mi = new JMenuItemOperator(pm,
0682:                        "Save Document");
0683:                assertTrue("Save disabled", mi.isEnabled());
0684:                pm.pushKey(KeyEvent.VK_ESCAPE);
0685:                ContainerOperator tlb = MainWindowOperator.getDefault()
0686:                        .getToolbar("File");
0687:                JButtonOperator sa = MainWindowOperator.getDefault()
0688:                        .getToolbarButton(tlb, "Save All");
0689:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
0690:                new Thread() {
0691:                    public void run() {
0692:                        dr.pushMenuOnTab("Close All Documents");
0693:                    }
0694:                }.start();
0695:                try {
0696:                    Thread.sleep(100);
0697:                } catch (Exception ex) {
0698:                }
0699:                new Thread() {
0700:                    public void run() {
0701:                        new JButtonOperator(new JDialogOperator("Save"), "Save")
0702:                                .push();
0703:                    }
0704:                }.start();
0705:                dr.waitClosed();
0706:                sa.waitState(new ChooseEnabledState(true));
0707:                //
0708:                lastDiagramNode.performPopupAction("Open");
0709:                try {
0710:                    Thread.sleep(100);
0711:                } catch (Exception ex) {
0712:                }
0713:                DiagramOperator dr2 = new DiagramOperator(diagramName);
0714:                new DiagramElementOperator(dr2, elToPlaceName, elToPlace);
0715:                pm = dr2.callMenuOnTab();
0716:                mi = new JMenuItemOperator(pm, "Save Document");
0717:                assertFalse("Save disabled", mi.isEnabled());
0718:                pm.pushKey(KeyEvent.VK_ESCAPE);
0719:            }
0720:
0721:            public void testSaveChangesAfterCloseWindow() {
0722:                lastTestCase = getCurrentTestMethodName();
0723:                elCount++;
0724:                String diagramName = "testD" + elCount;
0725:                String workPkg = "pkg" + elCount;
0726:                //
0727:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
0728:                        .createDiagram(project, workPkg, diagramName,
0729:                                diagramType);
0730:                lastDiagramNode = rt.lastDiagramNode;
0731:                rt.dOp.close();
0732:                rt.dOp.waitClosed();
0733:                try {
0734:                    Thread.sleep(100);
0735:                } catch (Exception ex) {
0736:                }
0737:                lastDiagramNode.performPopupAction("Open");
0738:                try {
0739:                    Thread.sleep(100);
0740:                } catch (Exception ex) {
0741:                }
0742:                final DiagramOperator dr = new DiagramOperator(diagramName);
0743:                dr.putElementOnDiagram(elToPlaceName, elToPlace);
0744:                try {
0745:                    Thread.sleep(100);
0746:                } catch (Exception ex) {
0747:                }
0748:                JPopupMenuOperator pm = dr.callMenuOnTab();
0749:                JMenuItemOperator mi = new JMenuItemOperator(pm,
0750:                        "Save Document");
0751:                assertTrue("Save disabled", mi.isEnabled());
0752:                pm.pushKey(KeyEvent.VK_ESCAPE);
0753:                ContainerOperator tlb = MainWindowOperator.getDefault()
0754:                        .getToolbar("File");
0755:                JButtonOperator sa = MainWindowOperator.getDefault()
0756:                        .getToolbarButton(tlb, "Save All");
0757:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
0758:                new Thread() {
0759:                    public void run() {
0760:                        dr.pushMenuOnTab("Close Window");
0761:                    }
0762:                }.start();
0763:                try {
0764:                    Thread.sleep(100);
0765:                } catch (Exception ex) {
0766:                }
0767:                new Thread() {
0768:                    public void run() {
0769:                        new JButtonOperator(new JDialogOperator("Save"), "Save")
0770:                                .push();
0771:                    }
0772:                }.start();
0773:                dr.waitClosed();
0774:                sa.waitState(new ChooseEnabledState(true));
0775:                //
0776:                lastDiagramNode.performPopupAction("Open");
0777:                try {
0778:                    Thread.sleep(100);
0779:                } catch (Exception ex) {
0780:                }
0781:                DiagramOperator dr2 = new DiagramOperator(diagramName);
0782:                new DiagramElementOperator(dr2, elToPlaceName, elToPlace);
0783:                pm = dr2.callMenuOnTab();
0784:                mi = new JMenuItemOperator(pm, "Save Document");
0785:                assertFalse("Save disabled", mi.isEnabled());
0786:                pm.pushKey(KeyEvent.VK_ESCAPE);
0787:            }
0788:
0789:            public void testSaveNewAfterCloseWindow() {
0790:                lastTestCase = getCurrentTestMethodName();
0791:                elCount++;
0792:                String diagramName = "testD" + elCount;
0793:                String workPkg = "pkg" + elCount;
0794:                //
0795:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
0796:                        .createDiagram(project, workPkg, diagramName,
0797:                                diagramType);
0798:                lastDiagramNode = rt.lastDiagramNode;
0799:                try {
0800:                    Thread.sleep(100);
0801:                } catch (Exception ex) {
0802:                }
0803:                final DiagramOperator dr = new DiagramOperator(diagramName);
0804:                dr.putElementOnDiagram(elToPlaceName, elToPlace);
0805:                try {
0806:                    Thread.sleep(100);
0807:                } catch (Exception ex) {
0808:                }
0809:                JPopupMenuOperator pm = dr.callMenuOnTab();
0810:                JMenuItemOperator mi = new JMenuItemOperator(pm,
0811:                        "Save Document");
0812:                assertTrue("Save disabled", mi.isEnabled());
0813:                pm.pushKey(KeyEvent.VK_ESCAPE);
0814:                ContainerOperator tlb = MainWindowOperator.getDefault()
0815:                        .getToolbar("File");
0816:                JButtonOperator sa = MainWindowOperator.getDefault()
0817:                        .getToolbarButton(tlb, "Save All");
0818:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
0819:                new Thread() {
0820:                    public void run() {
0821:                        dr.pushMenuOnTab("Close Window");
0822:                    }
0823:                }.start();
0824:                try {
0825:                    Thread.sleep(100);
0826:                } catch (Exception ex) {
0827:                }
0828:                new Thread() {
0829:                    public void run() {
0830:                        new JButtonOperator(new JDialogOperator("Save"), "Save")
0831:                                .push();
0832:                    }
0833:                }.start();
0834:                dr.waitClosed();
0835:                sa.waitState(new ChooseEnabledState(true));
0836:                //
0837:                lastDiagramNode.performPopupAction("Open");
0838:                try {
0839:                    Thread.sleep(100);
0840:                } catch (Exception ex) {
0841:                }
0842:                DiagramOperator dr2 = new DiagramOperator(diagramName);
0843:                new DiagramElementOperator(dr2, elToPlaceName, elToPlace);
0844:                pm = dr2.callMenuOnTab();
0845:                mi = new JMenuItemOperator(pm, "Save Document");
0846:                assertFalse("Save disabled", mi.isEnabled());
0847:                pm.pushKey(KeyEvent.VK_ESCAPE);
0848:            }
0849:
0850:            public void testDontSaveNewAfterCloseWindow() {
0851:                lastTestCase = getCurrentTestMethodName();
0852:                elCount++;
0853:                String diagramName = "testD" + elCount;
0854:                String workPkg = "pkg" + elCount;
0855:                //
0856:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
0857:                        .createDiagram(project, workPkg, diagramName,
0858:                                diagramType);
0859:                lastDiagramNode = rt.lastDiagramNode;
0860:                try {
0861:                    Thread.sleep(100);
0862:                } catch (Exception ex) {
0863:                }
0864:                final DiagramOperator dr = new DiagramOperator(diagramName);
0865:                dr.putElementOnDiagram(elToPlaceName, elToPlace);
0866:                try {
0867:                    Thread.sleep(100);
0868:                } catch (Exception ex) {
0869:                }
0870:                JPopupMenuOperator pm = dr.callMenuOnTab();
0871:                JMenuItemOperator mi = new JMenuItemOperator(pm,
0872:                        "Save Document");
0873:                assertTrue("Save disabled", mi.isEnabled());
0874:                pm.pushKey(KeyEvent.VK_ESCAPE);
0875:                ContainerOperator tlb = MainWindowOperator.getDefault()
0876:                        .getToolbar("File");
0877:                JButtonOperator sa = MainWindowOperator.getDefault()
0878:                        .getToolbarButton(tlb, "Save All");
0879:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
0880:                new Thread() {
0881:                    public void run() {
0882:                        dr.pushMenuOnTab("Close Window");
0883:                    }
0884:                }.start();
0885:                try {
0886:                    Thread.sleep(100);
0887:                } catch (Exception ex) {
0888:                }
0889:                new Thread() {
0890:                    public void run() {
0891:                        new JButtonOperator(new JDialogOperator("Save"),
0892:                                "Discard").push();
0893:                    }
0894:                }.start();
0895:                dr.waitClosed();
0896:                sa.waitState(new ChooseEnabledState(true));
0897:                //
0898:                lastDiagramNode.performPopupAction("Open");
0899:                try {
0900:                    Thread.sleep(100);
0901:                } catch (Exception ex) {
0902:                }
0903:                DiagramOperator dr2 = new DiagramOperator(diagramName);
0904:                try {
0905:                    new DiagramElementOperator(dr2, elToPlaceName, elToPlace);
0906:                    fail("Element is found on diagram after No to save");
0907:                } catch (Exception ex) {
0908:                    //good
0909:                }
0910:                pm = dr2.callMenuOnTab();
0911:                mi = new JMenuItemOperator(pm, "Save Document");
0912:                assertFalse("Save disabled", mi.isEnabled());
0913:                pm.pushKey(KeyEvent.VK_ESCAPE);
0914:            }
0915:
0916:            public void testSaveNewWithCtrlS() {
0917:                lastTestCase = getCurrentTestMethodName();
0918:                elCount++;
0919:                String diagramName = "testD" + elCount;
0920:                String workPkg = "pkg" + elCount;
0921:                //
0922:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
0923:                        .createDiagram(project, workPkg, diagramName,
0924:                                diagramType);
0925:                lastDiagramNode = rt.lastDiagramNode;
0926:                DiagramOperator dr = new DiagramOperator(diagramName);
0927:                dr.putElementOnDiagram(elToPlaceName, elToPlace);
0928:                try {
0929:                    Thread.sleep(100);
0930:                } catch (Exception ex) {
0931:                }
0932:                JPopupMenuOperator pm = dr.callMenuOnTab();
0933:                JMenuItemOperator mi = new JMenuItemOperator(pm,
0934:                        "Save Document");
0935:                assertTrue("Save disabled", mi.isEnabled());
0936:                pm.pushKey(KeyEvent.VK_ESCAPE);
0937:                pm.waitComponentShowing(false);
0938:                try {
0939:                    Thread.sleep(100);
0940:                } catch (Exception ex) {
0941:                }
0942:                ContainerOperator tlb = MainWindowOperator.getDefault()
0943:                        .getToolbar("File");
0944:                JButtonOperator sa = MainWindowOperator.getDefault()
0945:                        .getToolbarButton(tlb, "Save All");
0946:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
0947:                dr.pushKey(KeyEvent.VK_S, KeyEvent.CTRL_MASK);
0948:                try {
0949:                    Thread.sleep(100);
0950:                } catch (Exception ex) {
0951:                }
0952:                //sa.waitState(new ChooseEnabledState(false));
0953:                //assertFalse("Save all toolbar button enabled after save ",sa.isEnabled());
0954:                pm = dr.callMenuOnTab();
0955:                mi = new JMenuItemOperator(pm, "Save Document");
0956:                assertFalse("Save enabled", mi.isEnabled());
0957:                pm.pushKey(KeyEvent.VK_ESCAPE);
0958:                try {
0959:                    Thread.sleep(100);
0960:                } catch (Exception ex) {
0961:                }
0962:                dr.close();
0963:                try {
0964:                    Thread.sleep(100);
0965:                } catch (Exception ex) {
0966:                }
0967:                dr.waitClosed();
0968:                //
0969:                lastDiagramNode.performPopupAction("Open");
0970:                try {
0971:                    Thread.sleep(100);
0972:                } catch (Exception ex) {
0973:                }
0974:                dr = new DiagramOperator(diagramName);
0975:                new DiagramElementOperator(dr, elToPlaceName, elToPlace);
0976:                pm = dr.callMenuOnTab();
0977:                mi = new JMenuItemOperator(pm, "Save Document");
0978:                assertFalse("Save enabled", mi.isEnabled());
0979:                pm.pushKey(KeyEvent.VK_ESCAPE);
0980:                tlb = MainWindowOperator.getDefault().getToolbar("File");
0981:                sa = MainWindowOperator.getDefault().getToolbarButton(tlb,
0982:                        "Save All");
0983:                assertTrue(
0984:                        "Save all toolbar button enabled when only diagram was saved",
0985:                        sa.isEnabled());
0986:            }
0987:
0988:            public void testCancelClose() {
0989:                lastTestCase = getCurrentTestMethodName();
0990:                elCount++;
0991:                String diagramName = "testD" + elCount;
0992:                String workPkg = "pkg" + elCount;
0993:                //
0994:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
0995:                        .createDiagram(project, workPkg, diagramName,
0996:                                diagramType);
0997:                lastDiagramNode = rt.lastDiagramNode;
0998:                try {
0999:                    Thread.sleep(100);
1000:                } catch (Exception ex) {
1001:                }
1002:                final DiagramOperator dr = new DiagramOperator(diagramName);
1003:                dr.putElementOnDiagram(elToPlaceName, elToPlace);
1004:                try {
1005:                    Thread.sleep(100);
1006:                } catch (Exception ex) {
1007:                }
1008:                JPopupMenuOperator pm = dr.callMenuOnTab();
1009:                JMenuItemOperator mi = new JMenuItemOperator(pm,
1010:                        "Save Document");
1011:                assertTrue("Save disabled", mi.isEnabled());
1012:                pm.pushKey(KeyEvent.VK_ESCAPE);
1013:                ContainerOperator tlb = MainWindowOperator.getDefault()
1014:                        .getToolbar("File");
1015:                JButtonOperator sa = MainWindowOperator.getDefault()
1016:                        .getToolbarButton(tlb, "Save All");
1017:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
1018:                new Thread() {
1019:                    public void run() {
1020:                        dr.pushMenuOnTab("Close Window");
1021:                    }
1022:                }.start();
1023:                try {
1024:                    Thread.sleep(100);
1025:                } catch (Exception ex) {
1026:                }
1027:                new Thread() {
1028:                    public void run() {
1029:                        new JButtonOperator(new JDialogOperator("Save"),
1030:                                "Cancel").push();
1031:                    }
1032:                }.start();
1033:                try {
1034:                    dr.waitClosed();
1035:                    fail("Diagram was closed after cancel in save dialog");
1036:                } catch (Exception ex) {
1037:                    //good
1038:                }
1039:                //
1040:                sa.waitState(new ChooseEnabledState(true));
1041:                //
1042:                DiagramOperator dr2 = new DiagramOperator(diagramName);
1043:                new DiagramElementOperator(dr2, elToPlaceName, elToPlace);
1044:                pm = dr2.callMenuOnTab();
1045:                mi = new JMenuItemOperator(pm, "Save Document");
1046:                assertTrue("Save disabled", mi.isEnabled());
1047:                pm.pushKey(KeyEvent.VK_ESCAPE);
1048:            }
1049:
1050:            public void testCrossInSaveOnClose() {
1051:                lastTestCase = getCurrentTestMethodName();
1052:                elCount++;
1053:                String diagramName = "testD" + elCount;
1054:                String workPkg = "pkg" + elCount;
1055:                //
1056:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
1057:                        .createDiagram(project, workPkg, diagramName,
1058:                                diagramType);
1059:                lastDiagramNode = rt.lastDiagramNode;
1060:                try {
1061:                    Thread.sleep(100);
1062:                } catch (Exception ex) {
1063:                }
1064:                final DiagramOperator dr = new DiagramOperator(diagramName);
1065:                dr.putElementOnDiagram(elToPlaceName, elToPlace);
1066:                try {
1067:                    Thread.sleep(100);
1068:                } catch (Exception ex) {
1069:                }
1070:                JPopupMenuOperator pm = dr.callMenuOnTab();
1071:                JMenuItemOperator mi = new JMenuItemOperator(pm,
1072:                        "Save Document");
1073:                assertTrue("Save disabled", mi.isEnabled());
1074:                pm.pushKey(KeyEvent.VK_ESCAPE);
1075:                ContainerOperator tlb = MainWindowOperator.getDefault()
1076:                        .getToolbar("File");
1077:                JButtonOperator sa = MainWindowOperator.getDefault()
1078:                        .getToolbarButton(tlb, "Save All");
1079:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
1080:                new Thread() {
1081:                    public void run() {
1082:                        dr.pushMenuOnTab("Close Window");
1083:                    }
1084:                }.start();
1085:                try {
1086:                    Thread.sleep(100);
1087:                } catch (Exception ex) {
1088:                }
1089:                JDialogOperator dlg = new JDialogOperator("Save");
1090:                dlg.close();//is it the same as cross?
1091:                dlg.waitClosed();
1092:                try {
1093:                    dr.waitClosed();
1094:                    fail("Diagram was closed after cancel in save dialog");
1095:                } catch (Exception ex) {
1096:                    //good
1097:                }
1098:                //
1099:                sa.waitState(new ChooseEnabledState(true));
1100:                //
1101:                DiagramOperator dr2 = new DiagramOperator(diagramName);
1102:                new DiagramElementOperator(dr2, elToPlaceName, elToPlace);
1103:                pm = dr2.callMenuOnTab();
1104:                mi = new JMenuItemOperator(pm, "Save Document");
1105:                assertTrue("Save disabled", mi.isEnabled());
1106:                pm.pushKey(KeyEvent.VK_ESCAPE);
1107:            }
1108:
1109:            //
1110:            public void testSaveNewSeveralDiagramsSaveAll() {
1111:                lastTestCase = getCurrentTestMethodName();
1112:                elCount++;
1113:                String diagramName = "testD" + elCount;
1114:                String workPkg = "pkg" + elCount;
1115:                //
1116:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
1117:                        .createDiagram(project, workPkg, diagramName + "_1",
1118:                                diagramType);
1119:                lastDiagramNode = rt.lastDiagramNode;
1120:                try {
1121:                    Thread.sleep(100);
1122:                } catch (Exception ex) {
1123:                }
1124:                DiagramOperator dr = new DiagramOperator(diagramName + "_1");
1125:                dr.putElementOnDiagram(elToPlaceName, elToPlace);
1126:                try {
1127:                    Thread.sleep(100);
1128:                } catch (Exception ex) {
1129:                }
1130:                JPopupMenuOperator pm = dr.callMenuOnTab();
1131:                JMenuItemOperator mi = new JMenuItemOperator(pm,
1132:                        "Save Document");
1133:                assertTrue("Save disabled", mi.isEnabled());
1134:                pm.pushKey(KeyEvent.VK_ESCAPE);
1135:                ContainerOperator tlb = MainWindowOperator.getDefault()
1136:                        .getToolbar("File");
1137:                JButtonOperator sa = MainWindowOperator.getDefault()
1138:                        .getToolbarButton(tlb, "Save All");
1139:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
1140:                //2nd
1141:                org.netbeans.test.umllib.Utils.RetAll rt2 = org.netbeans.test.umllib.Utils
1142:                        .createDiagram(project, workPkg, diagramName + "_2",
1143:                                diagramType);
1144:                dr = new DiagramOperator(diagramName + "_2");
1145:                dr.putElementOnDiagram(elToPlaceName, elToPlace);
1146:                try {
1147:                    Thread.sleep(100);
1148:                } catch (Exception ex) {
1149:                }
1150:                pm = dr.callMenuOnTab();
1151:                mi = new JMenuItemOperator(pm, "Save Document");
1152:                assertTrue("Save disabled", mi.isEnabled());
1153:                pm.pushKey(KeyEvent.VK_ESCAPE);
1154:                tlb = MainWindowOperator.getDefault().getToolbar("File");
1155:                sa = MainWindowOperator.getDefault().getToolbarButton(tlb,
1156:                        "Save All");
1157:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
1158:                //
1159:                sa.push();
1160:                try {
1161:                    Thread.sleep(100);
1162:                } catch (Exception ex) {
1163:                }
1164:                sa.waitState(new ChooseEnabledState(false));
1165:                assertFalse("Save all toolbar button enabled after save ", sa
1166:                        .isEnabled());
1167:                dr.closeAllDocuments();
1168:                try {
1169:                    Thread.sleep(100);
1170:                } catch (Exception ex) {
1171:                }
1172:                dr.waitClosed();
1173:                //
1174:                lastDiagramNode.performPopupAction("Open");
1175:                try {
1176:                    Thread.sleep(100);
1177:                } catch (Exception ex) {
1178:                }
1179:                dr = new DiagramOperator(diagramName + "_1");
1180:                new DiagramElementOperator(dr, elToPlaceName, elToPlace);
1181:                pm = dr.callMenuOnTab();
1182:                mi = new JMenuItemOperator(pm, "Save Document");
1183:                assertFalse("Save enabled", mi.isEnabled());
1184:                pm.pushKey(KeyEvent.VK_ESCAPE);
1185:                tlb = MainWindowOperator.getDefault().getToolbar("File");
1186:                sa = MainWindowOperator.getDefault().getToolbarButton(tlb,
1187:                        "Save All");
1188:                assertFalse("Save all toolbar button enabled", sa.isEnabled());
1189:                rt2.lastDiagramNode.performPopupAction("Open");
1190:                try {
1191:                    Thread.sleep(100);
1192:                } catch (Exception ex) {
1193:                }
1194:                dr = new DiagramOperator(diagramName + "_2");
1195:                new DiagramElementOperator(dr, elToPlaceName, elToPlace);
1196:                pm = dr.callMenuOnTab();
1197:                mi = new JMenuItemOperator(pm, "Save Document");
1198:                assertFalse("Save enabled", mi.isEnabled());
1199:                pm.pushKey(KeyEvent.VK_ESCAPE);
1200:                tlb = MainWindowOperator.getDefault().getToolbar("File");
1201:                sa = MainWindowOperator.getDefault().getToolbarButton(tlb,
1202:                        "Save All");
1203:                assertFalse("Save all toolbar button enabled", sa.isEnabled());
1204:            }
1205:
1206:            //
1207:            public void testSaveByOneAfterCloseAll() {
1208:                lastTestCase = getCurrentTestMethodName();
1209:                elCount++;
1210:                String diagramName = "testD" + elCount;
1211:                String workPkg = "pkg" + elCount;
1212:                //
1213:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
1214:                        .createDiagram(project, workPkg, diagramName + "_1",
1215:                                diagramType);
1216:                lastDiagramNode = rt.lastDiagramNode;
1217:                try {
1218:                    Thread.sleep(100);
1219:                } catch (Exception ex) {
1220:                }
1221:                DiagramOperator dr = new DiagramOperator(diagramName + "_1");
1222:                dr.putElementOnDiagram(elToPlaceName, elToPlace);
1223:                try {
1224:                    Thread.sleep(100);
1225:                } catch (Exception ex) {
1226:                }
1227:                JPopupMenuOperator pm = dr.callMenuOnTab();
1228:                JMenuItemOperator mi = new JMenuItemOperator(pm,
1229:                        "Save Document");
1230:                assertTrue("Save disabled", mi.isEnabled());
1231:                pm.pushKey(KeyEvent.VK_ESCAPE);
1232:                ContainerOperator tlb = MainWindowOperator.getDefault()
1233:                        .getToolbar("File");
1234:                JButtonOperator sa = MainWindowOperator.getDefault()
1235:                        .getToolbarButton(tlb, "Save All");
1236:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
1237:                //2nd
1238:                org.netbeans.test.umllib.Utils.RetAll rt2 = org.netbeans.test.umllib.Utils
1239:                        .createDiagram(project, workPkg, diagramName + "_2",
1240:                                diagramType);
1241:                dr = new DiagramOperator(diagramName + "_2");
1242:                dr.putElementOnDiagram(elToPlaceName, elToPlace);
1243:                try {
1244:                    Thread.sleep(100);
1245:                } catch (Exception ex) {
1246:                }
1247:                pm = dr.callMenuOnTab();
1248:                mi = new JMenuItemOperator(pm, "Save Document");
1249:                assertTrue("Save disabled", mi.isEnabled());
1250:                pm.pushKey(KeyEvent.VK_ESCAPE);
1251:                tlb = MainWindowOperator.getDefault().getToolbar("File");
1252:                sa = MainWindowOperator.getDefault().getToolbarButton(tlb,
1253:                        "Save All");
1254:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
1255:                //
1256:                final DiagramOperator drCl = dr;
1257:                new Thread() {
1258:                    public void run() {
1259:                        drCl.closeAllDocuments();
1260:                    }
1261:                }.start();
1262:                JDialogOperator dlg = new JDialogOperator("Save");
1263:                JButtonOperator btn = new JButtonOperator(dlg, "Save");
1264:                btn.pushNoBlock();
1265:                dlg.waitClosed();
1266:                try {
1267:                    Thread.sleep(100);
1268:                } catch (Exception ex) {
1269:                }
1270:                dlg = new JDialogOperator("Save");
1271:                btn = new JButtonOperator(dlg, "Save");
1272:                btn.push();
1273:                dlg.waitClosed();
1274:                try {
1275:                    Thread.sleep(100);
1276:                } catch (Exception ex) {
1277:                }
1278:                dr.waitClosed();
1279:                try {
1280:                    Thread.sleep(100);
1281:                } catch (Exception ex) {
1282:                }
1283:                //
1284:                lastDiagramNode.performPopupAction("Open");
1285:                try {
1286:                    Thread.sleep(100);
1287:                } catch (Exception ex) {
1288:                }
1289:                dr = new DiagramOperator(diagramName + "_1");
1290:                new DiagramElementOperator(dr, elToPlaceName, elToPlace);
1291:                pm = dr.callMenuOnTab();
1292:                mi = new JMenuItemOperator(pm, "Save Document");
1293:                assertFalse("Save enabled", mi.isEnabled());
1294:                pm.pushKey(KeyEvent.VK_ESCAPE);
1295:                tlb = MainWindowOperator.getDefault().getToolbar("File");
1296:                sa = MainWindowOperator.getDefault().getToolbarButton(tlb,
1297:                        "Save All");
1298:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
1299:                rt2.lastDiagramNode.performPopupAction("Open");
1300:                try {
1301:                    Thread.sleep(100);
1302:                } catch (Exception ex) {
1303:                }
1304:                dr = new DiagramOperator(diagramName + "_2");
1305:                new DiagramElementOperator(dr, elToPlaceName, elToPlace);
1306:                pm = dr.callMenuOnTab();
1307:                mi = new JMenuItemOperator(pm, "Save Document");
1308:                assertFalse("Save enabled", mi.isEnabled());
1309:                pm.pushKey(KeyEvent.VK_ESCAPE);
1310:                tlb = MainWindowOperator.getDefault().getToolbar("File");
1311:                sa = MainWindowOperator.getDefault().getToolbarButton(tlb,
1312:                        "Save All");
1313:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
1314:            }
1315:
1316:            public void testDeleteEmptyNewDiagram() {
1317:                lastTestCase = getCurrentTestMethodName();
1318:                elCount++;
1319:                String diagramName = "testD" + elCount;
1320:                String workPkg = "pkg" + elCount;
1321:                //
1322:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
1323:                        .createDiagram(project, workPkg, diagramName,
1324:                                diagramType);
1325:                lastDiagramNode = rt.lastDiagramNode;
1326:                DiagramOperator dr = new DiagramOperator(diagramName);
1327:                JPopupMenuOperator pm = dr.callMenuOnTab();
1328:                JMenuItemOperator mi = new JMenuItemOperator(pm,
1329:                        "Save Document");
1330:                assertFalse("Save enabled", mi.isEnabled());
1331:                pm.pushKey(KeyEvent.VK_ESCAPE);
1332:                ContainerOperator tlb = MainWindowOperator.getDefault()
1333:                        .getToolbar("File");
1334:                JButtonOperator sa = MainWindowOperator.getDefault()
1335:                        .getToolbarButton(tlb, "Save All");
1336:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
1337:                final Node lastDiagramNode2 = lastDiagramNode;
1338:                new Thread() {
1339:                    public void run() {
1340:                        JPopupMenuOperator pop = lastDiagramNode2.callPopup();
1341:                        org.netbeans.test.umllib.util.Utils
1342:                                .makeScreenShotCustom(childClassName,
1343:                                        lastTestCase, "beforeClick");
1344:                        pop.pushMenu("Delete");
1345:                    }
1346:                }.start();
1347:                new JButtonOperator(new JDialogOperator(
1348:                        "Confirm Object Deletion"), "Yes").push();
1349:                try {
1350:                    Thread.sleep(100);
1351:                } catch (Exception ex) {
1352:                }
1353:                dr.waitClosed();
1354:                lastDiagramNode.waitNotPresent();
1355:                //
1356:                tlb = MainWindowOperator.getDefault().getToolbar("File");
1357:                sa = MainWindowOperator.getDefault().getToolbarButton(tlb,
1358:                        "Save All");
1359:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
1360:            }
1361:
1362:            public void testDeleteModifiedDiagram() {
1363:                lastTestCase = getCurrentTestMethodName();
1364:                elCount++;
1365:                String diagramName = "testD" + elCount;
1366:                String workPkg = "pkg" + elCount;
1367:                //
1368:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
1369:                        .createDiagram(project, workPkg, diagramName,
1370:                                diagramType);
1371:                lastDiagramNode = rt.lastDiagramNode;
1372:                rt.dOp.close();
1373:                rt.dOp.waitClosed();
1374:                try {
1375:                    Thread.sleep(100);
1376:                } catch (Exception ex) {
1377:                }
1378:                lastDiagramNode.performPopupAction("Open");
1379:                try {
1380:                    Thread.sleep(100);
1381:                } catch (Exception ex) {
1382:                }
1383:                DiagramOperator dr = new DiagramOperator(diagramName);
1384:                dr.putElementOnDiagram(elToPlaceName, elToPlace);
1385:                try {
1386:                    Thread.sleep(100);
1387:                } catch (Exception ex) {
1388:                }
1389:                JPopupMenuOperator pm = dr.callMenuOnTab();
1390:                JMenuItemOperator mi = new JMenuItemOperator(pm,
1391:                        "Save Document");
1392:                assertTrue("Save disabled", mi.isEnabled());
1393:                pm.pushKey(KeyEvent.VK_ESCAPE);
1394:                ContainerOperator tlb = MainWindowOperator.getDefault()
1395:                        .getToolbar("File");
1396:                JButtonOperator sa = MainWindowOperator.getDefault()
1397:                        .getToolbarButton(tlb, "Save All");
1398:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
1399:                final Node lastDiagramNode2 = lastDiagramNode;
1400:                new Thread() {
1401:                    public void run() {
1402:                        JPopupMenuOperator pop = lastDiagramNode2.callPopup();
1403:                        org.netbeans.test.umllib.util.Utils
1404:                                .makeScreenShotCustom(childClassName,
1405:                                        lastTestCase, "beforeClick");
1406:                        pop.pushMenu("Delete");
1407:                    }
1408:                }.start();
1409:                new JButtonOperator(new JDialogOperator(
1410:                        "Confirm Object Deletion"), "Yes").push();
1411:                try {
1412:                    Thread.sleep(100);
1413:                } catch (Exception ex) {
1414:                }
1415:                dr.waitClosed();
1416:                lastDiagramNode.waitNotPresent();
1417:                //
1418:                tlb = MainWindowOperator.getDefault().getToolbar("File");
1419:                sa = MainWindowOperator.getDefault().getToolbarButton(tlb,
1420:                        "Save All");
1421:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
1422:            }
1423:
1424:            //
1425:            /**
1426:             * It's good if it will be last for saving checks because preferences are changed by pressing Save Always
1427:             */
1428:            public void testSaveAllAfterCloseAll() {
1429:                lastTestCase = getCurrentTestMethodName();
1430:                elCount++;
1431:                String diagramName = "testD" + elCount;
1432:                String workPkg = "pkg" + elCount;
1433:                //
1434:                org.netbeans.test.umllib.Utils.RetAll rt = org.netbeans.test.umllib.Utils
1435:                        .createDiagram(project, workPkg, diagramName + "_1",
1436:                                diagramType);
1437:                lastDiagramNode = rt.lastDiagramNode;
1438:                try {
1439:                    Thread.sleep(100);
1440:                } catch (Exception ex) {
1441:                }
1442:                DiagramOperator dr = new DiagramOperator(diagramName + "_1");
1443:                dr.putElementOnDiagram(elToPlaceName, elToPlace);
1444:                try {
1445:                    Thread.sleep(100);
1446:                } catch (Exception ex) {
1447:                }
1448:                JPopupMenuOperator pm = dr.callMenuOnTab();
1449:                JMenuItemOperator mi = new JMenuItemOperator(pm,
1450:                        "Save Document");
1451:                assertTrue("Save disabled", mi.isEnabled());
1452:                pm.pushKey(KeyEvent.VK_ESCAPE);
1453:                ContainerOperator tlb = MainWindowOperator.getDefault()
1454:                        .getToolbar("File");
1455:                JButtonOperator sa = MainWindowOperator.getDefault()
1456:                        .getToolbarButton(tlb, "Save All");
1457:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
1458:                //2nd
1459:                org.netbeans.test.umllib.Utils.RetAll rt2 = org.netbeans.test.umllib.Utils
1460:                        .createDiagram(project, workPkg, diagramName + "_2",
1461:                                diagramType);
1462:                dr = new DiagramOperator(diagramName + "_2");
1463:                dr.putElementOnDiagram(elToPlaceName, elToPlace);
1464:                try {
1465:                    Thread.sleep(100);
1466:                } catch (Exception ex) {
1467:                }
1468:                pm = dr.callMenuOnTab();
1469:                mi = new JMenuItemOperator(pm, "Save Document");
1470:                assertTrue("Save disabled", mi.isEnabled());
1471:                pm.pushKey(KeyEvent.VK_ESCAPE);
1472:                tlb = MainWindowOperator.getDefault().getToolbar("File");
1473:                sa = MainWindowOperator.getDefault().getToolbarButton(tlb,
1474:                        "Save All");
1475:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
1476:                //
1477:                final DiagramOperator drCl = dr;
1478:                new Thread() {
1479:                    public void run() {
1480:                        drCl.closeAllDocuments();
1481:                    }
1482:                }.start();
1483:                //Close first Save Diagram Dialog
1484:                JDialogOperator dlg = new JDialogOperator("Save Diagram");
1485:                JButtonOperator btn = new JButtonOperator(dlg, "Save");
1486:                btn.pushNoBlock();
1487:                dlg.waitClosed();
1488:                //Close second Save Diagram dialog
1489:                dlg = new JDialogOperator("Save Diagram");
1490:                btn = new JButtonOperator(dlg, "Save");
1491:                btn.pushNoBlock();
1492:                dlg.waitClosed();
1493:                try {
1494:                    Thread.sleep(100);
1495:                } catch (Exception ex) {
1496:                }
1497:                dr.waitClosed();
1498:                try {
1499:                    Thread.sleep(100);
1500:                } catch (Exception ex) {
1501:                }
1502:                //
1503:                lastDiagramNode.performPopupAction("Open");
1504:                try {
1505:                    Thread.sleep(100);
1506:                } catch (Exception ex) {
1507:                }
1508:                dr = new DiagramOperator(diagramName + "_1");
1509:                new DiagramElementOperator(dr, elToPlaceName, elToPlace);
1510:                pm = dr.callMenuOnTab();
1511:                mi = new JMenuItemOperator(pm, "Save Document");
1512:                assertFalse("Save enabled", mi.isEnabled());
1513:                pm.pushKey(KeyEvent.VK_ESCAPE);
1514:                tlb = MainWindowOperator.getDefault().getToolbar("File");
1515:                sa = MainWindowOperator.getDefault().getToolbarButton(tlb,
1516:                        "Save All");
1517:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
1518:                rt2.lastDiagramNode.performPopupAction("Open");
1519:                try {
1520:                    Thread.sleep(100);
1521:                } catch (Exception ex) {
1522:                }
1523:                dr = new DiagramOperator(diagramName + "_2");
1524:                new DiagramElementOperator(dr, elToPlaceName, elToPlace);
1525:                pm = dr.callMenuOnTab();
1526:                mi = new JMenuItemOperator(pm, "Save Document");
1527:                assertFalse("Save enabled", mi.isEnabled());
1528:                pm.pushKey(KeyEvent.VK_ESCAPE);
1529:                tlb = MainWindowOperator.getDefault().getToolbar("File");
1530:                sa = MainWindowOperator.getDefault().getToolbarButton(tlb,
1531:                        "Save All");
1532:                assertTrue("Save all toolbar button disabled", sa.isEnabled());
1533:            }
1534:
1535:            public void tearDown() {
1536:                org.netbeans.test.umllib.util.Utils.makeScreenShot(
1537:                        childClassName, lastTestCase);
1538:                //popup protection
1539:                MainWindowOperator.getDefault().pushKey(KeyEvent.VK_ESCAPE);
1540:                new EventTool().waitNoEvent(1000);
1541:                //
1542:                closeAllModal();
1543:                if (lastDiagramNode != null) {
1544:                    if (lastDiagramNode.isPresent()) {
1545:                        lastDiagramNode.collapse();
1546:                        new Node(lastDiagramNode.tree(), lastDiagramNode
1547:                                .getParentPath()).collapse();
1548:                    }
1549:                }
1550:                //save all
1551:                ContainerOperator tlb = MainWindowOperator.getDefault()
1552:                        .getToolbar("File");
1553:                JButtonOperator sa = MainWindowOperator.getDefault()
1554:                        .getToolbarButton(tlb, "Save All");
1555:                if (sa.isEnabled()) {
1556:                    sa.push();
1557:                    sa.waitState(new ChooseEnabledState(false));
1558:                    try {
1559:                        Thread.sleep(100);
1560:                    } catch (Exception ex) {
1561:                    }
1562:                }
1563:                //
1564:                DiagramOperator d = null;
1565:                try {
1566:                    d = new DiagramOperator("testD");
1567:                } catch (Exception e) {
1568:                }
1569:                //
1570:                if (d != null) {
1571:                    try {
1572:                        final DiagramOperator d2 = d;
1573:                        new Thread() {
1574:                            public void run() {
1575:                                d2.closeAllDocuments();
1576:                            }
1577:                        }.start();
1578:
1579:                        d.waitClosed();
1580:                        new EventTool().waitNoEvent(1000);
1581:                    } catch (Exception ex) {
1582:                    }
1583:                    ;
1584:                }
1585:                closeAllModal();
1586:                //save
1587:                org.netbeans.test.umllib.util.Utils.tearDown();
1588:            }
1589:
1590:            public class ChooseEnabledState implements  ComponentChooser {
1591:                private boolean enabled = false;
1592:
1593:                ChooseEnabledState(boolean enabled) {
1594:                    this .enabled = enabled;
1595:                }
1596:
1597:                public boolean checkComponent(Component component) {
1598:                    return (component.isEnabled() && enabled)
1599:                            || (!enabled && !component.isEnabled());
1600:                }
1601:
1602:                public String getDescription() {
1603:                    return "choose component if it's enabled: " + enabled;
1604:                }
1605:
1606:            }
1607:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.