abbot.editor.recorder
Class SemanticRecorder

java.lang.Object
  extended by abbot.editor.recorder.SemanticRecorder
All Implemented Interfaces:
SemanticEvents
Direct Known Subclasses:
ComponentRecorder

public abstract class SemanticRecorder
extends Object
implements SemanticEvents

Template for recording AWTEvents and converting them into an appropriate semantic event. The EventRecorder class decides which SemanticRecorder to use and handles cancel/termination. Implementations should be named AbstractButtonRecorder, JTableRecorder, etc. The semantic recorders will be dynamically loaded based on the component receiving a given event (compare to ComponentTester).

See EventRecorder for implementation details.


Field Summary
protected  ArrayList events
           
 
Fields inherited from interface abbot.editor.recorder.SemanticEvents
SE_ANY, SE_CLICK, SE_DRAG, SE_DROP, SE_IM, SE_KEY, SE_MENU, SE_NONE, SE_TEXT, SE_WINDOW
 
Constructor Summary
SemanticRecorder(Resolver resolver)
          Create a SemanticRecorder for use in capturing the semantics of a GUI action.
 
Method Summary
abstract  boolean accept(AWTEvent event)
          Returns whether this SemanticRecorder wishes to accept the given event and subsequent events.
 void addActionListener(ActionListener al)
          Supports at most one listener.
protected abstract  Step createStep()
          Create a step based on the events received thus far.
 int getRecordingType()
           
protected  Resolver getResolver()
          Return the Resolver to be used by this recorder.
 Step getStep()
          Returns the script step generated from the events recorded so far.
protected  void init(int recordingType)
           
 boolean isFinished()
          Return whether this recorder has finished recording the current semantic event.
abstract  boolean parse(AWTEvent event)
          Handle an event.
 boolean record(AWTEvent event)
          Handle an event.
protected  void setFinished(boolean state)
          Invoke when end of the semantic event has been seen.
protected  void setRecordingType(int type)
           
protected  void setStatus(String msg)
          Indicate the current recording state, so that the status may be displayed elsewhere.
protected  void setStep(Step newStep)
          Add the given step.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

events

protected ArrayList events
Constructor Detail

SemanticRecorder

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

Method Detail

addActionListener

public void addActionListener(ActionListener al)
Supports at most one listener.


getRecordingType

public int getRecordingType()

setRecordingType

protected void setRecordingType(int type)

init

protected void init(int recordingType)

accept

public abstract boolean accept(AWTEvent event)
Returns whether this SemanticRecorder wishes to accept the given event and subsequent events.


record

public final boolean record(AWTEvent event)
Handle an event. Returns whether the event was consumed.


parse

public abstract boolean parse(AWTEvent event)
Handle an event. Return true if the event has been consumed. Returning false usually means that isFinished() will return true.


getResolver

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


getStep

public Step getStep()
             throws BugReport
Returns the script step generated from the events recorded so far. If no real action resulted, may return null (for example, a mouse press on a button which releases outside the button).

Throws:
BugReport

createStep

protected abstract Step createStep()
Create a step based on the events received thus far. Returns null if no semantic event or an imcomplete event has been detected.


setStep

protected void setStep(Step newStep)
Add the given step. Should be used when the recorder detects a complete semantic event sequence. After this point, the recorder will no longer accept events.


isFinished

public boolean isFinished()
Return whether this recorder has finished recording the current semantic event.


setFinished

protected void setFinished(boolean state)
Invoke when end of the semantic event has been seen.


setStatus

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



Copyright © 2002-2008 Timothy Wall. All Rights Reserved.
Abbot is hosted on

SourceForge