Java Doc for WindowInterceptor.java in  » Testing » UISpec4J » org » uispec4j » interception » 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 » Testing » UISpec4J » org.uispec4j.interception 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.uispec4j.interception.WindowInterceptor

WindowInterceptor
final public class WindowInterceptor (Code)
Intercepts popped-up windows such as JFrame or JDialog.

There are two main usage scenarios for this class: intercepting "frames", i.e. non-modal windows, and intercepting modal dialogs.

Non-modal windows can be intercepted and used directly from within the test using the following construct:

 Window window = WindowInterceptor.run(panel.getButton("open").triggerClick());
 

Modal dialogs cannot be intercepted this way, because the thread from which the test is run will likely be blocked in the production code until the dialog is closed. To intercept a sequence of popped-up windows, use the following construct:

 WindowInterceptor
 .init(new Trigger() {
 public void run() throws Exception {
 // ... trigger something that will cause the first window to be shown ...
 }
 })
 .process(new WindowHandler("first dialog") {
 public Trigger process(Window window) {
 // ... perform some operations on the first window ...
 return window.getButton("OK").triggerClick(); // return a trigger that will close it
 }
 })
 .process(new WindowHandler("second dialog") {
 public Trigger process(Window window) {
 // ... perform some operations on the second window ...
 return window.getButton("OK").triggerClick(); // return a trigger that will close it
 }
 })
 .run();
 
This class uses a timeout (see UISpec4J.setWindowInterceptionTimeLimit ) to make sure that windows appear within a given time limit, and that modal windows are closed before the end of the interception.
See Also:    Intercepting windows




Method Summary
public static  WindowgetModalDialog(Trigger trigger)
     Performs a "quick&dirty" interception of a modal dialog.

Warning: This method should be handled with care and especially avoided in cases where the application code is blocked while the dialog is displayed, because it could result in deadlocks.

public static  WindowInterceptorinit(Trigger trigger)
     Starts the interception of a modal dialog.
public  WindowInterceptorprocess(WindowHandler handler)
     Processes a modal dialog.
public  WindowInterceptorprocess(String title, WindowHandler handler)
     Processes a modal dialog after having checked its title first.
public  WindowInterceptorprocess(WindowHandler[] handlers)
     Processes a sequence of dialogs (one handler per dialog).
public  WindowInterceptorprocessTransientWindow(String title)
     Processes a dialog that will be closed automatically, and checks its name.
public  WindowInterceptorprocessTransientWindow()
     Processes a dialog that will be closed automatically.
public  WindowInterceptorprocessWithButtonClick(String buttonName)
     Processes a dialog by clicking on a given button.
public  WindowInterceptorprocessWithButtonClick(String title, String buttonName)
     Processes a dialog by checking its title and clicking on a given button.
public  voidrun()
     Starts the interception prepared with the WindowInterceptor.init(Trigger) / WindowInterceptor.process(WindowHandler) call sequence.
public static  Windowrun(Trigger trigger)
     Intercepts a non-modal window by running a trigger and returning the displayed window. This method will fail if no window was shown by the trigger under the time limit defined with UISpec4J.setWindowInterceptionTimeLimit(long) , or if it is used with a modal dialog (modal dialogs should be intercepted using WindowInterceptor.init(Trigger) ).



Method Detail
getModalDialog
public static Window getModalDialog(Trigger trigger)(Code)
Performs a "quick&dirty" interception of a modal dialog.

Warning: This method should be handled with care and especially avoided in cases where the application code is blocked while the dialog is displayed, because it could result in deadlocks.

Modal dialogs should rather be intercepted using WindowInterceptor.init(Trigger)

This method will fail if no window was shown by the trigger under the time limit, or if it is used with a non-modal window.




init
public static WindowInterceptor init(Trigger trigger)(Code)
Starts the interception of a modal dialog. The returned interceptor must be used for processing the displayed window, for instance:
 WindowInterceptor
 .init(new Trigger() {
 public void run() throws Exception {
 // ... trigger something that will cause the first window to be shown ...
 }
 })
 .process(new WindowHandler("my dialog") {
 public Trigger process(Window window) {
 // ... perform some operations on the shown window ...
 return window.getButton("OK").triggerClick(); // return a trigger that will close it
 }
 })
 .run();
 

See Also:   WindowInterceptor.process(WindowHandler)



process
public WindowInterceptor process(WindowHandler handler)(Code)
Processes a modal dialog. The provided WindowHandler must return a trigger that will cause the window to be closed, in order to prevent the application to be stopped.



process
public WindowInterceptor process(String title, WindowHandler handler)(Code)
Processes a modal dialog after having checked its title first.
See Also:   WindowInterceptor.process(WindowHandler)



process
public WindowInterceptor process(WindowHandler[] handlers)(Code)
Processes a sequence of dialogs (one handler per dialog).
See Also:   WindowInterceptor.process(WindowHandler)



processTransientWindow
public WindowInterceptor processTransientWindow(String title)(Code)
Processes a dialog that will be closed automatically, and checks its name.



processTransientWindow
public WindowInterceptor processTransientWindow()(Code)
Processes a dialog that will be closed automatically.



processWithButtonClick
public WindowInterceptor processWithButtonClick(String buttonName)(Code)
Processes a dialog by clicking on a given button. This a shortcut that prevents you from implementing your own WindowHandler for simple cases such as confirmation dialogs.
See Also:   WindowInterceptor.process(WindowHandler)



processWithButtonClick
public WindowInterceptor processWithButtonClick(String title, String buttonName)(Code)
Processes a dialog by checking its title and clicking on a given button.
See Also:   WindowInterceptor.processWithButtonClick(String)



run
public void run()(Code)
Starts the interception prepared with the WindowInterceptor.init(Trigger) / WindowInterceptor.process(WindowHandler) call sequence. This method will fail if no window was shown by the trigger under the time limit. defined with UISpec4J.setWindowInterceptionTimeLimit(long) .



run
public static Window run(Trigger trigger)(Code)
Intercepts a non-modal window by running a trigger and returning the displayed window. This method will fail if no window was shown by the trigger under the time limit defined with UISpec4J.setWindowInterceptionTimeLimit(long) , or if it is used with a modal dialog (modal dialogs should be intercepted using WindowInterceptor.init(Trigger) ).

Note: the trigger is run in the current thread.




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.