Source Code Cross Referenced for NewFileNameLocationStepOperator.java in  » IDE-Netbeans » jellytools » org » netbeans » jellytools » 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 » jellytools » org.netbeans.jellytools 
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:        package org.netbeans.jellytools;
042:
043:        import java.awt.Component;
044:        import java.awt.Component;
045:        import javax.swing.JComboBox;
046:        import javax.swing.JLabel;
047:        import org.netbeans.jemmy.EventTool;
048:        import org.netbeans.jemmy.operators.JLabelOperator;
049:        import org.netbeans.jemmy.operators.JTextFieldOperator;
050:        import org.netbeans.jemmy.operators.JComboBoxOperator;
051:        import javax.swing.JTextField;
052:        import org.netbeans.jemmy.ComponentChooser;
053:
054:        /**
055:         * Handle "Name And Location" panel of the New File wizard.
056:         * Components on the panel differs according to type of Object selected.
057:         * This one contains only basic components.<br>
058:         * Usage:
059:         * <pre>
060:         *      NewFileWizardOperator wop = NewFileWizardOperator.invoke();
061:         *      wop.selectCategory("Java Classes");
062:         *      wop.selectFileType("Java Class");
063:         *      wop.next();
064:         *      NewFileNameLocationStepOperator op = new NewFileNameLocationStepOperator();
065:         *      op.selectLocation("Source Packages");
066:         *      op.selectPackage("org.netbeans.jellytools");
067:         * </pre>
068:         *
069:         * @author tb115823, Jiri.Skrivanek@sun.com
070:         */
071:        public class NewFileNameLocationStepOperator extends
072:                NewFileWizardOperator {
073:
074:            /** Components operators. */
075:            private JLabelOperator _lblObjectName;
076:            private JTextFieldOperator _txtObjectName;
077:            private JLabelOperator _lblProject;
078:            private JTextFieldOperator _txtProject;
079:            private JLabelOperator _lblCreatedFile;
080:            private JTextFieldOperator _txtCreatedFile;
081:            private JLabelOperator _lblPackage;
082:            private JComboBoxOperator _cboPackage;
083:            private JLabelOperator _lblLocation;
084:            private JComboBoxOperator _cboLocation;
085:
086:            /** Waits for wizard with New title.  */
087:            public NewFileNameLocationStepOperator() {
088:                super ();
089:            }
090:
091:            /** Waits for wizard with given title.
092:             * @param title title of wizard
093:             */
094:            public NewFileNameLocationStepOperator(String title) {
095:                super (title);
096:            }
097:
098:            /** Returns operator for first label with "Name"
099:             * @return JLabelOperator
100:             */
101:            public JLabelOperator lblObjectName() {
102:                if (_lblObjectName == null) {
103:                    final String nameLabel = Bundle.getString(
104:                            "org.netbeans.modules.properties.Bundle",
105:                            "PROP_name");
106:                    final String nameAndLocationLabel = Bundle
107:                            .getStringTrimmed(
108:                                    "org.netbeans.modules.java.project.Bundle",
109:                                    "LBL_JavaTargetChooserPanelGUI_Name");
110:                    _lblObjectName = new JLabelOperator(this ,
111:                            new JLabelOperator.JLabelFinder(
112:                                    new ComponentChooser() {
113:                                        public boolean checkComponent(
114:                                                Component comp) {
115:                                            JLabel jLabel = (JLabel) comp;
116:                                            String text = jLabel.getText();
117:                                            if (text == null
118:                                                    || nameAndLocationLabel
119:                                                            .equals(text)) {
120:                                                return false;
121:                                            } else if (text.indexOf(nameLabel) > -1
122:                                                    && (jLabel.getLabelFor() == null || jLabel
123:                                                            .getLabelFor() instanceof  JTextField)) {
124:                                                return true;
125:                                            }
126:                                            return false;
127:                                        }
128:
129:                                        public String getDescription() {
130:                                            return "JLabel containing Name and associated with text field";
131:                                        }
132:                                    }));
133:                }
134:                return _lblObjectName;
135:            }
136:
137:            /** Returns operator of text field bind to lblObjectName
138:             * @return JTextOperator
139:             */
140:            public JTextFieldOperator txtObjectName() {
141:                if (_txtObjectName == null) {
142:                    if (lblObjectName().getLabelFor() != null) {
143:                        _txtObjectName = new JTextFieldOperator(
144:                                (JTextField) lblObjectName().getLabelFor());
145:                    } else {
146:                        _txtObjectName = new JTextFieldOperator(this , 0);
147:                    }
148:                }
149:                return _txtObjectName;
150:            }
151:
152:            /** Returns operator for first label with "Project"
153:             * @return JLabelOperator
154:             */
155:            public JLabelOperator lblProject() {
156:                if (_lblProject == null) {
157:                    _lblProject = new JLabelOperator(this , Bundle
158:                            .getStringTrimmed(
159:                                    "org.netbeans.modules.project.ui.Bundle",
160:                                    "LBL_TemplateChooserPanelGUI_jLabel1"));
161:                }
162:                return _lblProject;
163:            }
164:
165:            /** Returns operator of text field bind to lblProject
166:             * @return JTextOperator
167:             */
168:            public JTextFieldOperator txtProject() {
169:                if (_txtProject == null) {
170:                    if (lblProject().getLabelFor() != null) {
171:                        _txtProject = new JTextFieldOperator(
172:                                (JTextField) lblProject().getLabelFor());
173:                    } else {
174:                        _txtProject = new JTextFieldOperator(this , 1);
175:                    }
176:                }
177:                return _txtProject;
178:            }
179:
180:            /** Returns operator for label with "Created File:"
181:             * @return JLabelOperator
182:             */
183:            public JLabelOperator lblCreatedFile() {
184:                if (_lblCreatedFile == null) {
185:                    _lblCreatedFile = new JLabelOperator(
186:                            this ,
187:                            Bundle
188:                                    .getStringTrimmed(
189:                                            "org.netbeans.modules.java.project.Bundle",
190:                                            "LBL_JavaTargetChooserPanelGUI_CreatedFile_Label"));
191:                }
192:                return _lblCreatedFile;
193:            }
194:
195:            /** Returns operator of text field bind to lblCreatedFile
196:             * @return JTextOperator
197:             */
198:            public JTextFieldOperator txtCreatedFile() {
199:                if (_txtCreatedFile == null) {
200:                    if (lblCreatedFile().getLabelFor() != null) {
201:                        _txtCreatedFile = new JTextFieldOperator(
202:                                (JTextField) lblCreatedFile().getLabelFor());
203:                    } else {
204:                        _txtCreatedFile = new JTextFieldOperator(this , 3);
205:                    }
206:                }
207:                return _txtCreatedFile;
208:            }
209:
210:            /** Returns operator of label "Location:"
211:             * @return JLabelOperator
212:             */
213:            public JLabelOperator lblLocation() {
214:                if (_lblLocation == null) {
215:                    _lblLocation = new JLabelOperator(this , Bundle
216:                            .getStringTrimmed(
217:                                    "org.netbeans.modules.java.project.Bundle",
218:                                    "LBL_JavaTargetChooserPanelGUI_jLabel1"));
219:                }
220:                return _lblLocation;
221:            }
222:
223:            /** Returns operator for combo box Location:
224:             * @return JComboBoxOperator
225:             */
226:            public JComboBoxOperator cboLocation() {
227:                if (_cboLocation == null) {
228:                    _cboLocation = new JComboBoxOperator(
229:                            (JComboBox) lblLocation().getLabelFor());
230:                }
231:                return _cboLocation;
232:            }
233:
234:            /** Returns operator of label "Package:"
235:             * @return JLabelOperator
236:             */
237:            public JLabelOperator lblPackage() {
238:                if (_lblPackage == null) {
239:                    _lblPackage = new JLabelOperator(this , Bundle
240:                            .getStringTrimmed(
241:                                    "org.netbeans.modules.java.project.Bundle",
242:                                    "LBL_JavaTargetChooserPanelGUI_jLabel2"));
243:                }
244:                return _lblPackage;
245:            }
246:
247:            /** returns operator for combo box Package:
248:             * @return JComboBoxOperator
249:             */
250:            public JComboBoxOperator cboPackage() {
251:                if (_cboPackage == null) {
252:                    _cboPackage = new JComboBoxOperator(
253:                            (JComboBox) lblPackage().getLabelFor());
254:                }
255:                return _cboPackage;
256:            }
257:
258:            /** Selects given package in combo box Package.
259:             * @param packageName name of package to be selected
260:             */
261:            public void selectPackage(String packageName) {
262:                new EventTool().waitNoEvent(500);
263:                cboPackage().selectItem(packageName);
264:            }
265:
266:            /** Type given package in combo box Package.
267:             * @param packageName name of package
268:             */
269:            public void setPackage(String packageName) {
270:                new EventTool().waitNoEvent(500);
271:                cboPackage().clearText();
272:                cboPackage().typeText(packageName);
273:            }
274:
275:            /** Sets given object name in the text field.
276:             * @param objectName name of object
277:             */
278:            public void setObjectName(String objectName) {
279:                txtObjectName().setText(objectName);
280:            }
281:
282:            /** Selects Source Packages in combo box Location:.
283:             * Cannot set location directly by string because combo box has a model
284:             * with objects and not visible strings.
285:             */
286:            public void selectSourcePackagesLocation() {
287:                cboLocation().selectItem(0);
288:            }
289:
290:            /** Selects Test Packages in combo box Location:
291:             * Cannot set location directly by string because combo box has a model
292:             * with objects and not visible strings.
293:             */
294:            public void selectTestPackagesLocation() {
295:                cboLocation().selectItem(1);
296:            }
297:
298:            /** Performs verification by accessing all sub-components */
299:            public void verify() {
300:                lblObjectName();
301:                txtObjectName();
302:                lblCreatedFile();
303:                txtCreatedFile();
304:                cboLocation();
305:                cboPackage();
306:            }
307:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.