Source Code Cross Referenced for DiagramElementVerifier.java in  » IDE-Netbeans » uml » org » netbeans » test » umllib » vrf » 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.vrf 
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.vrf;
0043:
0044:        import java.awt.Color;
0045:        import java.awt.Font;
0046:        import java.awt.Point;
0047:        import java.awt.Robot;
0048:        import java.awt.event.InputEvent;
0049:        import java.awt.event.KeyEvent;
0050:        import java.io.PrintStream;
0051:        import java.util.ArrayList;
0052:        import org.netbeans.jellytools.actions.SaveAllAction;
0053:        import org.netbeans.jemmy.JemmyProperties;
0054:        import org.netbeans.jemmy.Timeout;
0055:        import org.netbeans.jemmy.drivers.input.MouseRobotDriver;
0056:        import org.netbeans.jemmy.operators.JButtonOperator;
0057:        import org.netbeans.jemmy.operators.JCheckBoxOperator;
0058:        import org.netbeans.jemmy.operators.JDialogOperator;
0059:        import org.netbeans.jemmy.operators.JListOperator;
0060:        import org.netbeans.jemmy.operators.JMenuItemOperator;
0061:        import org.netbeans.jemmy.operators.JPopupMenuOperator;
0062:        import org.netbeans.jemmy.operators.JTabbedPaneOperator;
0063:        import org.netbeans.jemmy.operators.JTextComponentOperator;
0064:        import org.netbeans.test.umllib.CompartmentOperator;
0065:        import org.netbeans.test.umllib.CompartmentTypes;
0066:        import org.netbeans.test.umllib.DiagramElementOperator;
0067:        import org.netbeans.test.umllib.DiagramOperator;
0068:        import org.netbeans.test.umllib.EditControlOperator;
0069:        import org.netbeans.test.umllib.ElementTypes;
0070:        import org.netbeans.test.umllib.LinkOperator;
0071:        import org.netbeans.test.umllib.LinkTypes;
0072:        import org.netbeans.test.umllib.actions.BackgroundColorElementAction;
0073:        import org.netbeans.test.umllib.actions.BorderColorElementAction;
0074:        import org.netbeans.test.umllib.actions.DeleteElementAction;
0075:        import org.netbeans.test.umllib.actions.FontColorElementAction;
0076:        import org.netbeans.test.umllib.actions.FontElementAction;
0077:        import org.netbeans.test.umllib.actions.HideChildrenAllLevelsElementAction;
0078:        import org.netbeans.test.umllib.actions.HideChildrenOneLevelElementAction;
0079:        import org.netbeans.test.umllib.actions.HideParentsAllLevelsElementAction;
0080:        import org.netbeans.test.umllib.actions.HideParentsOneLevelElementAction;
0081:        import org.netbeans.test.umllib.actions.InvertSelectionElementAction;
0082:        import org.netbeans.test.umllib.actions.LockEditElementAction;
0083:        import org.netbeans.test.umllib.actions.SelectAllElementAction;
0084:        import org.netbeans.test.umllib.actions.SelectAllSimilarElementAction;
0085:        import org.netbeans.test.umllib.actions.ShowChildrenAllLevelsElementAction;
0086:        import org.netbeans.test.umllib.actions.ShowChildrenOneLevelElementAction;
0087:        import org.netbeans.test.umllib.actions.ShowParentsAllLevelsElementAction;
0088:        import org.netbeans.test.umllib.actions.ShowParentsOneLevelElementAction;
0089:        import org.netbeans.test.umllib.customelements.LifelineOperator;
0090:        import org.netbeans.test.umllib.exceptions.NotFoundException;
0091:        import org.netbeans.test.umllib.util.PopupConstants;
0092:
0093:        public class DiagramElementVerifier extends GenericVerifier {
0094:
0095:            private ElementTypes elementType = null;
0096:            private String prefix = "";
0097:
0098:            public DiagramElementVerifier(DiagramOperator dia,
0099:                    ElementTypes elementType) {
0100:                this (dia, elementType, "", null);
0101:            }
0102:
0103:            public DiagramElementVerifier(DiagramOperator dia,
0104:                    ElementTypes elementType, String prefix) {
0105:                this (dia, elementType, prefix, null);
0106:            }
0107:
0108:            public DiagramElementVerifier(DiagramOperator dia,
0109:                    ElementTypes elementType, PrintStream log) {
0110:                this (dia, elementType, "", log);
0111:            }
0112:
0113:            public DiagramElementVerifier(DiagramOperator dia,
0114:                    ElementTypes elementType, String prefix, PrintStream log) {
0115:                super (dia, log);
0116:                this .elementType = elementType;
0117:                this .prefix = prefix;
0118:            }
0119:
0120:            public boolean checkCopyPasteByPopup() {
0121:                final String EL_NAME = prefix + "CpyP";//+elementType.toString().substring(0, 2);
0122:                try {
0123:                    //create main element:
0124:                    DiagramElementOperator elem = createElement(EL_NAME,
0125:                            elementType);
0126:                    eventTool.waitNoEvent(500);
0127:                    new SaveAllAction().performAPI();
0128:                    eventTool.waitNoEvent(500);
0129:                    DiagramElementOperator el = getElement(EL_NAME);
0130:                    //now coping element
0131:                    JPopupMenuOperator popup = el.getPopup();
0132:                    JMenuItemOperator item = popup
0133:                            .showMenuItem(PopupConstants.EDIT + "|"
0134:                                    + PopupConstants.COPY);
0135:                    if (!item.isEnabled()) {
0136:                        log("Popup menu item " + PopupConstants.EDIT + "|"
0137:                                + PopupConstants.COPY + " disabled");
0138:                        return false;
0139:                    }
0140:                    item.clickMouse();
0141:
0142:                    //now pasting element
0143:                    eventTool.waitNoEvent(500);
0144:                    Point point = dia.getDrawingArea().getFreePoint(100);
0145:                    dia.getDrawingArea().clickForPopup(point.x, point.y);
0146:                    popup = new JPopupMenuOperator();
0147:                    item = popup.showMenuItem(PopupConstants.EDIT + "|"
0148:                            + PopupConstants.PASTE);
0149:                    if (!item.isEnabled()) {
0150:                        log("Popup menu item " + PopupConstants.EDIT + "|"
0151:                                + PopupConstants.PASTE + " disabled");
0152:                        return false;
0153:                    }
0154:                    item.clickMouse();
0155:                    dia.getDrawingArea().clickMouse(point.x, point.y, 1);
0156:                    eventTool.waitNoEvent(1000);
0157:
0158:                    //now lets check that there are two copies:
0159:                    new SaveAllAction().performAPI();
0160:                    eventTool.waitNoEvent(500);
0161:                    getElement(EL_NAME, elementType, 0).select();
0162:                    eventTool.waitNoEvent(500);
0163:                    getElement(EL_NAME, elementType, 1).select();
0164:
0165:                    return true;
0166:                } catch (Exception e) {
0167:                    if (log != null) {
0168:                        e.printStackTrace(log);
0169:                    }
0170:                    return false;
0171:                } finally {
0172:                    safeDeleteAllElements();
0173:                }
0174:            }
0175:
0176:            public boolean checkCopyPasteByShortcut() {
0177:                final String EL_NAME = prefix + "CpyS";//+elementType.toString().substring(0, 2);
0178:
0179:                try {
0180:                    //create main element:
0181:                    createElement(EL_NAME, elementType);
0182:                    eventTool.waitNoEvent(500);
0183:                    new SaveAllAction().performAPI();
0184:                    eventTool.waitNoEvent(500);
0185:                    DiagramElementOperator el = getElement(EL_NAME);
0186:
0187:                    //now coping element
0188:                    el.select();
0189:                    pushShortcut(KeyEvent.VK_C, KeyEvent.VK_CONTROL);
0190:                    eventTool.waitNoEvent(1000);
0191:
0192:                    //now pasting element
0193:                    eventTool.waitNoEvent(500);
0194:                    Point point = dia.getDrawingArea().getFreePoint(100);
0195:                    dia.getDrawingArea().clickMouse(point.x, point.y, 1);
0196:                    pushShortcut(KeyEvent.VK_V, KeyEvent.VK_CONTROL);
0197:                    dia.getDrawingArea().clickMouse(point.x, point.y, 1);
0198:
0199:                    //now lets check that there are two copies:
0200:                    new SaveAllAction().performAPI();
0201:                    eventTool.waitNoEvent(500);
0202:                    getElement(EL_NAME, elementType, 0).select();
0203:                    eventTool.waitNoEvent(500);
0204:                    getElement(EL_NAME, elementType, 1).select();
0205:
0206:                    return true;
0207:                } catch (Exception e) {
0208:                    if (log != null) {
0209:                        e.printStackTrace(log);
0210:                    }
0211:                    return false;
0212:                } finally {
0213:                    safeDeleteAllElements();
0214:                }
0215:            }
0216:
0217:            public boolean checkCutPasteByPopup() {
0218:                final String EL_NAME = prefix + "CutP";//+elementType.toString().substring(0, 2);
0219:
0220:                try {
0221:                    //create main element:
0222:                    createElement(EL_NAME, elementType);
0223:                    eventTool.waitNoEvent(500);
0224:                    new SaveAllAction().performAPI();
0225:                    eventTool.waitNoEvent(500);
0226:                    DiagramElementOperator el = getElement(EL_NAME,
0227:                            elementType, 0);
0228:
0229:                    //Cut element
0230:                    JPopupMenuOperator popup = el.getPopup();
0231:                    JMenuItemOperator item = popup
0232:                            .showMenuItem(PopupConstants.EDIT + "|"
0233:                                    + PopupConstants.CUT);
0234:                    if (!item.isEnabled()) {
0235:                        log("Popup menu item " + PopupConstants.EDIT + "|"
0236:                                + PopupConstants.CUT + " disabled");
0237:                        return false;
0238:                    }
0239:                    item.clickMouse();
0240:                    eventTool.waitNoEvent(1000);
0241:
0242:                    //checking that element has disappeared
0243:                    long timeoutVal = JemmyProperties
0244:                            .getCurrentTimeout("DiagramElementOperator.WaitDiagramElementTime");
0245:                    JemmyProperties.setCurrentTimeout(
0246:                            "DiagramElementOperator.WaitDiagramElementTime",
0247:                            2000);
0248:                    try {
0249:                        getElement(EL_NAME, elementType, 0);
0250:                        log("Element still present on diagram after "
0251:                                + PopupConstants.CUT + " action");
0252:                        return false;
0253:                    } catch (Exception e) {
0254:                    } finally {
0255:                        JemmyProperties
0256:                                .setCurrentTimeout(
0257:                                        "DiagramElementOperator.WaitDiagramElementTime",
0258:                                        timeoutVal);
0259:                    }
0260:
0261:                    //now pasting element
0262:                    eventTool.waitNoEvent(500);
0263:                    Point point = dia.getDrawingArea().getFreePoint(100);
0264:                    dia.getDrawingArea().getPopup();
0265:                    popup = new JPopupMenuOperator();
0266:                    item = popup.showMenuItem(PopupConstants.EDIT + "|"
0267:                            + PopupConstants.PASTE);
0268:                    if (!item.isEnabled()) {
0269:                        log("Popup menu item " + PopupConstants.EDIT + "|"
0270:                                + PopupConstants.PASTE + " disabled");
0271:                        return false;
0272:                    }
0273:                    item.clickMouse();
0274:                    dia.getDrawingArea().clickMouse(point.x, point.y, 1);
0275:                    eventTool.waitNoEvent(1000);
0276:
0277:                    //now checking that element appeared on diagram:
0278:                    new SaveAllAction().performAPI();
0279:                    eventTool.waitNoEvent(500);
0280:                    el = getElement(EL_NAME, elementType, 0);
0281:                    el.select();
0282:
0283:                    return true;
0284:                } catch (Exception e) {
0285:                    if (log != null) {
0286:                        e.printStackTrace(log);
0287:                    }
0288:                    return false;
0289:                } finally {
0290:                    safeDeleteAllElements();
0291:                }
0292:            }
0293:
0294:            public boolean checkCutPasteByShortcut() {
0295:                final String EL_NAME = prefix + "CutS";//+elementType.toString().substring(0, 2);
0296:
0297:                try {
0298:                    //create main element:
0299:                    createElement(EL_NAME, elementType);
0300:                    eventTool.waitNoEvent(500);
0301:                    new SaveAllAction().performAPI();
0302:                    eventTool.waitNoEvent(500);
0303:                    DiagramElementOperator el = getElement(EL_NAME,
0304:                            elementType, 0);
0305:
0306:                    //Cut element
0307:                    el.select();
0308:                    pushShortcut(KeyEvent.VK_X, KeyEvent.VK_CONTROL);
0309:                    eventTool.waitNoEvent(1000);
0310:
0311:                    //checking that element has disappeared
0312:                    long timeoutVal = JemmyProperties
0313:                            .getCurrentTimeout("DiagramElementOperator.WaitDiagramElementTime");
0314:                    JemmyProperties.setCurrentTimeout(
0315:                            "DiagramElementOperator.WaitDiagramElementTime",
0316:                            2000);
0317:                    try {
0318:                        getElement(EL_NAME, elementType, 0);
0319:                        log("Element still present on diagram after "
0320:                                + PopupConstants.CUT + " action");
0321:                        return false;
0322:                    } catch (Exception e) {
0323:                    } finally {
0324:                        JemmyProperties
0325:                                .setCurrentTimeout(
0326:                                        "DiagramElementOperator.WaitDiagramElementTime",
0327:                                        timeoutVal);
0328:                    }
0329:
0330:                    //now pasting element
0331:                    eventTool.waitNoEvent(500);
0332:                    Point point = dia.getDrawingArea().getFreePoint(100);
0333:                    dia.getDrawingArea().clickMouse(point.x, point.y, 1);
0334:                    pushShortcut(KeyEvent.VK_V, KeyEvent.VK_CONTROL);
0335:                    dia.getDrawingArea().clickMouse(point.x, point.y, 1);
0336:                    eventTool.waitNoEvent(1000);
0337:
0338:                    //now checking that element appeared on diagram:
0339:                    new SaveAllAction().performAPI();
0340:                    eventTool.waitNoEvent(500);
0341:                    el = getElement(EL_NAME, elementType, 0);
0342:                    el.select();
0343:
0344:                    return true;
0345:                } catch (Exception e) {
0346:                    if (log != null) {
0347:                        e.printStackTrace(log);
0348:                    }
0349:                    return false;
0350:                } finally {
0351:                    safeDeleteAllElements();
0352:                }
0353:            }
0354:
0355:            public boolean checkDeleteByPopup() {
0356:                final String EL_NAME = prefix + "DelP";//+elementType.toString().substring(0, 2);
0357:
0358:                try {
0359:                    //create main element:
0360:                    createElement(EL_NAME, elementType);
0361:                    eventTool.waitNoEvent(500);
0362:                    new SaveAllAction().performAPI();
0363:                    eventTool.waitNoEvent(500);
0364:                    final DiagramElementOperator el = getElement(EL_NAME,
0365:                            elementType, 0);
0366:
0367:                    //deleting
0368:                    new Thread(new Runnable() {
0369:                        public void run() {
0370:                            eventTool.waitNoEvent(500);
0371:                            new JCheckBoxOperator(new JDialogOperator(
0372:                                    DELETE_DLG)).clickMouse();
0373:                            new JButtonOperator(
0374:                                    new JDialogOperator(DELETE_DLG), YES_BTN)
0375:                                    .push();
0376:                        }
0377:                    }).start();
0378:                    new Thread(new Runnable() {
0379:                        public void run() {
0380:                            eventTool.waitNoEvent(500);
0381:                            new JButtonOperator(new JDialogOperator(
0382:                                    DELETE_PKG_DLG), YES_BTN).push();
0383:                        }
0384:                    }).start();
0385:
0386:                    new DeleteElementAction().performPopup(el);
0387:                    eventTool.waitNoEvent(1500);
0388:
0389:                    //checking the element has disappeared
0390:                    long timeoutVal = JemmyProperties
0391:                            .getCurrentTimeout("DiagramElementOperator.WaitDiagramElementTime");
0392:                    JemmyProperties.setCurrentTimeout(
0393:                            "DiagramElementOperator.WaitDiagramElementTime",
0394:                            2000);
0395:                    try {
0396:                        getElement(EL_NAME, elementType, 0);
0397:                        log("Element still present on diagram after "
0398:                                + PopupConstants.DELETE + " action");
0399:                        return false;
0400:                    } catch (Exception e) {
0401:                    } finally {
0402:                        JemmyProperties
0403:                                .setCurrentTimeout(
0404:                                        "DiagramElementOperator.WaitDiagramElementTime",
0405:                                        timeoutVal);
0406:                    }
0407:
0408:                    return true;
0409:                } catch (Exception e) {
0410:                    if (log != null) {
0411:                        e.printStackTrace(log);
0412:                    }
0413:                    return false;
0414:                } finally {
0415:                    safeDeleteAllElements();
0416:                }
0417:            }
0418:
0419:            public boolean checkDeleteByShortcut() {
0420:                final String EL_NAME = prefix + "DelS";//+elementType.toString().substring(0, 2);
0421:
0422:                try {
0423:                    //create main element:
0424:                    createElement(EL_NAME, elementType);
0425:                    eventTool.waitNoEvent(500);
0426:                    new SaveAllAction().performAPI();
0427:                    eventTool.waitNoEvent(500);
0428:                    final DiagramElementOperator el = getElement(EL_NAME,
0429:                            elementType, 0);
0430:                    el.select();
0431:
0432:                    //deleting
0433:                    new Thread(new Runnable() {
0434:                        public void run() {
0435:                            eventTool.waitNoEvent(500);
0436:                            new JCheckBoxOperator(new JDialogOperator(
0437:                                    DELETE_DLG)).clickMouse();
0438:                            new JButtonOperator(
0439:                                    new JDialogOperator(DELETE_DLG), YES_BTN)
0440:                                    .push();
0441:                        }
0442:                    }).start();
0443:                    new Thread(new Runnable() {
0444:                        public void run() {
0445:                            eventTool.waitNoEvent(500);
0446:                            new JButtonOperator(new JDialogOperator(
0447:                                    DELETE_PKG_DLG), YES_BTN).push();
0448:                        }
0449:                    }).start();
0450:                    pushKey(KeyEvent.VK_DELETE);
0451:                    eventTool.waitNoEvent(1500);
0452:
0453:                    //checking the element has disappeared
0454:                    long timeoutVal = JemmyProperties
0455:                            .getCurrentTimeout("DiagramElementOperator.WaitDiagramElementTime");
0456:                    JemmyProperties.setCurrentTimeout(
0457:                            "DiagramElementOperator.WaitDiagramElementTime",
0458:                            2000);
0459:                    try {
0460:                        getElement(EL_NAME, elementType, 0);
0461:                        log("Element still present on diagram after "
0462:                                + PopupConstants.DELETE + " action");
0463:                        return false;
0464:                    } catch (Exception e) {
0465:                    } finally {
0466:                        JemmyProperties
0467:                                .setCurrentTimeout(
0468:                                        "DiagramElementOperator.WaitDiagramElementTime",
0469:                                        timeoutVal);
0470:                    }
0471:
0472:                    return true;
0473:                } catch (Exception e) {
0474:                    if (log != null) {
0475:                        e.printStackTrace(log);
0476:                    }
0477:                    return false;
0478:                } finally {
0479:                    safeDeleteAllElements();
0480:                }
0481:            }
0482:
0483:            public boolean checkLockEdit() {
0484:                final String EL_NAME = prefix + "Lck";//+elementType.toString().substring(0, 2);
0485:
0486:                try {
0487:                    //create main element:
0488:                    createElement(EL_NAME, elementType);
0489:
0490:                    eventTool.waitNoEvent(500);
0491:                    new SaveAllAction().performAPI();
0492:                    eventTool.waitNoEvent(500);
0493:
0494:                    DiagramElementOperator el = getElement(EL_NAME,
0495:                            elementType, 0);
0496:
0497:                    //lock edit
0498:                    new LockEditElementAction().performPopup(el);
0499:                    eventTool.waitNoEvent(500);
0500:
0501:                    //trying to edit object
0502:                    el = getElement(EL_NAME, elementType, 0);
0503:                    CompartmentOperator comp = new CompartmentOperator(el,
0504:                            CompartmentTypes.NAME_COMPARTMENT);
0505:                    comp.clickOnCenter(2, InputEvent.BUTTON1_MASK);
0506:                    eventTool.waitNoEvent(1000);
0507:
0508:                    long timeoutVal = JemmyProperties
0509:                            .getCurrentTimeout("DialogWaiter.WaitDialogTimeout");
0510:                    JemmyProperties.setCurrentTimeout(
0511:                            "DialogWaiter.WaitDialogTimeout", 3000);
0512:                    try {
0513:                        EditControlOperator editcontrol = new EditControlOperator();
0514:                        log("Edit box appears after double-click on locked element but should not be");
0515:                        return false;
0516:                    } catch (Exception e) {
0517:                    } finally {
0518:                        JemmyProperties.setCurrentTimeout(
0519:                                "DialogWaiter.WaitDialogTimeout", timeoutVal);
0520:                    }
0521:
0522:                    return true;
0523:                } catch (Exception e) {
0524:                    if (log != null) {
0525:                        e.printStackTrace(log);
0526:                    }
0527:                    return false;
0528:                } finally {
0529:                    safeDeleteAllElements();
0530:                }
0531:            }
0532:
0533:            public boolean checkSelectAllByPopup(ElementTypes[] elementTypes) {
0534:                final String EL_NAME = prefix + "SelAP";//+elementType.toString().substring(0, 2);
0535:
0536:                try {
0537:                    createElement(EL_NAME, elementType);
0538:                    eventTool.waitNoEvent(500);
0539:                    Point p = null;
0540:                    for (int i = 0; i < elementTypes.length; i++) {
0541:                        p = dia.getDrawingArea().getFreePoint(100);
0542:                        createElement(EL_NAME + i, elementTypes[i], p.x, p.y);
0543:                        eventTool.waitNoEvent(500);
0544:                    }
0545:
0546:                    eventTool.waitNoEvent(500);
0547:                    new SaveAllAction().performAPI();
0548:                    eventTool.waitNoEvent(500);
0549:
0550:                    //select all
0551:                    DiagramElementOperator el = getElement(EL_NAME,
0552:                            elementType, 0);
0553:                    new SelectAllElementAction().performPopup(el);
0554:                    eventTool.waitNoEvent(500);
0555:
0556:                    //checking everything was selected
0557:
0558:                    el = getElement(EL_NAME, elementType, 0);
0559:                    if (!el.isSelected()) {
0560:                        log("Element '" + EL_NAME + "' not selected");
0561:                        return false;
0562:                    }
0563:
0564:                    for (int i = 0; i < elementTypes.length; i++) {
0565:                        el = getElement(EL_NAME + i, elementTypes[i], 0);
0566:                        if (!el.isSelected()) {
0567:                            log("Element '" + EL_NAME + i + "' not selected");
0568:                            return false;
0569:                        }
0570:                    }
0571:
0572:                    return true;
0573:                } catch (Exception e) {
0574:                    if (log != null) {
0575:                        e.printStackTrace(log);
0576:                    }
0577:                    return false;
0578:                } finally {
0579:                    safeDeleteAllElements();
0580:                }
0581:            }
0582:
0583:            public boolean checkSelectAllByShortcut(ElementTypes[] elementTypes) {
0584:                final String EL_NAME = prefix + "SelAS";//+elementType.toString().substring(0, 2);
0585:
0586:                try {
0587:                    createElement(EL_NAME, elementType);
0588:                    eventTool.waitNoEvent(500);
0589:                    Point p = null;
0590:                    for (int i = 0; i < elementTypes.length; i++) {
0591:                        p = dia.getDrawingArea().getFreePoint(100);
0592:                        createElement(EL_NAME + i, elementTypes[i]);
0593:                        eventTool.waitNoEvent(500);
0594:                    }
0595:
0596:                    eventTool.waitNoEvent(500);
0597:                    new SaveAllAction().performAPI();
0598:                    eventTool.waitNoEvent(500);
0599:
0600:                    //select all
0601:                    Point point = dia.getDrawingArea().getFreePoint();
0602:                    dia.getDrawingArea().clickMouse(point.x, point.y, 1);
0603:                    pushShortcut(KeyEvent.VK_A, KeyEvent.VK_CONTROL);
0604:                    eventTool.waitNoEvent(500);
0605:
0606:                    //checking everything was selected
0607:
0608:                    DiagramElementOperator el = getElement(EL_NAME,
0609:                            elementType, 0);
0610:                    if (!el.isSelected()) {
0611:                        log("Element '" + EL_NAME + "' not selected");
0612:                        return false;
0613:                    }
0614:
0615:                    for (int i = 0; i < elementTypes.length; i++) {
0616:                        el = getElement(EL_NAME + i, elementTypes[i], 0);
0617:                        if (!el.isSelected()) {
0618:                            log("Element '" + EL_NAME + i + "' not selected");
0619:                            return false;
0620:                        }
0621:                    }
0622:                    return true;
0623:                } catch (Exception e) {
0624:                    if (log != null) {
0625:                        e.printStackTrace(log);
0626:                    }
0627:                    return false;
0628:                } finally {
0629:                    safeDeleteAllElements();
0630:                }
0631:            }
0632:
0633:            public boolean checkSelectAllSimilar(ElementTypes[] typesToPut) {
0634:                final String EL_NAME = prefix + "SelS";//+elementType.toString().substring(0, 2);
0635:
0636:                try {
0637:                    Point point = dia.getDrawingArea().getFreePoint();
0638:                    createElement(EL_NAME, elementType, point.x, point.y);
0639:                    eventTool.waitNoEvent(500);
0640:
0641:                    for (int i = 0; i < typesToPut.length; i++) {
0642:                        point = dia.getDrawingArea().getFreePoint(100);
0643:                        createElement(EL_NAME + i, typesToPut[i], point.x,
0644:                                point.y);
0645:                        eventTool.waitNoEvent(500);
0646:                    }
0647:
0648:                    eventTool.waitNoEvent(500);
0649:                    new SaveAllAction().performAPI();
0650:                    eventTool.waitNoEvent(500);
0651:
0652:                    //select all
0653:                    DiagramElementOperator el = getElement(EL_NAME,
0654:                            elementType, 0);
0655:                    new SelectAllSimilarElementAction().performPopup(el);
0656:                    eventTool.waitNoEvent(500);
0657:
0658:                    //checking everything was selected correctly
0659:                    el = getElement(EL_NAME, elementType, 0);
0660:                    if (!el.isSelected()) {
0661:                        log("Element '" + EL_NAME + "' not selected");
0662:                        return false;
0663:                    }
0664:
0665:                    for (int i = 0; i < typesToPut.length; i++) {
0666:                        el = getElement(EL_NAME + i, typesToPut[i], 0);
0667:                        if (el.getElementType().equals(elementType.toString())
0668:                                && !el.isSelected()) {
0669:                            log("Element '" + EL_NAME + i + "' is not selected");
0670:                            return false;
0671:                        }
0672:                        if (!el.getElementType().equals(elementType.toString())
0673:                                && el.isSelected()) {
0674:                            log("Element '" + EL_NAME + i + "' is selected");
0675:                            return false;
0676:                        }
0677:                    }
0678:
0679:                    return true;
0680:                } catch (Exception e) {
0681:                    if (log != null) {
0682:                        e.printStackTrace(log);
0683:                    }
0684:                    return false;
0685:                } finally {
0686:                    safeDeleteAllElements();
0687:                }
0688:            }
0689:
0690:            public boolean checkInvertSelection(ElementTypes[] typesToSelect,
0691:                    ElementTypes[] typesNotToSelect) {
0692:                final String EL_NAME = prefix + "Inv";//+elementType.toString().substring(0, 2);
0693:
0694:                try {
0695:                    Point point = dia.getDrawingArea().getFreePoint();
0696:                    createElement(EL_NAME, elementType, point.x, point.y);
0697:                    eventTool.waitNoEvent(500);
0698:
0699:                    for (int i = 0; i < typesToSelect.length; i++) {
0700:                        point = dia.getDrawingArea().getFreePoint(100);
0701:                        createElement(EL_NAME + "SEL" + i, typesToSelect[i],
0702:                                point.x, point.y);
0703:                        eventTool.waitNoEvent(500);
0704:                    }
0705:
0706:                    for (int i = 0; i < typesNotToSelect.length; i++) {
0707:                        point = dia.getDrawingArea().getFreePoint(100);
0708:                        createElement(EL_NAME + "NOTSEL" + i,
0709:                                typesNotToSelect[i], point.x, point.y);
0710:                        eventTool.waitNoEvent(500);
0711:                    }
0712:
0713:                    eventTool.waitNoEvent(500);
0714:                    new SaveAllAction().performAPI();
0715:                    eventTool.waitNoEvent(500);
0716:
0717:                    //selecting and inverting selection
0718:                    DiagramElementOperator[] arr = new DiagramElementOperator[typesToSelect.length + 1];
0719:                    arr[0] = getElement(EL_NAME, elementType, 0);
0720:                    for (int i = 1; i < arr.length; i++) {
0721:                        arr[i] = getElement(EL_NAME + "SEL" + (i - 1),
0722:                                typesToSelect[i - 1], 0);
0723:                    }
0724:                    new InvertSelectionElementAction().performPopup(arr);
0725:                    eventTool.waitNoEvent(1000);
0726:
0727:                    //checking
0728:                    for (int i = 0; i < arr.length; i++) {
0729:                        if (arr[i].isSelected()) {
0730:                            log("Element '" + arr[i].toString()
0731:                                    + "' is selected");
0732:                            return false;
0733:                        }
0734:                    }
0735:
0736:                    for (int i = 0; i < typesNotToSelect.length; i++) {
0737:                        DiagramElementOperator el = getElement(EL_NAME
0738:                                + "NOTSEL" + i, typesNotToSelect[i], 0);
0739:                        if (!el.isSelected()) {
0740:                            log("Element '" + EL_NAME + "NOTSEL" + i
0741:                                    + "' is not selected");
0742:                            return false;
0743:                        }
0744:                    }
0745:
0746:                    return true;
0747:                } catch (Exception e) {
0748:                    if (log != null) {
0749:                        e.printStackTrace(log);
0750:                    }
0751:                    return false;
0752:                } finally {
0753:                    safeDeleteAllElements();
0754:                }
0755:            }
0756:
0757:            /*
0758:             public boolean checkResetEdges() throws ElementVerificationException{
0759:             final String EL_NAME = prefix+"ResetEdges";//+elementType;
0760:            
0761:             try{
0762:             //create main element:
0763:             Point point = dia.getDrawingArea().getFreePoint();
0764:             createElement(EL_NAME, elementType, point.x, point.y);
0765:            
0766:             eventTool.waitNoEvent(500);
0767:             new SaveAllAction().performAPI();
0768:             eventTool.waitNoEvent(500);
0769:            
0770:             DiagramElementOperator el = getElement(EL_NAME);
0771:             //checking
0772:             JPopupMenuOperator popup = el.getPopup();
0773:             JMenuItemOperator item = popup.showMenuItem(PopupConstants.RESET_EDGES);
0774:             if(item.isEnabled()){
0775:             return false;
0776:             }
0777:             return true;
0778:             }catch(Exception e){
0779:             if (log != null){e.printStackTrace(log);}
0780:             throw new ElementVerificationException(e);
0781:             }finally{
0782:             safeDeleteElement(EL_NAME);
0783:             }
0784:             }
0785:             */
0786:            /*
0787:             public boolean checkResizeElementToContents(){
0788:             final String EL_NAME = prefix+"ResToCont";//+elementType.toString().substring(0, 2);
0789:            
0790:             try{
0791:             //create main element:
0792:             Point point = dia.getDrawingArea().getFreePoint();
0793:             DiagramElementOperator el = createElement(EL_NAME, elementType, point.x, point.y);
0794:            
0795:             el.resize(200, 200);
0796:            
0797:             eventTool.waitNoEvent(500);
0798:             new SaveAllAction().performAPI();
0799:             eventTool.waitNoEvent(500);
0800:            
0801:             el = getElement(EL_NAME);
0802:             new ResizeElementToContentsElementAction().performPopup(el);
0803:             eventTool.waitNoEvent(500);
0804:             Rectangle rect = el.getElementRectangle();
0805:            
0806:             //checking the size
0807:             //TODO: This check is incorrect!. Another check should be added. Now it is just
0808:             //checked that the size has changed
0809:             el = getElement(EL_NAME);
0810:             el.getGraphObject().sizeToContents();
0811:             eventTool.waitNoEvent(500);
0812:             Rectangle rectReset = el.getElementRectangle();
0813:            
0814:             if (!(rectReset.width==rect.width && rectReset.height==rect.height)){
0815:             return false;
0816:             }
0817:             return true;
0818:             }catch(Exception e){
0819:             if (log != null){e.printStackTrace(log);}
0820:             return false;
0821:             }finally{
0822:             safeDeleteAllElements();
0823:             }
0824:             }
0825:             */
0826:            public boolean checkHideChildrenOneLevel(int levelsNum,
0827:                    int elementsOnLevel, LinkTypes linkType,
0828:                    ElementTypes childType) {
0829:                final String EL_NAME = "HChOne";//+elementType.toString().substring(0, 2);
0830:
0831:                try {
0832:                    //create main element:
0833:                    Point point = dia.getDrawingArea().getFreePoint();
0834:                    DiagramElementOperator el = createElement(EL_NAME,
0835:                            elementType, point.x, point.y);
0836:                    eventTool.waitNoEvent(500);
0837:                    //creating children Elements
0838:
0839:                    ArrayList<String> elementNames = createLinkedElements(el,
0840:                            0, elementsOnLevel, levelsNum, EL_NAME, linkType,
0841:                            childType, false);
0842:
0843:                    //hiding children 1 level
0844:                    eventTool.waitNoEvent(500);
0845:                    dia.toolbar().selectDefault();
0846:                    new HideChildrenOneLevelElementAction().performPopup(el);
0847:                    eventTool.waitNoEvent(500);
0848:
0849:                    //gathering 1 level children element' names
0850:                    ArrayList<String> children = new ArrayList<String>();
0851:                    for (int j = 0; j < elementsOnLevel; j++) {
0852:                        children.add(EL_NAME + "C" + j);
0853:                    }
0854:                    eventTool.waitNoEvent(1000);
0855:
0856:                    //checking everything was hidden correctly
0857:                    long timeoutVal = JemmyProperties
0858:                            .getCurrentTimeout("DiagramElementOperator.WaitDiagramElementTime");
0859:                    JemmyProperties.setCurrentTimeout(
0860:                            "DiagramElementOperator.WaitDiagramElementTime",
0861:                            2000);
0862:                    try {
0863:                        for (int i = 0; i < elementNames.size(); i++) {
0864:                            String elName = elementNames.get(i);
0865:                            if (children.indexOf(elName) > -1) {
0866:                                try {
0867:                                    DiagramElementOperator op = new DiagramElementOperator(
0868:                                            dia, elName, childType, 0);
0869:                                    log("Element '" + elName
0870:                                            + "' not found on diagram");
0871:                                    return false;
0872:                                } catch (Exception tee) {
0873:                                }
0874:                            } else {
0875:                                new DiagramElementOperator(dia, elName);
0876:                            }
0877:                        }
0878:                    } catch (Exception e) {
0879:                        if (log != null) {
0880:                            e.printStackTrace(log);
0881:                        }
0882:                        return false;
0883:                    } finally {
0884:                        JemmyProperties
0885:                                .setCurrentTimeout(
0886:                                        "DiagramElementOperator.WaitDiagramElementTime",
0887:                                        timeoutVal);
0888:                    }
0889:
0890:                    return true;
0891:                } catch (Exception e) {
0892:                    if (log != null) {
0893:                        e.printStackTrace(log);
0894:                    }
0895:                    return false;
0896:                } finally {
0897:                    safeDeleteAllElements();
0898:                }
0899:            }
0900:
0901:            public boolean checkHideChildrenAllLevels(int levelsNum,
0902:                    int elementsOnLevel, LinkTypes linkType,
0903:                    ElementTypes childType) {
0904:                final String EL_NAME = "HChAll";//+elementType.toString().substring(0, 2);
0905:
0906:                try {
0907:                    //create main element:
0908:                    Point point = dia.getDrawingArea().getFreePoint();
0909:                    DiagramElementOperator el = createElement(EL_NAME,
0910:                            elementType, point.x, point.y);
0911:                    eventTool.waitNoEvent(500);
0912:                    //creating children Elements
0913:                    ArrayList<String> elementNames = createLinkedElements(el,
0914:                            0, elementsOnLevel, levelsNum, EL_NAME, linkType,
0915:                            childType, false);
0916:
0917:                    //hiding children 1 level
0918:                    eventTool.waitNoEvent(500);
0919:                    dia.toolbar().selectDefault();
0920:                    new HideChildrenAllLevelsElementAction().performPopup(el);
0921:                    eventTool.waitNoEvent(1000);
0922:
0923:                    //checking everything was hidden correctly
0924:                    long timeoutVal = JemmyProperties
0925:                            .getCurrentTimeout("DiagramElementOperator.WaitDiagramElementTime");
0926:                    JemmyProperties.setCurrentTimeout(
0927:                            "DiagramElementOperator.WaitDiagramElementTime",
0928:                            2000);
0929:                    try {
0930:                        for (int i = 0; i < elementNames.size(); i++) {
0931:                            String elName = elementNames.get(i);
0932:                            try {
0933:                                DiagramElementOperator op = new DiagramElementOperator(
0934:                                        dia, elName, childType, 0);
0935:                                log("Element '" + elName
0936:                                        + "' not found on diagram");
0937:                                return false;
0938:                            } catch (Exception tee) {
0939:                            }
0940:                        }
0941:                    } catch (Exception e) {
0942:                        if (log != null) {
0943:                            e.printStackTrace(log);
0944:                        }
0945:                        return false;
0946:                    } finally {
0947:                        JemmyProperties
0948:                                .setCurrentTimeout(
0949:                                        "DiagramElementOperator.WaitDiagramElementTime",
0950:                                        timeoutVal);
0951:                    }
0952:
0953:                    return true;
0954:                } catch (Exception e) {
0955:                    if (log != null) {
0956:                        e.printStackTrace(log);
0957:                    }
0958:                    return false;
0959:                } finally {
0960:                    safeDeleteAllElements();
0961:                }
0962:            }
0963:
0964:            public boolean checkHideParentsOneLevel(int levelsNum,
0965:                    int elementsOnLevel, LinkTypes linkType,
0966:                    ElementTypes childType) {
0967:                final String EL_NAME = "HPOne";//+elementType.toString().substring(0, 2);
0968:
0969:                try {
0970:                    //create main element:
0971:                    Point point = dia.getDrawingArea().getFreePoint();
0972:                    DiagramElementOperator el = createElement(EL_NAME,
0973:                            elementType, point.x, point.y);
0974:                    eventTool.waitNoEvent(500);
0975:                    //creating children Elements
0976:                    ArrayList<String> elementNames = createLinkedElements(el,
0977:                            0, elementsOnLevel, levelsNum, EL_NAME, linkType,
0978:                            childType, true);
0979:
0980:                    //hiding children 1 level
0981:                    eventTool.waitNoEvent(500);
0982:                    dia.toolbar().selectDefault();
0983:                    new HideParentsOneLevelElementAction().performPopup(el);
0984:                    eventTool.waitNoEvent(500);
0985:
0986:                    //gathering 1 level children element' names
0987:                    ArrayList<String> parents = new ArrayList<String>();
0988:                    for (int j = 0; j < elementsOnLevel; j++) {
0989:                        parents.add(EL_NAME + "C" + j);
0990:                    }
0991:                    eventTool.waitNoEvent(1000);
0992:
0993:                    //checking everything was hidden correctly
0994:                    long timeoutVal = JemmyProperties
0995:                            .getCurrentTimeout("DiagramElementOperator.WaitDiagramElementTime");
0996:                    JemmyProperties.setCurrentTimeout(
0997:                            "DiagramElementOperator.WaitDiagramElementTime",
0998:                            2000);
0999:                    try {
1000:                        for (int i = 0; i < elementNames.size(); i++) {
1001:                            String elName = elementNames.get(i);
1002:                            if (parents.indexOf(elName) > -1) {
1003:                                try {
1004:                                    DiagramElementOperator op = new DiagramElementOperator(
1005:                                            dia, elName, childType, 0);
1006:                                    log("Element '" + elName
1007:                                            + "' not found on diagram");
1008:                                    return false;
1009:                                    //eventTool.waitNoEvent(5000);
1010:                                    //throw new ElementVerificationException(elName+op.getGraphObject().isVisible(),new Exception());
1011:                                } catch (Exception tee) {
1012:                                }
1013:                            } else {
1014:                                new DiagramElementOperator(dia, elName);
1015:                            }
1016:                        }
1017:                    } catch (Exception e) {
1018:                        if (log != null) {
1019:                            e.printStackTrace(log);
1020:                        }
1021:                        return false;
1022:                    } finally {
1023:                        JemmyProperties
1024:                                .setCurrentTimeout(
1025:                                        "DiagramElementOperator.WaitDiagramElementTime",
1026:                                        timeoutVal);
1027:                    }
1028:
1029:                    return true;
1030:                } catch (Exception e) {
1031:                    if (log != null) {
1032:                        e.printStackTrace(log);
1033:                    }
1034:                    return false;
1035:                } finally {
1036:                    safeDeleteAllElements();
1037:                }
1038:            }
1039:
1040:            public boolean checkHideParentsAllLevels(int levelsNum,
1041:                    int elementsOnLevel, LinkTypes linkType,
1042:                    ElementTypes childType) {
1043:                final String EL_NAME = "HPAll";//+elementType.toString().substring(0, 2);
1044:                try {
1045:                    //create main element:
1046:                    Point point = dia.getDrawingArea().getFreePoint();
1047:                    DiagramElementOperator el = createElement(EL_NAME,
1048:                            elementType, point.x, point.y);
1049:                    eventTool.waitNoEvent(500);
1050:                    //creating children Elements
1051:                    ArrayList<String> elementNames = createLinkedElements(el,
1052:                            0, elementsOnLevel, levelsNum, EL_NAME, linkType,
1053:                            childType, true);
1054:
1055:                    //hiding children 1 level
1056:                    eventTool.waitNoEvent(500);
1057:                    dia.toolbar().selectDefault();
1058:                    new HideParentsAllLevelsElementAction().performPopup(el);
1059:                    eventTool.waitNoEvent(1000);
1060:
1061:                    //checking everything was hidden correctly
1062:                    long timeoutVal = JemmyProperties
1063:                            .getCurrentTimeout("DiagramElementOperator.WaitDiagramElementTime");
1064:                    JemmyProperties.setCurrentTimeout(
1065:                            "DiagramElementOperator.WaitDiagramElementTime",
1066:                            2000);
1067:                    try {
1068:                        for (int i = 0; i < elementNames.size(); i++) {
1069:                            String elName = elementNames.get(i);
1070:                            try {
1071:                                DiagramElementOperator op = new DiagramElementOperator(
1072:                                        dia, elName, childType, 0);
1073:                                log("Element '" + elName
1074:                                        + "' not found on diagram");
1075:                                return false;
1076:                            } catch (Exception tee) {
1077:                            }
1078:                        }
1079:                    } catch (Exception e) {
1080:                        if (log != null) {
1081:                            e.printStackTrace(log);
1082:                        }
1083:                        return false;
1084:                    } finally {
1085:                        JemmyProperties
1086:                                .setCurrentTimeout(
1087:                                        "DiagramElementOperator.WaitDiagramElementTime",
1088:                                        timeoutVal);
1089:                    }
1090:                    return true;
1091:                } catch (Exception e) {
1092:                    if (log != null) {
1093:                        e.printStackTrace(log);
1094:                    }
1095:                    return false;
1096:                } finally {
1097:                    safeDeleteAllElements();
1098:                }
1099:            }
1100:
1101:            public boolean checkShowChildrenOneLevel(int levelsNum,
1102:                    int elementsOnLevel, LinkTypes linkType,
1103:                    ElementTypes childType) {
1104:                final String EL_NAME = "ShChOne";//+elementType.toString().substring(0, 2);
1105:
1106:                try {
1107:                    //create main element:
1108:                    Point point = dia.getDrawingArea().getFreePoint();
1109:                    DiagramElementOperator el = createElement(EL_NAME,
1110:                            elementType, point.x, point.y);
1111:                    eventTool.waitNoEvent(500);
1112:                    //creating children Elements
1113:                    ArrayList<String> elementNames = createLinkedElements(el,
1114:                            0, elementsOnLevel, levelsNum, EL_NAME, linkType,
1115:                            childType, false);
1116:
1117:                    //hiding children 1 level
1118:                    eventTool.waitNoEvent(500);
1119:                    dia.toolbar().selectDefault();
1120:                    new HideChildrenAllLevelsElementAction().performPopup(el);
1121:                    eventTool.waitNoEvent(500);
1122:                    new ShowChildrenOneLevelElementAction().performPopup(el);
1123:
1124:                    //gathering 1 level linked element' names
1125:                    ArrayList<String> children = new ArrayList<String>();
1126:                    for (int j = 0; j < elementsOnLevel; j++) {
1127:                        children.add(EL_NAME + "C" + j);
1128:                    }
1129:                    eventTool.waitNoEvent(1000);
1130:
1131:                    //checking everything was hidden correctly
1132:                    long timeoutVal = JemmyProperties
1133:                            .getCurrentTimeout("DiagramElementOperator.WaitDiagramElementTime");
1134:                    JemmyProperties.setCurrentTimeout(
1135:                            "DiagramElementOperator.WaitDiagramElementTime",
1136:                            2000);
1137:                    try {
1138:                        for (int i = 0; i < elementNames.size(); i++) {
1139:                            String elName = elementNames.get(i);
1140:                            if (!(children.indexOf(elName) > -1)) {
1141:                                try {
1142:                                    DiagramElementOperator op = new DiagramElementOperator(
1143:                                            dia, elName, childType, 0);
1144:                                    log("Element '" + elName
1145:                                            + "' not found on diagram");
1146:                                    return false;
1147:                                } catch (Exception tee) {
1148:                                }
1149:                            } else {
1150:                                DiagramElementOperator childEl = new DiagramElementOperator(
1151:                                        dia, elName);
1152:                                new LinkOperator(childEl, el, linkType);
1153:                            }
1154:                        }
1155:                    } catch (Exception e) {
1156:                        if (log != null) {
1157:                            e.printStackTrace(log);
1158:                        }
1159:                        return false;
1160:                    } finally {
1161:                        JemmyProperties
1162:                                .setCurrentTimeout(
1163:                                        "DiagramElementOperator.WaitDiagramElementTime",
1164:                                        timeoutVal);
1165:                    }
1166:
1167:                    return true;
1168:                } catch (Exception e) {
1169:                    if (log != null) {
1170:                        e.printStackTrace(log);
1171:                    }
1172:                    return false;
1173:                } finally {
1174:                    safeDeleteAllElements();
1175:                }
1176:            }
1177:
1178:            public boolean checkShowChildrenAllLevels(int levelsNum,
1179:                    int elementsOnLevel, LinkTypes linkType,
1180:                    ElementTypes childType) {
1181:                final String EL_NAME = "ShChAll";//+elementType.toString().substring(0, 2);
1182:
1183:                try {
1184:                    //create main element:
1185:                    Point point = dia.getDrawingArea().getFreePoint();
1186:                    DiagramElementOperator el = createElement(EL_NAME,
1187:                            elementType, point.x, point.y);
1188:                    eventTool.waitNoEvent(500);
1189:                    //creating children Elements
1190:                    ArrayList<String> elementNames = createLinkedElements(el,
1191:                            0, elementsOnLevel, levelsNum, EL_NAME, linkType,
1192:                            childType, false);
1193:
1194:                    //hiding children 1 level
1195:                    eventTool.waitNoEvent(500);
1196:                    dia.toolbar().selectDefault();
1197:                    new HideChildrenAllLevelsElementAction().performPopup(el);
1198:                    eventTool.waitNoEvent(500);
1199:                    new ShowChildrenAllLevelsElementAction().performPopup(el);
1200:                    eventTool.waitNoEvent(1000);
1201:
1202:                    //checking everything was hidden correctly
1203:                    long timeoutVal = JemmyProperties
1204:                            .getCurrentTimeout("DiagramElementOperator.WaitDiagramElementTime");
1205:                    JemmyProperties.setCurrentTimeout(
1206:                            "DiagramElementOperator.WaitDiagramElementTime",
1207:                            2000);
1208:                    try {
1209:                        for (int i = 0; i < elementNames.size(); i++) {
1210:                            String elName = elementNames.get(i);
1211:                            new DiagramElementOperator(dia, elName);
1212:                        }
1213:                    } catch (Exception e) {
1214:                        if (log != null) {
1215:                            e.printStackTrace(log);
1216:                        }
1217:                        return false;
1218:                    } finally {
1219:                        JemmyProperties
1220:                                .setCurrentTimeout(
1221:                                        "DiagramElementOperator.WaitDiagramElementTime",
1222:                                        timeoutVal);
1223:                    }
1224:
1225:                    return true;
1226:                } catch (Exception e) {
1227:                    if (log != null) {
1228:                        e.printStackTrace(log);
1229:                    }
1230:                    return false;
1231:                } finally {
1232:                    safeDeleteAllElements();
1233:                }
1234:            }
1235:
1236:            public boolean checkShowParentsOneLevel(int levelsNum,
1237:                    int elementsOnLevel, LinkTypes linkType,
1238:                    ElementTypes childType) {
1239:                final String EL_NAME = "ShPOne";//+elementType.toString().substring(0, 2);
1240:
1241:                try {
1242:                    //create main element:
1243:                    Point point = dia.getDrawingArea().getFreePoint();
1244:                    DiagramElementOperator el = createElement(EL_NAME,
1245:                            elementType, point.x, point.y);
1246:                    eventTool.waitNoEvent(500);
1247:                    //creating children Elements
1248:                    ArrayList<String> elementNames = createLinkedElements(el,
1249:                            0, elementsOnLevel, levelsNum, EL_NAME, linkType,
1250:                            childType, true);
1251:
1252:                    //hiding children 1 level
1253:                    eventTool.waitNoEvent(500);
1254:                    dia.toolbar().selectDefault();
1255:                    new HideParentsAllLevelsElementAction().performPopup(el);
1256:                    eventTool.waitNoEvent(500);
1257:                    new ShowParentsOneLevelElementAction().performPopup(el);
1258:
1259:                    //gathering 1 level children element' names
1260:                    ArrayList<String> parents = new ArrayList<String>();
1261:                    for (int j = 0; j < elementsOnLevel; j++) {
1262:                        parents.add(EL_NAME + "C" + j);
1263:                    }
1264:                    eventTool.waitNoEvent(1000);
1265:
1266:                    //checking everything was hidden correctly
1267:                    long timeoutVal = JemmyProperties
1268:                            .getCurrentTimeout("DiagramElementOperator.WaitDiagramElementTime");
1269:                    JemmyProperties.setCurrentTimeout(
1270:                            "DiagramElementOperator.WaitDiagramElementTime",
1271:                            2000);
1272:                    try {
1273:                        for (int i = 0; i < elementNames.size(); i++) {
1274:                            String elName = elementNames.get(i);
1275:                            if (!(parents.indexOf(elName) > -1)) {
1276:                                try {
1277:                                    DiagramElementOperator op = new DiagramElementOperator(
1278:                                            dia, elName, childType, 0);
1279:                                    log("Element '" + elName
1280:                                            + "' not found on diagram");
1281:                                    return false;
1282:                                } catch (Exception tee) {
1283:                                }
1284:                            } else {
1285:                                new LinkOperator(
1286:                                        el,
1287:                                        new DiagramElementOperator(dia, elName),
1288:                                        linkType);
1289:                            }
1290:                        }
1291:                    } catch (Exception e) {
1292:                        if (log != null) {
1293:                            e.printStackTrace(log);
1294:                        }
1295:                        return false;
1296:                    } finally {
1297:                        JemmyProperties
1298:                                .setCurrentTimeout(
1299:                                        "DiagramElementOperator.WaitDiagramElementTime",
1300:                                        timeoutVal);
1301:                    }
1302:
1303:                    return true;
1304:                } catch (Exception e) {
1305:                    if (log != null) {
1306:                        e.printStackTrace(log);
1307:                    }
1308:                    return false;
1309:                } finally {
1310:                    safeDeleteAllElements();
1311:                }
1312:            }
1313:
1314:            public boolean checkShowParentsAllLevels(int levelsNum,
1315:                    int elementsOnLevel, LinkTypes linkType,
1316:                    ElementTypes childType) {
1317:                final String EL_NAME = "ShPAll";//+elementType.toString().substring(0, 2);
1318:                try {
1319:                    //create main element:
1320:                    Point point = dia.getDrawingArea().getFreePoint();
1321:                    DiagramElementOperator el = createElement(EL_NAME,
1322:                            elementType, point.x, point.y);
1323:                    eventTool.waitNoEvent(500);
1324:                    //creating children Elements
1325:                    ArrayList<String> elementNames = createLinkedElements(el,
1326:                            0, elementsOnLevel, levelsNum, EL_NAME, linkType,
1327:                            childType, true);
1328:
1329:                    //hiding children 1 level
1330:                    eventTool.waitNoEvent(500);
1331:                    dia.toolbar().selectDefault();
1332:                    new HideParentsAllLevelsElementAction().performPopup(el);
1333:                    eventTool.waitNoEvent(500);
1334:                    new ShowParentsAllLevelsElementAction().performPopup(el);
1335:                    eventTool.waitNoEvent(1000);
1336:
1337:                    //checking everything was hidden correctly
1338:                    long timeoutVal = JemmyProperties
1339:                            .getCurrentTimeout("DiagramElementOperator.WaitDiagramElementTime");
1340:                    JemmyProperties.setCurrentTimeout(
1341:                            "DiagramElementOperator.WaitDiagramElementTime",
1342:                            2000);
1343:                    try {
1344:                        for (int i = 0; i < elementNames.size(); i++) {
1345:                            String elName = elementNames.get(i);
1346:                            DiagramElementOperator op = new DiagramElementOperator(
1347:                                    dia, elName, childType, 0);
1348:                        }
1349:                    } catch (Exception e) {
1350:                        if (log != null) {
1351:                            e.printStackTrace(log);
1352:                        }
1353:                        return false;
1354:                    } finally {
1355:                        JemmyProperties
1356:                                .setCurrentTimeout(
1357:                                        "DiagramElementOperator.WaitDiagramElementTime",
1358:                                        timeoutVal);
1359:                    }
1360:                    return true;
1361:                } catch (Exception e) {
1362:                    if (log != null) {
1363:                        e.printStackTrace(log);
1364:                    }
1365:                    return false;
1366:                } finally {
1367:                    safeDeleteAllElements();
1368:                }
1369:            }
1370:
1371:            public boolean checkFont(int fontSize, String fontFamily,
1372:                    boolean isBold, boolean isItalic) {
1373:                final String EL_NAME = "Fnt";// + elementType.toString().substring(0, 2);
1374:                try {
1375:                    //create main element:
1376:                    Point point = dia.getDrawingArea().getFreePoint();
1377:                    final DiagramElementOperator el = createElement(EL_NAME,
1378:                            elementType, point.x, point.y);
1379:                    eventTool.waitNoEvent(500);
1380:                    //creating children Elements
1381:
1382:                    //invoking Font Dialof
1383:                    eventTool.waitNoEvent(500);
1384:                    new Thread(new Runnable() {
1385:                        public void run() {
1386:                            new FontElementAction(elementType).performPopup(el);
1387:                        }
1388:                    }).start();
1389:
1390:                    //setting the font
1391:                    JDialogOperator fontDlg = new JDialogOperator(FONT_DLG);
1392:                    eventTool.waitNoEvent(1000);
1393:                    //setting font family
1394:                    if ((fontFamily != null) && (fontFamily.length() != 0)) {
1395:                        JListOperator list = new JListOperator(fontDlg, 0);
1396:                        int index = list.findItemIndex(fontFamily);
1397:                        log("index for element '" + fontFamily + " ' = "
1398:                                + index);
1399:                        if (index >= 0) {
1400:                            list.selectItem(index);
1401:                        }
1402:                    }
1403:                    //setting font size
1404:                    new JListOperator(fontDlg, 1).selectItem(String
1405:                            .valueOf(fontSize));
1406:                    //setting bold
1407:                    new JCheckBoxOperator(fontDlg, BOLD_CHB)
1408:                            .changeSelection(isBold);
1409:                    //setting italic
1410:                    new JCheckBoxOperator(fontDlg, ITALIC_CHB)
1411:                            .changeSelection(isItalic);
1412:
1413:                    eventTool.waitNoEvent(500);
1414:                    new JButtonOperator(fontDlg, OK_BTN).push();
1415:
1416:                    eventTool.waitNoEvent(2000);
1417:
1418:                    //checking everything was changed correctly
1419:                    DiagramElementOperator elem = getElement(EL_NAME,
1420:                            elementType, 0);
1421:                    Font font = new CompartmentOperator(elem,
1422:                            CompartmentTypes.NAME_COMPARTMENT).getFont();
1423:
1424:                    if (font == null) {
1425:                        log("Font is null");
1426:                        return false;
1427:                    }
1428:
1429:                    if (!font.getFamily().equals(fontFamily)
1430:                            || !(font.getSize() == fontSize)
1431:                            || !(font.isBold() == isBold)
1432:                            || !(font.isItalic() == isItalic)) {
1433:                        log("Font failed: " + font.getFamily() + " "
1434:                                + font.getSize() + " " + font.isBold() + " "
1435:                                + font.isItalic());
1436:                        log(elem.getFont().toString());
1437:                        return false;
1438:                    }
1439:
1440:                    return true;
1441:                } catch (Exception e) {
1442:                    if (log != null) {
1443:                        e.printStackTrace(log);
1444:                    }
1445:                    return false;
1446:                } finally {
1447:                    safeDeleteAllElements();
1448:                }
1449:            }
1450:
1451:            public boolean checkFont() {
1452:                final String fontFamily = "Arial";
1453:                final int fontSize = 24;
1454:                final boolean isBold = true;
1455:                final boolean isItalic = true;
1456:
1457:                return checkFont(fontSize, fontFamily, isBold, isItalic);
1458:            }
1459:
1460:            public boolean checkBorderColor(int red, int green, int blue) {
1461:                final String EL_NAME = "BrdClr";//+elementType.toString().substring(0, 2);
1462:                try {
1463:                    //create main element:
1464:                    Point point = dia.getDrawingArea().getFreePoint();
1465:                    final DiagramElementOperator el = createElement(EL_NAME,
1466:                            elementType, point.x, point.y);
1467:                    eventTool.waitNoEvent(500);
1468:                    //creating children Elements
1469:
1470:                    //invoking Font Dialof
1471:                    eventTool.waitNoEvent(500);
1472:                    new Thread(new Runnable() {
1473:                        public void run() {
1474:                            new BorderColorElementAction(elementType)
1475:                                    .performPopup(el);
1476:                        }
1477:                    }).start();
1478:
1479:                    //setting the color
1480:                    setColor(new JDialogOperator(), red, green, blue);
1481:
1482:                    eventTool.waitNoEvent(2000);
1483:
1484:                    //checking everything was changed correctly
1485:                    DiagramElementOperator elem = getElement(EL_NAME,
1486:                            elementType, 0);
1487:                    Color color = new CompartmentOperator(elem,
1488:                            CompartmentTypes.NAME_COMPARTMENT).getBorderColor();
1489:                    if (!colorsEqual(color, new Color(red, green, blue))) {
1490:                        log("Border color failed: (" + color.getRed() + ", "
1491:                                + color.getGreen() + ", " + color.getBlue()
1492:                                + ")");
1493:                        return false;
1494:                    }
1495:
1496:                    return true;
1497:                } catch (Exception e) {
1498:                    if (log != null) {
1499:                        e.printStackTrace(log);
1500:                    }
1501:                    return false;
1502:                } finally {
1503:                    safeDeleteAllElements();
1504:                }
1505:            }
1506:
1507:            public boolean checkBackgroundColor(int red, int green, int blue) {
1508:                final String EL_NAME = "BgClr";//+elementType.toString().substring(0, 2);
1509:                Color checkColor = null;
1510:                try {
1511:                    //create main element:
1512:                    Point point = dia.getDrawingArea().getFreePoint();
1513:                    final DiagramElementOperator el = createElement(EL_NAME,
1514:                            elementType, point.x, point.y);
1515:                    eventTool.waitNoEvent(500);
1516:
1517:                    // remember old fillColor and lightGradientFillColor
1518:                    CompartmentOperator elCompartment = new CompartmentOperator(
1519:                            el, CompartmentTypes.NAME_COMPARTMENT);
1520:                    Color fillColorOld = elCompartment.getFillColor();
1521:                    Color lightGradientFillColorOld = elCompartment
1522:                            .getLightGradientFillColor();
1523:
1524:                    //invoking Font Dialof
1525:                    eventTool.waitNoEvent(500);
1526:                    new Thread(new Runnable() {
1527:                        public void run() {
1528:                            new BackgroundColorElementAction(elementType)
1529:                                    .performPopup(el);
1530:                        }
1531:                    }).start();
1532:
1533:                    //setting the color
1534:                    setColor(new JDialogOperator(), red, green, blue);
1535:
1536:                    eventTool.waitNoEvent(2000);
1537:
1538:                    // get new fillColor and lightGradientFillColor
1539:                    DiagramElementOperator elem = getElement(EL_NAME,
1540:                            elementType, 0);
1541:                    CompartmentOperator elemCompartment = new CompartmentOperator(
1542:                            elem, CompartmentTypes.NAME_COMPARTMENT);
1543:                    Color fillColorNew = elemCompartment.getFillColor();
1544:                    Color lightGradientFillColorNew = elemCompartment
1545:                            .getLightGradientFillColor();
1546:                    //Select which of colors was changed
1547:                    if (!colorsEqual(fillColorOld, fillColorNew)) {
1548:                        checkColor = fillColorNew;
1549:                    } else if (!colorsEqual(lightGradientFillColorOld,
1550:                            lightGradientFillColorNew)) {
1551:                        checkColor = lightGradientFillColorNew;
1552:                    } else {
1553:                        log("Neither fillColor Nor lightGradientFillColor was changed");
1554:                        return false;
1555:                    }
1556:
1557:                    //checking everything was changed correctly
1558:                    if (!colorsEqual(checkColor, new Color(red, green, blue))) {
1559:                        log("Background color failed: (" + checkColor.getRed()
1560:                                + ", " + checkColor.getGreen() + ", "
1561:                                + checkColor.getBlue() + ")");
1562:                        return false;
1563:                    }
1564:
1565:                    return true;
1566:                } catch (Exception e) {
1567:                    if (log != null) {
1568:                        e.printStackTrace(log);
1569:                    }
1570:                    return false;
1571:                } finally {
1572:                    safeDeleteAllElements();
1573:                }
1574:            }
1575:
1576:            public boolean checkFontColor(int red, int green, int blue) {
1577:                final String EL_NAME = "FntClr";//+elementType.toString().substring(0, 2);
1578:                try {
1579:                    //create main element:
1580:                    Point point = dia.getDrawingArea().getFreePoint();
1581:                    final DiagramElementOperator el = createElement(EL_NAME,
1582:                            elementType, point.x, point.y);
1583:                    eventTool.waitNoEvent(500);
1584:                    //creating children Elements
1585:
1586:                    //invoking Font Dialof
1587:                    eventTool.waitNoEvent(500);
1588:                    new Thread(new Runnable() {
1589:                        public void run() {
1590:                            new FontColorElementAction(elementType)
1591:                                    .performPopup(el);
1592:                        }
1593:                    }).start();
1594:
1595:                    //setting the color
1596:                    setColor(new JDialogOperator(), red, green, blue);
1597:
1598:                    eventTool.waitNoEvent(2000);
1599:
1600:                    //checking everything was changed correctly
1601:                    DiagramElementOperator elem = getElement(EL_NAME,
1602:                            elementType, 0);
1603:                    Color color = new CompartmentOperator(elem,
1604:                            CompartmentTypes.NAME_COMPARTMENT).getFontColor();
1605:
1606:                    if (!colorsEqual(color, new Color(red, green, blue))) {
1607:                        log("Font color failed: (" + color.getRed() + ", "
1608:                                + color.getGreen() + ", " + color.getBlue()
1609:                                + ")");
1610:                        return false;
1611:                    }
1612:
1613:                    return true;
1614:                } catch (Exception e) {
1615:                    if (log != null) {
1616:                        e.printStackTrace(log);
1617:                    }
1618:                    return false;
1619:                } finally {
1620:                    safeDeleteAllElements();
1621:                }
1622:            }
1623:
1624:            //------------------------------------------------------------------------------
1625:
1626:            private boolean colorsEqual(Color color1, Color color2) {
1627:                boolean equality = false;
1628:                if ((color1 != null) && (color2 != null))
1629:                    equality = ((color1.getRed() == color2.getRed())
1630:                            && (color1.getGreen() == color2.getGreen()) && (color1
1631:                            .getBlue() == color2.getBlue()));
1632:                return equality;
1633:
1634:            }
1635:
1636:            private void setColor(JDialogOperator dlg, int red, int green,
1637:                    int blue) {
1638:                JTabbedPaneOperator tabbedPane = new JTabbedPaneOperator(dlg);
1639:                tabbedPane.selectPage("RGB");
1640:
1641:                new JTextComponentOperator(tabbedPane, 0).clearText();
1642:                new JTextComponentOperator(tabbedPane, 0).typeText(String
1643:                        .valueOf(red));
1644:
1645:                new JTextComponentOperator(tabbedPane, 1).clearText();
1646:                new JTextComponentOperator(tabbedPane, 1).typeText(String
1647:                        .valueOf(green));
1648:
1649:                new JTextComponentOperator(tabbedPane, 2).clearText();
1650:                new JTextComponentOperator(tabbedPane, 2).typeText(String
1651:                        .valueOf(blue));
1652:
1653:                eventTool.waitNoEvent(3500);
1654:                JButtonOperator btn = new JButtonOperator(dlg, OK_BTN);
1655:                new MouseRobotDriver(new Timeout("", 10)).clickMouse(btn, btn
1656:                        .getCenterXForClick(), btn.getCenterYForClick(), 1,
1657:                        InputEvent.BUTTON1_MASK, 0, new Timeout("", 10));
1658:            }
1659:
1660:            private ArrayList<String> getStandardLinkedElementNames(
1661:                    String baseName, int level, int elNum, int levelsTotal) {
1662:                ArrayList<String> names = new ArrayList<String>();
1663:                if (level >= levelsTotal) {
1664:                    return names;
1665:                }
1666:                for (int i = 0; i < elNum; i++) {
1667:                    names.add(baseName + "C" + i);
1668:                    ArrayList<String> al = getStandardLinkedElementNames(
1669:                            baseName + "C" + i, level + 1, elNum, levelsTotal);
1670:                    names.addAll(al);
1671:                }
1672:                return names;
1673:            }
1674:
1675:            private ArrayList<String> createLinkedElements(
1676:                    DiagramElementOperator parent, int level,
1677:                    int elementsOnLevel, int levelsTotal, String baseName,
1678:                    LinkTypes linkType, ElementTypes childType,
1679:                    boolean createParents) throws NotFoundException {
1680:                ArrayList<String> names = new ArrayList<String>();
1681:                if (level >= levelsTotal) {
1682:                    return names;
1683:                }
1684:                for (int i = 0; i < elementsOnLevel; i++) {
1685:                    DiagramElementOperator el = createLinkedElement(parent,
1686:                            childType, linkType, baseName + "C" + i,
1687:                            createParents);
1688:                    names.add(baseName + "C" + i);
1689:                    ArrayList<String> al = createLinkedElements(el, level + 1,
1690:                            elementsOnLevel, levelsTotal, baseName + "C" + i,
1691:                            linkType, childType, createParents);
1692:                    names.addAll(al);
1693:                }
1694:                return names;
1695:            }
1696:
1697:            private DiagramElementOperator createLinkedElement(
1698:                    DiagramElementOperator existingEl, ElementTypes newElType,
1699:                    LinkTypes linkType, String childName, boolean createParent)
1700:                    throws NotFoundException {
1701:                Point point = dia.getDrawingArea().getFreePoint(140);
1702:                DiagramElementOperator el = createElement(childName, newElType,
1703:                        point.x, point.y);
1704:                eventTool.waitNoEvent(500);
1705:                if (createParent) {
1706:                    dia.createLinkOnDiagram(linkType, existingEl, el);
1707:                } else {
1708:                    dia.createLinkOnDiagram(linkType, el, existingEl);
1709:                }
1710:                eventTool.waitNoEvent(500);
1711:                return el;
1712:            }
1713:
1714:            public void safeDeleteElement(String elementName) {
1715:                long timeoutVal = JemmyProperties
1716:                        .getCurrentTimeout("DiagramElementOperator.WaitDiagramElementTime");
1717:                JemmyProperties.setCurrentTimeout(
1718:                        "DiagramElementOperator.WaitDiagramElementTime", 2000);
1719:                eventTool.waitNoEvent(500);
1720:                try {
1721:                    final DiagramElementOperator el = new DiagramElementOperator(
1722:                            dia, elementName);
1723:                    //deleting the element
1724:                    new Thread(new Runnable() {
1725:                        public void run() {
1726:                            new JCheckBoxOperator(new JDialogOperator(
1727:                                    DELETE_DLG)).clickMouse();
1728:                            new JButtonOperator(
1729:                                    new JDialogOperator(DELETE_DLG), YES_BTN)
1730:                                    .push();
1731:                            if (el.getElementType().equals(
1732:                                    ElementTypes.PACKAGE.toString())) {
1733:                                eventTool.waitNoEvent(500);
1734:                                new JButtonOperator(new JDialogOperator(
1735:                                        DELETE_PKG_DLG), YES_BTN).push();
1736:                            }
1737:                        }
1738:                    }).start();
1739:
1740:                    new DeleteElementAction().performShortcut(el);
1741:                } catch (Exception e) {
1742:                } finally {
1743:                    JemmyProperties.setCurrentTimeout(
1744:                            "DiagramElementOperator.WaitDiagramElementTime",
1745:                            timeoutVal);
1746:                }
1747:            }
1748:
1749:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.