Source Code Cross Referenced for XSLTEditorOperator.java in  » IDE-Netbeans » soa » org » netbeans » test » xslt » lib » 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 » soa » org.netbeans.test.xslt.lib 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the terms of the Common Development
003:         * and Distribution License (the License). You may not use this file except in
004:         * compliance with the License.
005:         *
006:         * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007:         * or http://www.netbeans.org/cddl.txt.
008:
009:         * When distributing Covered Code, include this CDDL Header Notice in each file
010:         * and include the License file at http://www.netbeans.org/cddl.txt.
011:         * If applicable, add the following below the CDDL Header, with the fields
012:         * enclosed by brackets [] replaced by your own identifying information:
013:         * "Portions Copyrighted [year] [name of copyright owner]"
014:         *
015:         * The Original Software is NetBeans. The Initial Developer of the Original
016:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017:         * Microsystems, Inc. All Rights Reserved.
018:         */
019:
020:        package org.netbeans.test.xslt.lib;
021:
022:        import java.awt.Point;
023:        import java.awt.Rectangle;
024:        import java.awt.event.InputEvent;
025:        import java.awt.event.KeyEvent;
026:        import org.netbeans.jellytools.MainWindowOperator;
027:        import org.netbeans.jemmy.Timeout;
028:        import org.netbeans.jemmy.drivers.input.KeyRobotDriver;
029:        import org.netbeans.jemmy.drivers.input.MouseRobotDriver;
030:        import org.netbeans.jemmy.operators.JComponentOperator;
031:        import org.netbeans.jemmy.operators.JToggleButtonOperator;
032:
033:        /**
034:         *
035:         * @author ca@netbeans.org
036:         */
037:
038:        public class XSLTEditorOperator {
039:            private SourceTreeOperator m_opSourceTree;
040:            private TargetTreeOperator m_opTargetTree;
041:            private CanvasOperator m_opCanvas;
042:            private PaletteOperator m_opPalette;
043:
044:            private JToggleButtonOperator m_opDesignButton;
045:            private JToggleButtonOperator m_opSourceButton;
046:
047:            private JComponentOperator m_opEditor;
048:            private MouseRobotDriver m_mouseDriver;
049:            private KeyRobotDriver m_keyDriver;
050:
051:            /**
052:             * Creates a new instance of XSLTEditorOperator 
053:             */
054:            public XSLTEditorOperator(String strEditorName) {
055:                JComponentOperator opComponent = Helpers
056:                        .getComponentOperator(
057:                                MainWindowOperator.getDefault(),
058:                                "org.netbeans.core.multiview.MultiViewCloneableTopComponent",
059:                                strEditorName);
060:
061:                m_opEditor = Helpers.getComponentOperator(opComponent,
062:                        "org.netbeans.modules.xslt.mapper.view.XsltMapper");
063:
064:                m_opCanvas = new CanvasOperator(m_opEditor);
065:                m_opSourceTree = new SourceTreeOperator(m_opEditor);
066:                m_opTargetTree = new TargetTreeOperator(m_opEditor);
067:                m_opPalette = new PaletteOperator();
068:
069:                JComponentOperator opToolbar = Helpers.getComponentOperator(
070:                        opComponent, "javax.swing.JToolBar");
071:
072:                m_opDesignButton = new JToggleButtonOperator(opToolbar,
073:                        "Design");
074:                m_opSourceButton = new JToggleButtonOperator(opToolbar,
075:                        "Source");
076:
077:                m_mouseDriver = new MouseRobotDriver(new Timeout("", 500));
078:                m_keyDriver = new KeyRobotDriver(new Timeout("", 50));
079:            }
080:
081:            public CanvasOperator getCanvasOperator() {
082:                return m_opCanvas;
083:            }
084:
085:            public void bindSourceToTarget(String sourceTreePath,
086:                    String targetTreePath) {
087:                Point startPoint = m_opSourceTree
088:                        .prepareNodeForClick(sourceTreePath);
089:                Point endPoint = m_opTargetTree
090:                        .prepareNodeForClick(targetTreePath);
091:
092:                performDragAndDrop(m_opSourceTree, startPoint, m_opTargetTree,
093:                        endPoint);
094:            }
095:
096:            public void bindSourceToMethoid(String sourceTreePath,
097:                    String strMethoidTitle, int methoidIndex,
098:                    int methiodPortIndex) {
099:                Point startPoint = m_opSourceTree
100:                        .prepareNodeForClick(sourceTreePath);
101:
102:                MethoidOperator opMethoid = m_opCanvas.findMethoid(
103:                        strMethoidTitle, methoidIndex);
104:                Point endPoint = opMethoid.getPortPoint(methiodPortIndex);
105:
106:                performDragAndDrop(m_opSourceTree, startPoint, m_opCanvas,
107:                        endPoint);
108:            }
109:
110:            public void bindMethoidToTarget(String strMethoidTitle,
111:                    int methoidIndex, String targetTreePath) {
112:                MethoidOperator opMethoid = m_opCanvas.findMethoid(
113:                        strMethoidTitle, methoidIndex);
114:                Point startPoint = opMethoid.getPortPoint(opMethoid
115:                        .getPortCount() - 1);
116:
117:                Point endPoint = m_opTargetTree
118:                        .prepareNodeForClick(targetTreePath);
119:
120:                performDragAndDrop(m_opCanvas, startPoint, m_opTargetTree,
121:                        endPoint);
122:            }
123:
124:            public void bindMethoidToMethiod(String strSrcMethoidTitle,
125:                    int srcMethoidIndex, int srcMethiodPortIndex,
126:                    String strDstMethoidTitle, int dstMethoidIndex,
127:                    int dstMethiodPortIndex) {
128:                MethoidOperator opSrcMethoid = m_opCanvas.findMethoid(
129:                        strSrcMethoidTitle, srcMethoidIndex);
130:                Point startPoint = opSrcMethoid
131:                        .getPortPoint(srcMethiodPortIndex);
132:
133:                MethoidOperator opDstMethoid = m_opCanvas.findMethoid(
134:                        strDstMethoidTitle, dstMethoidIndex);
135:                Point endPoint = opDstMethoid.getPortPoint(dstMethiodPortIndex);
136:
137:                performDragAndDrop(m_opCanvas, startPoint, m_opCanvas, endPoint);
138:            }
139:
140:            public void dropPaletteItemOnCanvas(PaletteOperator.Groups group,
141:                    String strItem, Point canvasPoint) {
142:                Point palettePoint = m_opPalette.prepareNodeForClick(group,
143:                        strItem);
144:
145:                performDragAndDrop(m_opPalette, palettePoint, m_opCanvas,
146:                        canvasPoint);
147:                Helpers.waitNoEvent();
148:            }
149:
150:            public void removeMethoid(String strTitle, int index) {
151:                MethoidOperator opMethoid = m_opCanvas.findMethoid(strTitle,
152:                        index);
153:                Rectangle rect = opMethoid.getBoundings();
154:                Point clickPoint = new Point(rect.x + 1, rect.y + 1);
155:                m_mouseDriver.clickMouse(m_opCanvas, clickPoint.x,
156:                        clickPoint.y, 1, InputEvent.BUTTON1_MASK, 0,
157:                        new Timeout("t1", 50));
158:
159:                m_keyDriver.pushKey(m_opCanvas, KeyEvent.VK_DELETE, 0,
160:                        new Timeout("t1", 50));
161:                Helpers.waitNoEvent();
162:            }
163:
164:            private void performDragAndDrop(JComponentOperator opFrom,
165:                    Point pointFrom, JComponentOperator opTo, Point pointTo) {
166:
167:                //        Doesn't work on Solaris
168:                //        Point p1 = Helpers.getContainerPoint(opFrom, pointFrom, m_opEditor);
169:                //        Point p2 = Helpers.getContainerPoint(opTo, pointTo, m_opEditor);
170:                //        m_mouseDriver.dragNDrop(m_opEditor, p1.x, p1.y, p2.x, p2.y, InputEvent.BUTTON1_MASK, 0, new Timeout("t1", 50), new Timeout("t2", 50));
171:
172:                m_mouseDriver.moveMouse(opFrom, pointFrom.x, pointFrom.y);
173:                m_mouseDriver.pressMouse(InputEvent.BUTTON1_MASK, 0);
174:                m_mouseDriver.enterMouse(opTo);
175:                m_mouseDriver.dragMouse(opTo, pointTo.x, pointTo.y,
176:                        InputEvent.BUTTON1_MASK, 0);
177:                m_mouseDriver.releaseMouse(InputEvent.BUTTON1_MASK, 0);
178:            }
179:
180:            public void switchToDesign() {
181:                m_opDesignButton.push();
182:                Helpers.waitNoEvent();
183:            }
184:
185:            public void switchToSource() {
186:                m_opSourceButton.push();
187:                Helpers.waitNoEvent();
188:            }
189:
190:            public void removeAllTargetNodes(String strRoot) {
191:                m_opTargetTree.ivokeDeleteOnPath(strRoot);
192:            }
193:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.