Source Code Cross Referenced for SearchHistoryOperator.java in  » IDE-Netbeans » jellytools » org » netbeans » jellytools » modules » javacvs » 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.modules.javacvs 
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-2006 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.modules.javacvs;
042:
043:        import java.awt.Component;
044:        import java.awt.Point;
045:        import javax.swing.JComponent;
046:        import javax.swing.JTextField;
047:        import org.netbeans.jellytools.Bundle;
048:        import org.netbeans.jellytools.TopComponentOperator;
049:        import org.netbeans.jellytools.modules.javacvs.actions.SearchHistoryAction;
050:        import org.netbeans.jellytools.nodes.Node;
051:        import org.netbeans.jemmy.ComponentChooser;
052:        import org.netbeans.jemmy.operators.JButtonOperator;
053:        import org.netbeans.jemmy.operators.JLabelOperator;
054:        import org.netbeans.jemmy.operators.JListOperator;
055:        import org.netbeans.jemmy.operators.JPopupMenuOperator;
056:        import org.netbeans.jemmy.operators.JTextFieldOperator;
057:        import org.netbeans.jemmy.operators.JToggleButtonOperator;
058:
059:        /** Class implementing all necessary methods for handling "Search History" view.
060:         * <br>
061:         * Usage:<br>
062:         * <pre>
063:         *      Node node = new Node(new SourcePackagesNode("myProject"), "mypackage|MyFile");
064:         *      SearchHistoryOperator sho = new SearchHistoryOperator().invoke(node);
065:         *      sho.setMessage("message");
066:         *      sho.setUsername("username");
067:         *      sho.setFrom("tag1");
068:         *      sho.setTo("tag2");
069:         *      sho.performPopup(1, "Diff");
070:         * </pre>
071:         *
072:         * @see org.netbeans.jellytools.modules.javacvs.actions.SearchHistoryAction
073:         * @see BrowseTagsOperator
074:         *
075:         * @author Jiri.Skrivanek@sun.com
076:         */
077:        public class SearchHistoryOperator extends TopComponentOperator {
078:
079:            /** "Search History" */
080:            static final String SEARCH_HISTORY_TITLE = Bundle
081:                    .getStringTrimmed(
082:                            "org.netbeans.modules.versioning.system.cvss.ui.actions.log.Bundle",
083:                            "CTL_SearchHistory_Title");
084:
085:            /** Waits for Search History TopComponent within whole IDE. */
086:            public SearchHistoryOperator() {
087:                super (waitTopComponent(null, SEARCH_HISTORY_TITLE, 0,
088:                        new SearchHistorySubchooser()));
089:            }
090:
091:            /** Selects nodes and call search history action on them.
092:             * @param nodes an array of nodes
093:             * @return SearchHistoryOperator instance
094:             */
095:            public static SearchHistoryOperator invoke(Node[] nodes) {
096:                new SearchHistoryAction().perform(nodes);
097:                return new SearchHistoryOperator();
098:            }
099:
100:            /** Selects node and call search history action on it.
101:             * @param node node to be selected
102:             * @return SearchHistoryOperator instance
103:             */
104:            public static SearchHistoryOperator invoke(Node node) {
105:                return invoke(new Node[] { node });
106:            }
107:
108:            private JLabelOperator _lblMessage;
109:            private JTextFieldOperator _txtMessage;
110:            private JLabelOperator _lblUsername;
111:            private JTextFieldOperator _txtUsername;
112:            private JLabelOperator _lblFrom;
113:            private JTextFieldOperator _txtFrom;
114:            private JButtonOperator _btBrowseFrom;
115:            private JLabelOperator _lblTo;
116:            private JTextFieldOperator _txtTo;
117:            private JButtonOperator _btBrowseTo;
118:            private JButtonOperator _btSearch;
119:            private JToggleButtonOperator _tbSummary;
120:            private JToggleButtonOperator _tbDiff;
121:            private JButtonOperator _btNext;
122:            private JButtonOperator _btPrevious;
123:            private JListOperator _lstHistory;
124:
125:            //******************************
126:            // Subcomponents definition part
127:            //******************************
128:
129:            /** Tries to find "Message:" JLabel in this dialog.
130:             * @return JLabelOperator
131:             */
132:            public JLabelOperator lblMessage() {
133:                if (_lblMessage == null) {
134:                    _lblMessage = new JLabelOperator(
135:                            this ,
136:                            Bundle
137:                                    .getStringTrimmed(
138:                                            "org.netbeans.modules.versioning.system.cvss.ui.history.Bundle",
139:                                            "CTL_UseCommitMessage"));
140:                }
141:                return _lblMessage;
142:            }
143:
144:            /** Tries to find null JTextField in this dialog.
145:             * @return JTextFieldOperator
146:             */
147:            public JTextFieldOperator txtMessage() {
148:                if (_txtMessage == null) {
149:                    _txtMessage = new JTextFieldOperator(
150:                            (JTextField) lblMessage().getLabelFor());
151:                }
152:                return _txtMessage;
153:            }
154:
155:            /** Tries to find "Username:" JLabel in this dialog.
156:             * @return JLabelOperator
157:             */
158:            public JLabelOperator lblUsername() {
159:                if (_lblUsername == null) {
160:                    _lblUsername = new JLabelOperator(
161:                            this ,
162:                            Bundle
163:                                    .getStringTrimmed(
164:                                            "org.netbeans.modules.versioning.system.cvss.ui.history.Bundle",
165:                                            "CTL_UseUsername"));
166:                }
167:                return _lblUsername;
168:            }
169:
170:            /** Tries to find null JTextField in this dialog.
171:             * @return JTextFieldOperator
172:             */
173:            public JTextFieldOperator txtUsername() {
174:                if (_txtUsername == null) {
175:                    _txtUsername = new JTextFieldOperator(
176:                            (JTextField) lblUsername().getLabelFor());
177:                }
178:                return _txtUsername;
179:            }
180:
181:            /** Tries to find "From:" JLabel in this dialog.
182:             * @return JLabelOperator
183:             */
184:            public JLabelOperator lblFrom() {
185:                if (_lblFrom == null) {
186:                    _lblFrom = new JLabelOperator(
187:                            this ,
188:                            Bundle
189:                                    .getStringTrimmed(
190:                                            "org.netbeans.modules.versioning.system.cvss.ui.history.Bundle",
191:                                            "CTL_UseFrom"));
192:                }
193:                return _lblFrom;
194:            }
195:
196:            /** Tries to find null JTextField in this dialog.
197:             * @return JTextFieldOperator
198:             */
199:            public JTextFieldOperator txtFrom() {
200:                if (_txtFrom == null) {
201:                    _txtFrom = new JTextFieldOperator((JTextField) lblFrom()
202:                            .getLabelFor());
203:                }
204:                return _txtFrom;
205:            }
206:
207:            /** Tries to find "Browse..." JButton in this dialog.
208:             * @return JButtonOperator
209:             */
210:            public JButtonOperator btBrowseFrom() {
211:                if (_btBrowseFrom == null) {
212:                    _btBrowseFrom = new JButtonOperator(
213:                            this ,
214:                            Bundle
215:                                    .getStringTrimmed(
216:                                            "org.netbeans.modules.versioning.system.cvss.ui.history.Bundle",
217:                                            "CTL_BrowseFrom"));
218:                }
219:                return _btBrowseFrom;
220:            }
221:
222:            /** Tries to find "To:" JLabel in this dialog.
223:             * @return JLabelOperator
224:             */
225:            public JLabelOperator lblTo() {
226:                if (_lblTo == null) {
227:                    _lblTo = new JLabelOperator(
228:                            this ,
229:                            Bundle
230:                                    .getStringTrimmed(
231:                                            "org.netbeans.modules.versioning.system.cvss.ui.history.Bundle",
232:                                            "CTL_UseTo"));
233:                }
234:                return _lblTo;
235:            }
236:
237:            /** Tries to find null JTextField in this dialog.
238:             * @return JTextFieldOperator
239:             */
240:            public JTextFieldOperator txtTo() {
241:                if (_txtTo == null) {
242:                    _txtTo = new JTextFieldOperator((JTextField) lblTo()
243:                            .getLabelFor());
244:                }
245:                return _txtTo;
246:            }
247:
248:            /** Tries to find "Browse..." JButton in this dialog.
249:             * @return JButtonOperator
250:             */
251:            public JButtonOperator btBrowseTo() {
252:                if (_btBrowseTo == null) {
253:                    _btBrowseTo = new JButtonOperator(
254:                            this ,
255:                            Bundle
256:                                    .getStringTrimmed(
257:                                            "org.netbeans.modules.versioning.system.cvss.ui.history.Bundle",
258:                                            "CTL_BrowseTo"), 1);
259:                }
260:                return _btBrowseTo;
261:            }
262:
263:            /** Tries to find "Search" JButton in this dialog.
264:             * @return JButtonOperator
265:             */
266:            public JButtonOperator btSearch() {
267:                if (_btSearch == null) {
268:                    _btSearch = new JButtonOperator(
269:                            this ,
270:                            Bundle
271:                                    .getStringTrimmed(
272:                                            "org.netbeans.modules.versioning.system.cvss.ui.history.Bundle",
273:                                            "CTL_Search"));
274:                }
275:                return _btSearch;
276:            }
277:
278:            /** Tries to find "Summary" JToggleButton in this dialog.
279:             * @return JToggleButtonOperator
280:             */
281:            public JToggleButtonOperator tbSummary() {
282:                if (_tbSummary == null) {
283:                    _tbSummary = new JToggleButtonOperator(
284:                            this ,
285:                            Bundle
286:                                    .getStringTrimmed(
287:                                            "org.netbeans.modules.versioning.system.cvss.ui.history.Bundle",
288:                                            "CTL_ShowSummary"));
289:                }
290:                return _tbSummary;
291:            }
292:
293:            /** Tries to find "Diff" JToggleButton in this dialog.
294:             * @return JToggleButtonOperator
295:             */
296:            public JToggleButtonOperator tbDiff() {
297:                if (_tbDiff == null) {
298:                    _tbDiff = new JToggleButtonOperator(
299:                            this ,
300:                            Bundle
301:                                    .getStringTrimmed(
302:                                            "org.netbeans.modules.versioning.system.cvss.ui.history.Bundle",
303:                                            "CTL_ShowDiff"));
304:                }
305:                return _tbDiff;
306:            }
307:
308:            /** Tries to find Go to Next Difference JButton in this dialog.
309:             * @return JButtonOperator
310:             */
311:            public JButtonOperator btNext() {
312:                if (_btNext == null) {
313:                    String tooltip = Bundle
314:                            .getString(
315:                                    "org.netbeans.modules.versioning.system.cvss.ui.actions.diff.Bundle",
316:                                    "CTL_DiffPanel_Next_Tooltip");
317:                    _btNext = new JButtonOperator(this , new TooltipChooser(
318:                            tooltip, getComparator()));
319:                }
320:                return _btNext;
321:            }
322:
323:            /** Tries to find Go to Previous Difference JButton in this dialog.
324:             * @return JButtonOperator
325:             */
326:            public JButtonOperator btPrevious() {
327:                if (_btPrevious == null) {
328:                    String tooltip = Bundle
329:                            .getString(
330:                                    "org.netbeans.modules.versioning.system.cvss.ui.actions.diff.Bundle",
331:                                    "CTL_DiffPanel_Prev_Tooltip");
332:                    _btPrevious = new JButtonOperator(this , new TooltipChooser(
333:                            tooltip, getComparator()));
334:                }
335:                return _btPrevious;
336:            }
337:
338:            /** Tries to find History JList in this dialog.
339:             * @return JListOperator
340:             */
341:            public JListOperator lstHistory() {
342:                if (_lstHistory == null) {
343:                    _lstHistory = new JListOperator(this );
344:                }
345:                return _lstHistory;
346:            }
347:
348:            //****************************************
349:            // Low-level functionality definition part
350:            //****************************************
351:
352:            /** gets text for txtMessage
353:             * @return String text
354:             */
355:            public String getMessage() {
356:                return txtMessage().getText();
357:            }
358:
359:            /** sets text for txtMessage
360:             * @param text String text
361:             */
362:            public void setMessage(String text) {
363:                txtMessage().clearText();
364:                txtMessage().typeText(text);
365:            }
366:
367:            /** gets text for txtUsername
368:             * @return String text
369:             */
370:            public String getUsername() {
371:                return txtUsername().getText();
372:            }
373:
374:            /** sets text for txtUsername
375:             * @param text String text
376:             */
377:            public void setUsername(String text) {
378:                txtUsername().clearText();
379:                txtUsername().typeText(text);
380:            }
381:
382:            /** gets text for txtFrom
383:             * @return String text
384:             */
385:            public String getFrom() {
386:                return txtFrom().getText();
387:            }
388:
389:            /** sets text for txtFrom
390:             * @param text String text
391:             */
392:            public void setFrom(String text) {
393:                txtFrom().clearText();
394:                txtFrom().typeText(text);
395:            }
396:
397:            /** clicks on "Browse..." JButton and returns BrowseTagsOperator
398:             * @return BrowseTagsOperator instance
399:             */
400:            public BrowseTagsOperator browseFrom() {
401:                btBrowseFrom().pushNoBlock();
402:                return new BrowseTagsOperator();
403:            }
404:
405:            /** gets text for txtTo
406:             * @return String text
407:             */
408:            public String getTo() {
409:                return txtTo().getText();
410:            }
411:
412:            /** sets text for txtTo
413:             * @param text String text
414:             */
415:            public void setTo(String text) {
416:                txtTo().clearText();
417:                txtTo().typeText(text);
418:            }
419:
420:            /** clicks on "Browse..." JButton and returns BrowseTagsOperator
421:             * @return BrowseTagsOperator instance
422:             */
423:            public BrowseTagsOperator browseTo() {
424:                btBrowseTo().pushNoBlock();
425:                return new BrowseTagsOperator();
426:            }
427:
428:            /** clicks on "Search" JButton
429:             */
430:            public void search() {
431:                btSearch().push();
432:            }
433:
434:            /** checks or unchecks Summary JToggleButton
435:             * @param state boolean requested state
436:             */
437:            public void checkSummary(boolean state) {
438:                if (tbSummary().isSelected() != state) {
439:                    tbSummary().push();
440:                }
441:            }
442:
443:            /** checks or unchecks Diff JToggleButton
444:             * @param state boolean requested state
445:             */
446:            public void checkDiff(boolean state) {
447:                if (tbDiff().isSelected() != state) {
448:                    tbDiff().push();
449:                }
450:            }
451:
452:            /** clicks on Go to Next Difference JButton
453:             */
454:            public void next() {
455:                btNext().push();
456:            }
457:
458:            /** clicks on Go to Previous Difference JButton
459:             */
460:            public void previous() {
461:                btPrevious().push();
462:            }
463:
464:            /** Performs popup menu on specified row in history list.
465:             * @param rowIndex index of row (starts at 0)
466:             * @param popupPath popup menu path
467:             */
468:            public void performPopup(int rowIndex, String popupPath) {
469:                Point point = lstHistory().getClickPoint(rowIndex);
470:                lstHistory().clickForPopup(point.x, point.y);
471:                JPopupMenuOperator popup = new JPopupMenuOperator();
472:                popup.pushMenu(popupPath);
473:            }
474:
475:            //*****************************************
476:            // High-level functionality definition part
477:            //*****************************************
478:
479:            /** Performs verification of SearchHistoryOperator by accessing all its components.
480:             */
481:            public void verify() {
482:                lblMessage();
483:                txtMessage();
484:                lblUsername();
485:                txtUsername();
486:                lblFrom();
487:                txtFrom();
488:                btBrowseFrom();
489:                lblTo();
490:                txtTo();
491:                btBrowseTo();
492:                btSearch();
493:                tbSummary();
494:                tbDiff();
495:                btNext();
496:                btPrevious();
497:                lstHistory();
498:            }
499:
500:            /** SubChooser to determine TopComponent is instance of
501:             *  org.netbeans.modules.versioning.system.cvss.ui.history.SearchHistoryTopComponent
502:             * Used in constructor.
503:             */
504:            private static final class SearchHistorySubchooser implements 
505:                    ComponentChooser {
506:                public boolean checkComponent(Component comp) {
507:                    return comp.getClass().getName().endsWith(
508:                            "SearchHistoryTopComponent");
509:                }
510:
511:                public String getDescription() {
512:                    return " org.netbeans.modules.versioning.system.cvss.ui.history.SearchHistoryTopComponent";
513:                }
514:            }
515:
516:            /** Chooser which can be used to find a component with given tooltip,
517:             * for example a button.
518:             */
519:            private static class TooltipChooser implements  ComponentChooser {
520:                private String buttonTooltip;
521:                private StringComparator comparator;
522:
523:                public TooltipChooser(String buttonTooltip,
524:                        StringComparator comparator) {
525:                    this .buttonTooltip = buttonTooltip;
526:                    this .comparator = comparator;
527:                }
528:
529:                public boolean checkComponent(Component comp) {
530:                    return comparator.equals(((JComponent) comp)
531:                            .getToolTipText(), buttonTooltip);
532:                }
533:
534:                public String getDescription() {
535:                    return "Button with tooltip \"" + buttonTooltip + "\".";
536:                }
537:            }
538:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.