junit.extensions.awt.editor
Class EventRecorder

java.lang.Object
  |
  +--junit.extensions.awt.editor.Recorder
        |
        +--junit.extensions.awt.editor.EventRecorder

public class EventRecorder
extends Recorder

Provides recording of raw AWT events, attempting to parse them as high-level semantic events. Typing ESC will terminate the recording (ESC can be recorded separately using a key recorder if necessary).


Constructor Summary
EventRecorder(Resolver resolver, ComponentFinder finder, java.awt.event.ActionListener l)
          Create a Recorder for use in capturing raw AWTEvents.
 
Method Summary
protected  Step createStep()
          Encapsulate all the events we've collected into a single sequence.
protected  void eventDispatched(java.awt.AWTEvent event)
          Handle an action.
 long getEventMask()
          Return the events of interest to this Recorder.
 java.lang.String getName()
          Return the name of the type of GUI action to be recorded.
protected  void initialize()
          Set up state prior to capturing events.
 boolean isCancelEvent(java.awt.AWTEvent event)
          ESC indicates the end of the stream, unless no windows are showing, in which case it will cancel the recording.
protected  boolean shouldStop()
          The stop flag gets set when we've determined we should stop recording events.
 
Methods inherited from class junit.extensions.awt.editor.Recorder
cancel, eventToString, getFinder, getResolver, record, recordEvent, setResolver, setStatus, simpleClassName
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventRecorder

public EventRecorder(Resolver resolver,
                     ComponentFinder finder,
                     java.awt.event.ActionListener l)
Create a Recorder for use in capturing raw AWTEvents.
Method Detail

getName

public java.lang.String getName()
Return the name of the type of GUI action to be recorded.
Overrides:
getName in class Recorder

initialize

protected void initialize()
Description copied from class: Recorder
Set up state prior to capturing events.
Overrides:
initialize in class Recorder

shouldStop

protected boolean shouldStop()
The stop flag gets set when we've determined we should stop recording events.
Overrides:
shouldStop in class Recorder

createStep

protected Step createStep()
Encapsulate all the events we've collected into a single sequence. Translate COMPONENT_SHOWN/HIDDEN into wait actions. Compress mouse motion (if it's really needed, then write a mouse motion recorder).
Overrides:
createStep in class Recorder

eventDispatched

protected void eventDispatched(java.awt.AWTEvent event)
Handle an action. This can either be ignored, contribute to the recording, or cause the recording to be canceled.
Overrides:
eventDispatched in class Recorder

getEventMask

public long getEventMask()
Return the events of interest to this Recorder. Note that it is essential to put waits between the event playback...
Overrides:
getEventMask in class Recorder

isCancelEvent

public boolean isCancelEvent(java.awt.AWTEvent event)
ESC indicates the end of the stream, unless no windows are showing, in which case it will cancel the recording. Maybe have some other event indicate end of stream so ESC can be used for cancel?
Overrides:
isCancelEvent in class Recorder