Java Doc for AWTFixtureHelper.java in  » Testing » abbot-1.0.1 » abbot » util » 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 » abbot 1.0.1 » abbot.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   abbot.util.AWTFixtureHelper

AWTFixtureHelper
public class AWTFixtureHelper (Code)
Provides various facilities for setting up, using, and tearing down a test involving UI components. Handles standardized AWTEvent logging and catching exceptions on the AWT event dispatch thread (EDT). This class should be used at setup and teardown of your chosen fixture.
See Also:   junit.extensions.abbot.ComponentTestFixture
See Also:   abbot.script.StepRunner
See Also:   


Field Summary
final public static  intEVENT_GENERATION_DELAY
     Typical delay to wait for a robot event to be translated into a Java event.
final public static  intPOPUP_DELAY
    
final public static  intWINDOW_DELAY
    

Constructor Summary
public  AWTFixtureHelper()
    
public  AWTFixtureHelper(Hierarchy hierarchy)
     Create an instance of AWTFixtureHelper which makes a snapshot of the current VM state.

Method Summary
public  voiddispose()
     Dispose all windows created during this object's lifetime and restore the previous system/UI state, to the extent possible.
protected  voiddisposeAll()
    
public  voiddisposeWindow(Window w)
     Synchronous, safe dispose of a window.
public  ThrowablegetEventDispatchError()
     Returns the last exception thrown on the event dispatch thread, or null if no such exception has been thrown.
public  longgetEventDispatchErrorTime()
     Returns the time of the last exception thrown on the event dispatch thread.
public  HierarchygetHierarchy()
    
public  RobotgetRobot()
    
public  WindowTrackergetWindowTracker()
    
public  voidhideWindow(Window w)
     Synchronous, safe hide of a window.
public  voidinstallPopup(Component invoker, JPopupMenu popup)
     Install the given popup on the given component.
public  voidinvokeAndWait(Runnable runnable)
     Convenience for getRobot().invokeAndWait(Runnable).
public  voidinvokeLater(Runnable runnable)
     Convenience for getRobot().invokeLater(Runnable).
public  booleanisShowing(String id)
     Returns whether a Component is showing.
public  booleanisShowing(String id, ComponentFinder finder)
     Same as AWTFixtureHelper.isShowing(String) , but uses the given ComponentFinder to do the lookup.
public  voidrestore()
     Restore the state that was preserved when this object was created.
public  voidsetModifiers(int modifiers, boolean pressed)
     Convenience method to set key modifiers.
public  FrameshowFrame(Component comp)
     This method should be invoked to display the component under test. The frame's size will be its preferred size.
public  FrameshowFrame(Component comp, Dimension size)
     This method should be invoked to display the component under test, when a specific size of frame is desired.
public  FrameshowFrame(Component comp, Dimension size, String title)
     This method should be invoked to display the component under test, when a specific size of frame is desired.
public  DialogshowModalDialog(Runnable showAction)
     Display a modal dialog and wait for it to show.
public  DialogshowModalDialog(Runnable showAction, ComponentFinder finder)
     Same as AWTFixtureHelper.showModalDialog(Runnable) , but provides a custom ComponentFinder to find the dialog.
public  voidshowPopup(JPopupMenu popup, Component invoker)
     Safely install and display a popup in the center of the given component, returning when it is visible.
public  voidshowPopup(JPopupMenu popup, Component invoker, int x, int y)
     Safely install and display a popup, returning when it is visible.
public  voidshowWindow(Window w)
     Safely display a window with proper EDT synchronization.
public  voidshowWindow(Window w, Dimension size)
     Safely display a window with proper EDT synchronization.
public  voidshowWindow(Window w, Dimension size, boolean pack)
     Safely display a window with proper EDT synchronization.
public  voidwaitForWindow(Window w, boolean visible)
     Return when the window is ready for input or times out waiting.

Field Detail
EVENT_GENERATION_DELAY
final public static int EVENT_GENERATION_DELAY(Code)
Typical delay to wait for a robot event to be translated into a Java event.



POPUP_DELAY
final public static int POPUP_DELAY(Code)



WINDOW_DELAY
final public static int WINDOW_DELAY(Code)




Constructor Detail
AWTFixtureHelper
public AWTFixtureHelper()(Code)



AWTFixtureHelper
public AWTFixtureHelper(Hierarchy hierarchy)(Code)
Create an instance of AWTFixtureHelper which makes a snapshot of the current VM state.




Method Detail
dispose
public void dispose()(Code)
Dispose all windows created during this object's lifetime and restore the previous system/UI state, to the extent possible.



disposeAll
protected void disposeAll()(Code)



disposeWindow
public void disposeWindow(Window w)(Code)
Synchronous, safe dispose of a window. The window is ensured to be disposed ( java.awt.event.WindowEvent.WINDOW_CLOSED has been posted) when this method returns.



getEventDispatchError
public Throwable getEventDispatchError()(Code)
Returns the last exception thrown on the event dispatch thread, or null if no such exception has been thrown.



getEventDispatchErrorTime
public long getEventDispatchErrorTime()(Code)
Returns the time of the last exception thrown on the event dispatch thread.



getHierarchy
public Hierarchy getHierarchy()(Code)



getRobot
public Robot getRobot()(Code)



getWindowTracker
public WindowTracker getWindowTracker()(Code)



hideWindow
public void hideWindow(Window w)(Code)
Synchronous, safe hide of a window. The window is ensured to be hidden ( java.awt.event.ComponentEvent.COMPONENT_HIDDEN or equivalent has been posted) when this method returns. Note that this will not trigger a java.awt.event.WindowEvent.WINDOW_CLOSING event; use abbot.tester.WindowTester.actionClose(Component) if a window manager window close operation is required.



installPopup
public void installPopup(Component invoker, JPopupMenu popup)(Code)
Install the given popup on the given component. Takes care of installing the appropriate mouse handler to activate the popup.



invokeAndWait
public void invokeAndWait(Runnable runnable)(Code)
Convenience for getRobot().invokeAndWait(Runnable).



invokeLater
public void invokeLater(Runnable runnable)(Code)
Convenience for getRobot().invokeLater(Runnable).



isShowing
public boolean isShowing(String id)(Code)
Returns whether a Component is showing. The ID may be the component name or, in the case of a Frame or Dialog, the title. Regular expressions may be used, but must be delimited by slashes, e.g. /expr/. Returns if one or more matches is found.



isShowing
public boolean isShowing(String id, ComponentFinder finder)(Code)
Same as AWTFixtureHelper.isShowing(String) , but uses the given ComponentFinder to do the lookup.



restore
public void restore()(Code)
Restore the state that was preserved when this object was created.



setModifiers
public void setModifiers(int modifiers, boolean pressed)(Code)
Convenience method to set key modifiers. Using this method is preferred to invoking Robot.setModifiers(intboolean) or Robot.keyPress(int) , since this method's effects will be automatically undone at the end of the test. If you use the Robot methods, you must remember to release any keys pressed during the test.
Parameters:
  modifiers - mask indicating which modifier keys to use
Parameters:
  pressed - whether the modifiers should be in the pressed state.



showFrame
public Frame showFrame(Component comp)(Code)
This method should be invoked to display the component under test. The frame's size will be its preferred size. This method will return with the enclosing Frame is showing and ready for input.



showFrame
public Frame showFrame(Component comp, Dimension size)(Code)
This method should be invoked to display the component under test, when a specific size of frame is desired. The method will return when the enclosing Frame is showing and ready for input.
Parameters:
  comp -
Parameters:
  size - Desired size of the enclosing frame, or nullto make no explicit adjustments to its size.



showFrame
public Frame showFrame(Component comp, Dimension size, String title)(Code)
This method should be invoked to display the component under test, when a specific size of frame is desired. The method will return when the enclosing Frame is showing and ready for input.
Parameters:
  comp -
Parameters:
  size - Desired size of the enclosing frame, or nullto make no explicit adjustments to its size.
Parameters:
  title - Title of the wrapping frame



showModalDialog
public Dialog showModalDialog(Runnable showAction) throws ComponentSearchException(Code)
Display a modal dialog and wait for it to show. Useful for things like javax.swing.JFileChooser.showOpenDialog(java.awt.Component) or javax.swing.JOptionPane.showInputDialog(Object) , or any other instance where the dialog contents are not predefined and displaying the dialog involves anything more than Window.setVisible(boolean) show()/setVisible(true (if Window.setVisible(boolean) show()/setVisible(true) is all that is required, use the AWTFixtureHelper.showWindow(Window) method instead).

The given Runnable should contain the code which will show the modal Dialog (and thus block); it will be run on the event dispatch thread.

This method will return when a Dialog becomes visible which contains the given component (which may be any component which will appear on the Dialog ), or the standard timeout (10s) is reached, at which point a RuntimeException will be thrown.

For example,


 final Frame parent = ...;
 Dialog d = showModalDialog(new Runnable) {
 public void run() {
 JOptionPane.showInputDialog(parent, "Hit me");
 }
 });
 

See Also:   AWTFixtureHelper.showWindow(java.awt.Window)
See Also:   AWTFixtureHelper.showWindow(java.awt.Window,java.awt.Dimension)
See Also:   AWTFixtureHelper.showWindow(java.awt.Window,java.awt.Dimension,boolean)



showModalDialog
public Dialog showModalDialog(Runnable showAction, ComponentFinder finder) throws ComponentSearchException(Code)
Same as AWTFixtureHelper.showModalDialog(Runnable) , but provides a custom ComponentFinder to find the dialog.



showPopup
public void showPopup(JPopupMenu popup, Component invoker)(Code)
Safely install and display a popup in the center of the given component, returning when it is visible. Does not install any mouse handlers not generate any mouse events.



showPopup
public void showPopup(JPopupMenu popup, Component invoker, int x, int y)(Code)
Safely install and display a popup, returning when it is visible. Does not install any mouse handlers not generate any mouse events.



showWindow
public void showWindow(Window w)(Code)
Safely display a window with proper EDT synchronization. This method blocks until the Window is showing and ready for input.



showWindow
public void showWindow(Window w, Dimension size)(Code)
Safely display a window with proper EDT synchronization. This method blocks until the Window is showing and ready for input.



showWindow
public void showWindow(Window w, Dimension size, boolean pack)(Code)
Safely display a window with proper EDT synchronization. This method blocks until the window is showing. This method will return even when the window is a modal dialog, since the show method is called on the event dispatch thread. The window will be packed if the pack flag is set, and set to the given size if it is non-null.

Modal dialogs may be shown with this method without blocking.




waitForWindow
public void waitForWindow(Window w, boolean visible)(Code)
Return when the window is ready for input or times out waiting.
Parameters:
  w -



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.