Source Code Cross Referenced for ProjectTreeNode.java in  » Web-Services » soapui-1.7.5 » com » eviware » soapui » model » tree » nodes » 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.model.tree.nodes 
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.model.tree.nodes;
014:
015:        import java.util.ArrayList;
016:        import java.util.List;
017:
018:        import com.eviware.soapui.model.iface.Interface;
019:        import com.eviware.soapui.model.mock.MockService;
020:        import com.eviware.soapui.model.project.Project;
021:        import com.eviware.soapui.model.project.ProjectListener;
022:        import com.eviware.soapui.model.testsuite.TestSuite;
023:        import com.eviware.soapui.model.tree.AbstractModelItemTreeNode;
024:        import com.eviware.soapui.model.tree.SoapUITreeNode;
025:        import com.eviware.soapui.settings.UISettings;
026:
027:        /**
028:         * SoapUITreeNode for Project implementations
029:         * 
030:         * @author Ole.Matzura
031:         */
032:
033:        public class ProjectTreeNode extends AbstractModelItemTreeNode<Project> {
034:            private InternalProjectListener internalProjectListener;
035:            private List<InterfaceTreeNode> interfaceNodes = new ArrayList<InterfaceTreeNode>();
036:            private List<TestSuiteTreeNode> testSuiteNodes = new ArrayList<TestSuiteTreeNode>();
037:            private List<MockServiceTreeNode> mockServiceNodes = new ArrayList<MockServiceTreeNode>();
038:
039:            public ProjectTreeNode(Project project,
040:                    WorkspaceTreeNode workspaceNode) {
041:                super (project, workspaceNode.getWorkspace(), workspaceNode
042:                        .getTreeModel());
043:
044:                internalProjectListener = new InternalProjectListener();
045:                project.addProjectListener(internalProjectListener);
046:
047:                for (int c = 0; c < project.getInterfaceCount(); c++) {
048:                    interfaceNodes.add(new InterfaceTreeNode(project
049:                            .getInterfaceAt(c), getTreeModel()));
050:                }
051:
052:                for (int c = 0; c < project.getTestSuiteCount(); c++) {
053:                    testSuiteNodes.add(new TestSuiteTreeNode(project
054:                            .getTestSuiteAt(c), getTreeModel()));
055:                }
056:
057:                for (int c = 0; c < project.getMockServiceCount(); c++) {
058:                    mockServiceNodes.add(new MockServiceTreeNode(project
059:                            .getMockServiceAt(c), getTreeModel()));
060:                }
061:
062:                getTreeModel().mapModelItems(interfaceNodes);
063:                getTreeModel().mapModelItems(testSuiteNodes);
064:                getTreeModel().mapModelItems(mockServiceNodes);
065:
066:                initOrdering(testSuiteNodes, UISettings.ORDER_TESTSUITES);
067:            }
068:
069:            public void release() {
070:                super .release();
071:
072:                getProject().removeProjectListener(internalProjectListener);
073:
074:                for (InterfaceTreeNode treeNode : interfaceNodes)
075:                    treeNode.release();
076:
077:                for (TestSuiteTreeNode treeNode : testSuiteNodes)
078:                    treeNode.release();
079:
080:                for (MockServiceTreeNode treeNode : mockServiceNodes)
081:                    treeNode.release();
082:            }
083:
084:            public int getChildCount() {
085:                return interfaceNodes.size() + testSuiteNodes.size()
086:                        + mockServiceNodes.size();
087:            }
088:
089:            public int getIndexOfChild(Object child) {
090:                int index = interfaceNodes.indexOf(child);
091:                if (index >= 0)
092:                    return index;
093:
094:                index = testSuiteNodes.indexOf(child);
095:                if (index >= 0)
096:                    return index + interfaceNodes.size();
097:
098:                index = mockServiceNodes.indexOf(child);
099:                if (index >= 0)
100:                    return index + interfaceNodes.size()
101:                            + testSuiteNodes.size();
102:
103:                return -1;
104:            }
105:
106:            public SoapUITreeNode getChildNode(int index) {
107:                if (index < interfaceNodes.size())
108:                    return interfaceNodes.get(index);
109:                else if (index < testSuiteNodes.size() + interfaceNodes.size())
110:                    return testSuiteNodes.get(index - interfaceNodes.size());
111:                else
112:                    return mockServiceNodes.get(index - interfaceNodes.size()
113:                            - testSuiteNodes.size());
114:            }
115:
116:            public Project getProject() {
117:                return (Project) getModelItem();
118:            }
119:
120:            private class InternalProjectListener implements  ProjectListener {
121:                public void interfaceAdded(Interface iface) {
122:                    InterfaceTreeNode interfaceTreeNode = new InterfaceTreeNode(
123:                            iface, getTreeModel());
124:                    interfaceNodes.add(interfaceTreeNode);
125:                    getTreeModel().notifyNodeInserted(interfaceTreeNode);
126:                }
127:
128:                public void interfaceRemoved(Interface iface) {
129:                    SoapUITreeNode treeNode = getTreeModel().getTreeNode(iface);
130:                    if (interfaceNodes.contains(treeNode)) {
131:                        getTreeModel().notifyNodeRemoved(treeNode);
132:                        interfaceNodes.remove(treeNode);
133:                    } else
134:                        throw new RuntimeException("Removing unkown interface");
135:                }
136:
137:                public void testSuiteAdded(TestSuite testSuite) {
138:                    TestSuiteTreeNode testSuiteNode = new TestSuiteTreeNode(
139:                            testSuite, getTreeModel());
140:                    testSuiteNodes.add(testSuiteNode);
141:                    reorder(false);
142:                    getTreeModel().notifyNodeInserted(testSuiteNode);
143:                }
144:
145:                public void testSuiteRemoved(TestSuite testSuite) {
146:                    SoapUITreeNode treeNode = getTreeModel().getTreeNode(
147:                            testSuite);
148:                    if (testSuiteNodes.contains(treeNode)) {
149:                        getTreeModel().notifyNodeRemoved(treeNode);
150:                        testSuiteNodes.remove(treeNode);
151:                    } else
152:                        throw new RuntimeException("Removing unkown testSuite");
153:                }
154:
155:                public void mockServiceAdded(MockService mockService) {
156:                    MockServiceTreeNode mockServiceNode = new MockServiceTreeNode(
157:                            mockService, getTreeModel());
158:                    mockServiceNodes.add(mockServiceNode);
159:                    getTreeModel().notifyNodeInserted(mockServiceNode);
160:                }
161:
162:                public void mockServiceRemoved(MockService mockService) {
163:                    SoapUITreeNode treeNode = getTreeModel().getTreeNode(
164:                            mockService);
165:                    if (mockServiceNodes.contains(treeNode)) {
166:                        getTreeModel().notifyNodeRemoved(treeNode);
167:                        mockServiceNodes.remove(treeNode);
168:                    } else
169:                        throw new RuntimeException(
170:                                "Removing unkown mockService");
171:                }
172:            }
173:
174:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.