Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

abbot.editor.recorder
Class Recorder  view Recorder download Recorder.java

java.lang.Object
  extended byabbot.editor.recorder.Recorder
Direct Known Subclasses:
EventRecorder

public abstract class Recorder
extends java.lang.Object

The Recorder provides a mechanism for recording an event stream and generating one or more script steps from that stream. The base abstract Recorder class handles the logistics of capturing the events, cancellation and termination with proper synchronization. The concrete implementation tracks the individual events to produce the desired high level user action representations.

NOTE: when writing a recorder, be very careful not to test for platform-specific behavior, and avoid being susceptible to platform-specific bugs. Please make sure the recorder works on both pointer-focus and click-to-focus window managers, as well as on at least two platforms.


Nested Class Summary
private  class Recorder.EventListener
           
private static class Recorder.HierarchyEventEnabler
           
 
Field Summary
private  java.awt.event.ActionListener al
           
private static java.awt.event.AWTEventListener awtl
           
private  boolean canceled
           
private  java.lang.String cancelMsg
           
private static boolean enabled
           
private  java.awt.event.AWTEventListener eventListener
           
private  abbot.ComponentFinder finder
           
private static java.awt.event.HierarchyBoundsListener hbl
           
private static java.awt.event.HierarchyListener hl
           
private  abbot.Resolver resolver
           
private  boolean started
           
private  boolean suspended
           
private  boolean terminated
           
 
Constructor Summary
Recorder(abbot.Resolver resolver)
          Create a Recorder for use in capturing the semantics of a GUI action.
 
Method Summary
 void addActionListener(java.awt.event.ActionListener al)
          The recorder supports zero or one listeners.
private static void addHierarchyListeners(java.awt.Component c)
           
 void cancel(java.lang.String why)
          Cancel the current recording.
protected abstract  abbot.script.Step createStep()
          Create a script step based on the events gathered so far.
(package private) static void disableHierarchyEvents()
           
(package private) static void enableHierarchyEvents()
          Add a hierarchy listener to every window to ensure that they generate hierarchyEvents, so that AWTEventListeners will receive hierarchy events.
protected abstract  void eventDispatched(java.awt.AWTEvent event)
          Handle an action.
 long getEventMask()
          Return the events of interest to this Recorder.
protected  abbot.ComponentFinder getFinder()
          Return the ComponentFinder to be used by this recorder.
protected  java.awt.event.ActionListener getListener()
           
abstract  java.lang.String getName()
          Return the name of the type of GUI action to be recorded.
protected  abbot.Resolver getResolver()
          Return the Resolver to be used by this recorder.
abstract  void insertStep(abbot.script.Step step)
          Insert an arbitrary script step into the currently recorded stream.
static boolean isModifier(int code)
           
 boolean isRecording()
          Return whether the recorder has started capturing events.
 abbot.script.Step record()
          Record the GUI action.
 void recordEvent(java.awt.AWTEvent event)
           
private static void removeHierarchyListeners(java.awt.Component c)
           
 void resume()
           
protected  void setStatus(java.lang.String msg)
          Indicate the current recording state, so that the status may be displayed elsewhere.
protected static java.lang.String simpleClassName(java.lang.Class cls)
           
 void suspend()
           
 void terminate()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

al

private java.awt.event.ActionListener al

resolver

private abbot.Resolver resolver

finder

private abbot.ComponentFinder finder

cancelMsg

private java.lang.String cancelMsg

canceled

private volatile boolean canceled

terminated

private volatile boolean terminated

suspended

private volatile boolean suspended

started

private volatile boolean started

eventListener

private java.awt.event.AWTEventListener eventListener

enabled

private static boolean enabled

hl

private static java.awt.event.HierarchyListener hl

hbl

private static java.awt.event.HierarchyBoundsListener hbl

awtl

private static java.awt.event.AWTEventListener awtl
Constructor Detail

Recorder

public Recorder(abbot.Resolver resolver)
Create a Recorder for use in capturing the semantics of a GUI action.

Method Detail

addActionListener

public void addActionListener(java.awt.event.ActionListener al)
The recorder supports zero or one listeners.


getListener

protected java.awt.event.ActionListener getListener()

getName

public abstract java.lang.String getName()
Return the name of the type of GUI action to be recorded.


createStep

protected abstract abbot.script.Step createStep()
Create a script step based on the events gathered so far.


isRecording

public boolean isRecording()
Return whether the recorder has started capturing events.


insertStep

public abstract void insertStep(abbot.script.Step step)
Insert an arbitrary script step into the currently recorded stream.


record

public abbot.script.Step record()
                         throws RecordingCanceledException
Record the GUI action. Blocks until the recorder is either canceled or terminated.


suspend

public void suspend()

resume

public void resume()

terminate

public void terminate()

cancel

public void cancel(java.lang.String why)
Cancel the current recording.


eventDispatched

protected abstract 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.


isModifier

public static boolean isModifier(int code)

recordEvent

public void recordEvent(java.awt.AWTEvent event)

getEventMask

public long getEventMask()
Return the events of interest to this Recorder.


getFinder

protected abbot.ComponentFinder getFinder()
Return the ComponentFinder to be used by this recorder.


getResolver

protected abbot.Resolver getResolver()
Return the Resolver to be used by this recorder.


setStatus

protected void setStatus(java.lang.String msg)
Indicate the current recording state, so that the status may be displayed elsewhere.


simpleClassName

protected static java.lang.String simpleClassName(java.lang.Class cls)

addHierarchyListeners

private static void addHierarchyListeners(java.awt.Component c)

removeHierarchyListeners

private static void removeHierarchyListeners(java.awt.Component c)

enableHierarchyEvents

static void enableHierarchyEvents()
Add a hierarchy listener to every window to ensure that they generate hierarchyEvents, so that AWTEventListeners will receive hierarchy events. This is required for detecting window show/hide/move/resize events, otherwise they'll never appear on the event queue.


disableHierarchyEvents

static void disableHierarchyEvents()