KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > groboutils > uicapture > v1 > IScriptMaker


1 /*
2  * @(#)IScriptMaker.java
3  *
4  * Copyright (C) 2002-2003 Matt Albrecht
5  * groboclown@users.sourceforge.net
6  * http://groboutils.sourceforge.net
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a
9  * copy of this software and associated documentation files (the "Software"),
10  * to deal in the Software without restriction, including without limitation
11  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12  * and/or sell copies of the Software, and to permit persons to whom the
13  * Software is furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24  * DEALINGS IN THE SOFTWARE.
25  */

26
27 package net.sourceforge.groboutils.uicapture.v1;
28
29 import java.io.File JavaDoc;
30
31 /**
32  * Implementors of this interface accept a collection of UI captured
33  * events as they relate to creating a play-back script. This interface
34  * dictates that the contract for all IScriptMaker instances, the
35  * {@link #start()} method
36  * <b>must</b> be called before any other method, and no other method, besides
37  * <tt>toString()</tt>, may be called after invoking the {@link #end()} method.
38  *
39  * @author Matt Albrecht <a HREF="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
40  * @version $Date: 2003/02/10 22:52:31 $
41  * @since Jan 7, 2002
42  */

43 public interface IScriptMaker
44 {
45
46     //-------------------------------------------------------------------------
47
// Public methods
48

49
50     /**
51      * Starts the script generation.
52      *
53      * @exception IllegalStateException if <tt>start()</tt> has already been
54      * called.
55      */

56     public void start();
57     
58     
59     /**
60      * Terminates the script generation.
61      *
62      * @exception IllegalStateException if <tt>start()</tt> has not been called,
63      * or if <tt>end()</tt> has already been called.
64      */

65     public void end();
66
67     
68     /**
69      * Cause the script to delay for the given number of milliseconds.
70      *
71      * @param milliseconds the number of milliseconds in the delay.
72      * @exception IllegalStateException if <tt>start()</tt> has not been called,
73      * or if <tt>end()</tt> has already been called.
74      */

75     public void generateDelay( long milliseconds );
76
77     
78     /**
79      * Cause the script to rotate the mouse wheel.
80      *
81      * @param rotate the number of rotations the mouse wheel generated.
82      * @exception IllegalStateException if <tt>start()</tt> has not been called,
83      * or if <tt>end()</tt> has already been called.
84      * @see java.awt.event.MouseWheelEvent
85      */

86     public void generateMoveMouseWheel( int rotate );
87
88     
89     /**
90      * Cause the script to move the mouse.
91      *
92      * @param x the x-coordinate that the mouse moved to
93      * @param y the y-coordinate that the mouse moved to
94      * @exception IllegalStateException if <tt>start()</tt> has not been called,
95      * or if <tt>end()</tt> has already been called.
96      */

97     public void generateMoveMouse( int x, int y );
98
99     
100     /**
101      * Cause the script to press a mouse button.
102      *
103      * @param modifier the modifier code for the mouse button pressed.
104      * @exception IllegalStateException if <tt>start()</tt> has not been called,
105      * or if <tt>end()</tt> has already been called.
106      * @see java.awt.event.MouseEvent
107      */

108     public void generatePressMouse( int modifer );
109
110     
111     /**
112      * Cause the script to release a mouse button.
113      *
114      * @param modifier the modifier code for the mouse button released.
115      * @exception IllegalStateException if <tt>start()</tt> has not been called,
116      * or if <tt>end()</tt> has already been called.
117      * @see java.awt.event.MouseEvent
118      */

119     public void generateReleaseMouse( int modifier );
120
121     
122     /**
123      * Cause the script to press a key.
124      *
125      * @param keyCode code for the pressed key.
126      * @exception IllegalStateException if <tt>start()</tt> has not been called,
127      * or if <tt>end()</tt> has already been called.
128      * @see java.awt.event.KeyEvent
129      */

130     public void generatePressKey( int keyCode );
131
132     
133     /**
134      * Cause the script to release a key.
135      *
136      * @param keyCode code for the released key.
137      * @exception IllegalStateException if <tt>start()</tt> has not been called,
138      * or if <tt>end()</tt> has already been called.
139      * @see java.awt.event.KeyEvent
140      */

141     public void generateReleaseKey( int keyCode );
142
143     
144     /**
145      * Cause the script to capture a screen shot. Probably, it should compare
146      * the captured image against the original saved image.
147      *
148      * @param originalImage file containing the original image for the screen
149      * capture that the generated script will compare against when the
150      * test is run.
151      * @param x screen image bounds.
152      * @param y screen image bounds.
153      * @param width screen image bounds.
154      * @param height screen image bounds.
155      *
156      * @exception IllegalStateException if <tt>start()</tt> has not been called,
157      * or if <tt>end()</tt> has already been called.
158      */

159     public void generateScreenCapture( File JavaDoc originalImage,
160             int x, int y, int width, int height );
161 }
162
163
Popular Tags