Source Code Cross Referenced for Project.java in  » IDE-Netbeans » visualweb.api.designer » org » netbeans » modules » visualweb » gravy » model » project » 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 » visualweb.api.designer » org.netbeans.modules.visualweb.gravy.model.project 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package org.netbeans.modules.visualweb.gravy.model.project;
043:
044:        import org.netbeans.modules.visualweb.gravy.model.navigation.LinkManager;
045:        import org.netbeans.modules.visualweb.gravy.Bundle;
046:        import org.netbeans.modules.visualweb.gravy.Util;
047:        import org.netbeans.modules.visualweb.gravy.TestUtils;
048:        import org.netbeans.modules.visualweb.gravy.ProjectNavigatorOperator;
049:
050:        import org.netbeans.jemmy.JemmyException;
051:        import org.netbeans.jemmy.operators.JLabelOperator;
052:
053:        /**
054:         * Common class for all project types, describing all general actions and methods.
055:         */
056:
057:        public abstract class Project {
058:
059:            private final static String bundle = "org.netbeans.modules.visualweb.gravy.model.project.Bundle";
060:            private final static String popupClose = Bundle.getStringTrimmed(
061:                    Bundle.getStringTrimmed(bundle, "NBProjectsBundle"), Bundle
062:                            .getStringTrimmed(bundle, "CloseProjectPopupItem"));
063:            private final static String popupRun = Bundle.getStringTrimmed(
064:                    Bundle.getStringTrimmed(bundle, "WebProjectsBundle"),
065:                    Bundle.getStringTrimmed(bundle, "RunProjectPopupItem"));
066:
067:            private final static String STR_NO_VIEW = "<No View Available>";
068:            private final static String STR_MAIN = " [Main]";
069:
070:            /**
071:             * Descriptor of project.
072:             */
073:            private ProjectDescriptor prjDescriptor;
074:
075:            /**
076:             * Root entry of the project.
077:             */
078:            protected RootEntry root;
079:
080:            /**
081:             * Link manager of project.
082:             */
083:            private LinkManager linkMng;
084:
085:            /**
086:             * Creates project with specified descriptor.
087:             * @param prjDescriptor Descriptor of project.
088:             */
089:            public Project(ProjectDescriptor prjDescriptor) {
090:                setDescriptor(prjDescriptor);
091:                root = new RootEntry(this );
092:            }
093:
094:            /**
095:             * Get root of project tree.
096:             */
097:            public RootEntry getRoot() {
098:                return root;
099:            }
100:
101:            /**
102:             * Get link manager of project tree.
103:             */
104:            public LinkManager getLinkManager() {
105:                if (linkMng == null)
106:                    return linkMng = new LinkManager(this );
107:                else
108:                    return linkMng;
109:            }
110:
111:            /**
112:             * Rename project.
113:             * @param newProjectName New project name.
114:             */
115:            public void rename(String newProjectName) {
116:                String name = prjDescriptor.getProperty(prjDescriptor.NAME_KEY);
117:                if (!name.equals(newProjectName))
118:                    setName(newProjectName);
119:            }
120:
121:            /**
122:             * Close project.
123:             */
124:            public void close() {
125:                try {
126:                    new ProjectNavigatorOperator().pressPopupItemOnNode(
127:                            getName(), popupClose);
128:                } catch (Exception e) {
129:                    throw new JemmyException("Project can't be closed!", e);
130:                }
131:            }
132:
133:            /**
134:             * Run project.
135:             */
136:            public void run() {
137:                try {
138:                    new ProjectNavigatorOperator().pressPopupItemOnNode(
139:                            getName(), popupRun);
140:                    TestUtils.wait(2000);
141:                    String[] runFinished = { getName() + STR_MAIN, STR_NO_VIEW,
142:                            "" };
143:                    waitLabelString(1, runFinished);
144:                } catch (Exception e) {
145:                    throw new JemmyException("Project can't be run!", e);
146:                }
147:                TestUtils.wait(3000);
148:            }
149:
150:            /**
151:             * Check label with specified index for correspondence to specified string.
152:             * Method wait when specified string appears in label.
153:             */
154:            private void waitLabelString(int index, String compareString) {
155:                String[] compareStrings = { compareString };
156:                waitLabelString(index, compareStrings);
157:            }
158:
159:            /**
160:             * Check label with specified index for correspondence to one of a specified string.
161:             * Method wait when one of a specified string appears in label.
162:             */
163:            private void waitLabelString(int index, String[] compareStrings) {
164:                JLabelOperator jlo = new JLabelOperator(Util.getMainWindow(),
165:                        index);
166:                boolean isStringAppeared = false;
167:                while (true) {
168:                    jlo = new JLabelOperator(Util.getMainWindow(), index);
169:                    TestUtils.wait(1000);
170:                    String labelText = jlo.getText();
171:                    for (int i = 0; i < compareStrings.length; i++) {
172:                        if (labelText == null
173:                                || !labelText.equals(compareStrings[i]))
174:                            continue;
175:                        else {
176:                            isStringAppeared = true;
177:                            break;
178:                        }
179:                    }
180:                    if (isStringAppeared)
181:                        break;
182:                }
183:            }
184:
185:            /**
186:             * Check label with specified index for correspondence to specified string.
187:             * Method wait when specified string appears in label and then wait until it disappears.
188:             */
189:            private void waitLabelStringDisappear(int index,
190:                    String compareString) {
191:                JLabelOperator jlo = new JLabelOperator(Util.getMainWindow(),
192:                        index);
193:                while (jlo.getText() == null
194:                        || !jlo.getText().equals(compareString)) {
195:                    jlo = new JLabelOperator(Util.getMainWindow(), index);
196:                    TestUtils.wait(1000);
197:                }
198:                while (jlo.getText() != null
199:                        && jlo.getText().equals(compareString)) {
200:                    jlo = new JLabelOperator(Util.getMainWindow(), index);
201:                    TestUtils.wait(1000);
202:                }
203:            }
204:
205:            /**
206:             * Save All project entries.
207:             */
208:            public void saveAll() {
209:            }
210:
211:            /**
212:             * Get descriptor of project.
213:             * @return descriptor of project.
214:             */
215:            public ProjectDescriptor getDescriptor() {
216:                return prjDescriptor;
217:            }
218:
219:            /**
220:             * Set descriptor of project.
221:             * @param prjDescriptor New descriptor of project.
222:             */
223:            private void setDescriptor(ProjectDescriptor prjDescriptor) {
224:                this .prjDescriptor = prjDescriptor;
225:            }
226:
227:            /**
228:             * Get project name.
229:             * @return project name.
230:             */
231:            public String getName() {
232:                return prjDescriptor.getProperty(prjDescriptor.NAME_KEY);
233:            }
234:
235:            /**
236:             * Set project name.
237:             * @param name New project name.
238:             */
239:            private void setName(String name) {
240:                String location = prjDescriptor
241:                        .getProperty(prjDescriptor.LOCATION_KEY);
242:                prjDescriptor = new ProjectDescriptor(name, location);
243:            }
244:
245:            /**
246:             * Get project location.
247:             * @return Absolute project location.
248:             */
249:            public String getLocation() {
250:                return prjDescriptor.getProperty(prjDescriptor.LOCATION_KEY);
251:            }
252:
253:            /**
254:             * Set project location.
255:             * @param location Absolute project location.
256:             */
257:            private void setLocation(String location) {
258:                String name = prjDescriptor.getProperty(prjDescriptor.NAME_KEY);
259:                prjDescriptor = new ProjectDescriptor(name, location);
260:            }
261:
262:            /**
263:             * Makes copy of the current project.
264:             * @param newName Project name.
265:             * @return Copy of the current project.
266:             */
267:            public abstract Project saveAs(String newName);
268:
269:            /**
270:             * Makes copy of the current project.
271:             * @param newName Project name.
272:             * @param newLocation absolute project location.
273:             * @return Copy of the current project.
274:             */
275:            public abstract Project saveAs(String newName, String newLocation);
276:        }
w___ww.__j_a__v__a__2s_.___com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.