Source Code Cross Referenced for AbstractSoapUIDesktop.java in  » Web-Services » soapui-1.7.5 » com » eviware » soapui » ui » desktop » 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 » Web Services » soapui 1.7.5 » com.eviware.soapui.ui.desktop 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  soapUI, copyright (C) 2004-2007 eviware.com 
003:         *
004:         *  soapUI is free software; you can redistribute it and/or modify it under the 
005:         *  terms of version 2.1 of the GNU Lesser General Public License as published by 
006:         *  the Free Software Foundation.
007:         *
008:         *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
009:         *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
010:         *  See the GNU Lesser General Public License for more details at gnu.org.
011:         */
012:
013:        package com.eviware.soapui.ui.desktop;
014:
015:        import java.util.HashSet;
016:        import java.util.Set;
017:
018:        import com.eviware.soapui.model.ModelItem;
019:        import com.eviware.soapui.model.iface.Interface;
020:        import com.eviware.soapui.model.iface.Operation;
021:        import com.eviware.soapui.model.iface.Request;
022:        import com.eviware.soapui.model.mock.MockOperation;
023:        import com.eviware.soapui.model.mock.MockResponse;
024:        import com.eviware.soapui.model.mock.MockService;
025:        import com.eviware.soapui.model.project.Project;
026:        import com.eviware.soapui.model.support.InterfaceListenerAdapter;
027:        import com.eviware.soapui.model.support.MockServiceListenerAdapter;
028:        import com.eviware.soapui.model.support.ProjectListenerAdapter;
029:        import com.eviware.soapui.model.support.TestSuiteListenerAdapter;
030:        import com.eviware.soapui.model.support.WorkspaceListenerAdapter;
031:        import com.eviware.soapui.model.testsuite.LoadTest;
032:        import com.eviware.soapui.model.testsuite.TestCase;
033:        import com.eviware.soapui.model.testsuite.TestStep;
034:        import com.eviware.soapui.model.testsuite.TestSuite;
035:        import com.eviware.soapui.model.workspace.Workspace;
036:        import com.eviware.soapui.support.action.swing.ActionList;
037:
038:        /**
039:         * Abstract SoapUIDesktop implementation for extension
040:         * 
041:         * @author ole.matzura
042:         */
043:
044:        public abstract class AbstractSoapUIDesktop implements  SoapUIDesktop {
045:            private final Workspace workspace;
046:            private final InternalProjectListener projectListener = new InternalProjectListener();
047:            private final InternalInterfaceListener interfaceListener = new InternalInterfaceListener();
048:            private final InternalTestSuiteListener testSuiteListener = new InternalTestSuiteListener();
049:            private final InternalMockServiceListener mockServiceListener = new InternalMockServiceListener();
050:            private Set<DesktopListener> listeners = new HashSet<DesktopListener>();
051:            private InternalWorkspaceListener workspaceListener = new InternalWorkspaceListener();
052:
053:            public AbstractSoapUIDesktop(Workspace workspace) {
054:                this .workspace = workspace;
055:
056:                initListeners();
057:            }
058:
059:            private void initListeners() {
060:                workspace.addWorkspaceListener(workspaceListener);
061:
062:                for (int c = 0; c < workspace.getProjectCount(); c++) {
063:                    listenToProject(workspace.getProjectAt(c));
064:                }
065:            }
066:
067:            public ActionList getActions() {
068:                return null;
069:            }
070:
071:            private void listenToProject(Project project) {
072:                project.addProjectListener(projectListener);
073:
074:                for (int i = 0; i < project.getInterfaceCount(); i++) {
075:                    project.getInterfaceAt(i).addInterfaceListener(
076:                            interfaceListener);
077:                }
078:
079:                for (int i = 0; i < project.getTestSuiteCount(); i++) {
080:                    project.getTestSuiteAt(i).addTestSuiteListener(
081:                            testSuiteListener);
082:                }
083:
084:                for (int i = 0; i < project.getMockServiceCount(); i++) {
085:                    project.getMockServiceAt(i).addMockServiceListener(
086:                            mockServiceListener);
087:                }
088:            }
089:
090:            public void addDesktopListener(DesktopListener listener) {
091:                listeners.add(listener);
092:            }
093:
094:            public void removeDesktopListener(DesktopListener listener) {
095:                listeners.remove(listener);
096:            }
097:
098:            public void closeDependantPanels(ModelItem modelItem) {
099:                DesktopPanel[] panels = getDesktopPanels();
100:
101:                for (int c = 0; c < panels.length; c++) {
102:                    if (panels[c].dependsOn(modelItem)) {
103:                        closeDesktopPanel(panels[c]);
104:                    }
105:                }
106:            }
107:
108:            protected void fireDesktopPanelCreated(DesktopPanel desktopPanel) {
109:                if (!listeners.isEmpty()) {
110:                    DesktopListener[] array = listeners
111:                            .toArray(new DesktopListener[listeners.size()]);
112:                    for (DesktopListener listener : array)
113:                        listener.desktopPanelCreated(desktopPanel);
114:                }
115:            }
116:
117:            protected void fireDesktopPanelSelected(DesktopPanel desktopPanel) {
118:                if (!listeners.isEmpty()) {
119:                    DesktopListener[] array = listeners
120:                            .toArray(new DesktopListener[listeners.size()]);
121:                    for (DesktopListener listener : array)
122:                        listener.desktopPanelSelected(desktopPanel);
123:                }
124:            }
125:
126:            protected void fireDesktopPanelClosed(DesktopPanel desktopPanel) {
127:                if (!listeners.isEmpty()) {
128:                    DesktopListener[] array = listeners
129:                            .toArray(new DesktopListener[listeners.size()]);
130:                    for (DesktopListener listener : array)
131:                        listener.desktopPanelClosed(desktopPanel);
132:                }
133:            }
134:
135:            private class InternalWorkspaceListener extends
136:                    WorkspaceListenerAdapter {
137:                public void projectRemoved(Project project) {
138:                    project.removeProjectListener(projectListener);
139:                    closeDependantPanels(project);
140:                }
141:
142:                public void projectAdded(Project project) {
143:                    listenToProject(project);
144:                }
145:            }
146:
147:            private class InternalProjectListener extends
148:                    ProjectListenerAdapter {
149:                public void interfaceRemoved(Interface iface) {
150:                    iface.removeInterfaceListener(interfaceListener);
151:                    closeDependantPanels(iface);
152:                }
153:
154:                public void testSuiteRemoved(TestSuite testSuite) {
155:                    testSuite.removeTestSuiteListener(testSuiteListener);
156:                    closeDependantPanels(testSuite);
157:                }
158:
159:                public void interfaceAdded(Interface iface) {
160:                    iface.addInterfaceListener(interfaceListener);
161:                }
162:
163:                public void testSuiteAdded(TestSuite testSuite) {
164:                    testSuite.addTestSuiteListener(testSuiteListener);
165:                }
166:
167:                public void mockServiceAdded(MockService mockService) {
168:                    mockService.addMockServiceListener(mockServiceListener);
169:                }
170:
171:                public void mockServiceRemoved(MockService mockService) {
172:                    mockService.removeMockServiceListener(mockServiceListener);
173:                    closeDependantPanels(mockService);
174:                }
175:            }
176:
177:            private class InternalInterfaceListener extends
178:                    InterfaceListenerAdapter {
179:                public void operationRemoved(Operation operation) {
180:                    closeDependantPanels(operation);
181:                }
182:
183:                public void requestRemoved(Request request) {
184:                    closeDependantPanels(request);
185:                }
186:            }
187:
188:            private class InternalTestSuiteListener extends
189:                    TestSuiteListenerAdapter {
190:                public void testCaseRemoved(TestCase testCase) {
191:                    closeDependantPanels(testCase);
192:                }
193:
194:                public void testStepRemoved(TestStep testStep, int index) {
195:                    closeDependantPanels(testStep);
196:                }
197:
198:                public void loadTestRemoved(LoadTest loadTest) {
199:                    closeDependantPanels(loadTest);
200:                }
201:            }
202:
203:            private class InternalMockServiceListener extends
204:                    MockServiceListenerAdapter {
205:                public void mockOperationRemoved(MockOperation operation) {
206:                    closeDependantPanels(operation);
207:                }
208:
209:                public void mockResponseRemoved(MockResponse request) {
210:                    closeDependantPanels(request);
211:                }
212:            }
213:
214:            public void release() {
215:                for (int c = 0; c < workspace.getProjectCount(); c++) {
216:                    Project project = workspace.getProjectAt(c);
217:                    project.removeProjectListener(projectListener);
218:
219:                    for (int i = 0; i < project.getInterfaceCount(); i++) {
220:                        project.getInterfaceAt(i).removeInterfaceListener(
221:                                interfaceListener);
222:                    }
223:
224:                    for (int i = 0; i < project.getTestSuiteCount(); i++) {
225:                        project.getTestSuiteAt(i).removeTestSuiteListener(
226:                                testSuiteListener);
227:                    }
228:
229:                    for (int i = 0; i < project.getMockServiceCount(); i++) {
230:                        project.getMockServiceAt(i).removeMockServiceListener(
231:                                mockServiceListener);
232:                    }
233:                }
234:
235:                workspace.removeWorkspaceListener(workspaceListener);
236:            }
237:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.