junit.extensions.awt.script
Class Sequence

java.lang.Object
  |
  +--junit.extensions.awt.script.Step
        |
        +--junit.extensions.awt.script.Sequence
All Implemented Interfaces:
StepListener, Tags, XMLifiable
Direct Known Subclasses:
Script

public class Sequence
extends Step
implements StepListener

Script step which groups a sequence of other Steps. The sub-Steps have a fixed order and are executed in the order contained in the sequence. Events sent by sub-Steps are propagated by this one.


Fields inherited from class junit.extensions.awt.script.Step
listeners, parser, STEP_END, STEP_ERROR, STEP_FAILURE, STEP_PROGRESS, STEP_START
 
Fields inherited from interface junit.extensions.awt.script.Tags
TAG_ACTION, TAG_ARGS, TAG_ASSERT, TAG_AWTTESTSCRIPT, TAG_CLASS, TAG_COMPONENT, TAG_COUNT, TAG_DESC, TAG_EVENT, TAG_FILENAME, TAG_ID, TAG_INVERT, TAG_INVOKER, TAG_KEYCHAR, TAG_KEYCODE, TAG_KIND, TAG_LAUNCH, TAG_METHOD, TAG_MODIFIERS, TAG_NAME, TAG_PARENT, TAG_POLL_INTERVAL, TAG_SCRIPT, TAG_SEQUENCE, TAG_STOP_ON_ERROR, TAG_STOP_ON_FAILURE, TAG_TAG, TAG_TERMINATE, TAG_THREADED, TAG_TIMEOUT, TAG_TITLE, TAG_TRIGGER, TAG_TYPE, TAG_VALUE, TAG_WAIT, TAG_WINDOW, TAG_X, TAG_Y
 
Constructor Summary
Sequence(Resolver resolver, ComponentFinder finder, org.w3c.dom.Element el, java.util.HashMap atts)
           
Sequence(Resolver resolver, ComponentFinder finder, java.util.HashMap atts)
           
Sequence(Resolver resolver, ComponentFinder finder, java.lang.String desc, java.util.ArrayList steps)
          Create an aggregate from existing AWTEvents.
 
Method Summary
 void addStep(int index, Step step)
          Inserts a step at the given index in the sequence.
 void addStep(Step step)
          Adds a step to the end of the sequence.
 void clear()
          Remove all stepchildren.
protected  void clearFailures()
          Recursively clear all failures.
protected  java.lang.String getContents()
          Override if the step actually has some contents.
protected  java.lang.String getDefaultDescription()
          Return a reasonable default description for this script step.
 Step getStep(int index)
          Return the step at the given index in the sequence.
protected  java.lang.String getUsage()
          Returns a string describing the proper XML usage for this class.
protected  java.lang.String getXMLTag()
          Define the XML tag to use for this script step.
 int indexOf(Step step)
          Returns the index of the given step in the sequence, or -1 if the step is not in the sequence.
protected  void parseChild(org.w3c.dom.Element child)
           
protected  void parseChildren(org.w3c.dom.Node node)
           
 void removeStep(int index)
          Removes the step at the given index in the sequence.
 void removeStep(Step step)
          Removes the step if it exists in the sequence.
protected  void runStep()
          Process each event in our list.
 void setStep(int index, Step step)
          Replaces the step at the given index.
 int size()
          Returns the number of steps contained in this one.
 void stateChanged(StepEvent ev)
          Propagate step changes to whomever is listening.
 java.util.List steps()
          Returns a list of the steps contained in this one.
 
Methods inherited from class junit.extensions.awt.script.Step
addStepListener, createAttributeMap, createStep, createStep, fireStepEnd, fireStepError, fireStepEvent, fireStepEvent, fireStepEvent, fireStepFailure, fireStepProgress, fireStepStart, getAttributes, getDescription, getError, getFailure, getFinder, getResolver, getStopOnError, getStopOnFailure, getTester, parseAttributes, removeStepListener, resolve, resolveTester, run, setDescription, setError, setFailure, setStopOnError, setStopOnFailure, simpleClassName, toString, toXML, usage, usage
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Sequence

public Sequence(Resolver resolver,
                ComponentFinder finder,
                org.w3c.dom.Element el,
                java.util.HashMap atts)
         throws InvalidScriptException

Sequence

public Sequence(Resolver resolver,
                ComponentFinder finder,
                java.util.HashMap atts)

Sequence

public Sequence(Resolver resolver,
                ComponentFinder finder,
                java.lang.String desc,
                java.util.ArrayList steps)
Create an aggregate from existing AWTEvents.
Method Detail

parseChild

protected void parseChild(org.w3c.dom.Element child)
                   throws InvalidScriptException

parseChildren

protected void parseChildren(org.w3c.dom.Node node)
                      throws InvalidScriptException

getDefaultDescription

protected java.lang.String getDefaultDescription()
Description copied from class: Step
Return a reasonable default description for this script step. This value is used in the absence of an explicit description.
Overrides:
getDefaultDescription in class Step

getXMLTag

protected java.lang.String getXMLTag()
Description copied from class: Step
Define the XML tag to use for this script step.
Overrides:
getXMLTag in class Step

getContents

protected java.lang.String getContents()
Description copied from class: Step
Override if the step actually has some contents. In most cases, it wont't.
Overrides:
getContents in class Step

getUsage

protected java.lang.String getUsage()
Returns a string describing the proper XML usage for this class.
Overrides:
getUsage in class Step

clearFailures

protected void clearFailures()
Recursively clear all failures.
Overrides:
clearFailures in class Step

runStep

protected void runStep()
                throws java.lang.Throwable
Process each event in our list.
Overrides:
runStep in class Step

size

public int size()
Returns the number of steps contained in this one.

clear

public void clear()
Remove all stepchildren. More effective than Cinderella's stepmother.

steps

public java.util.List steps()
Returns a list of the steps contained in this one.

indexOf

public int indexOf(Step step)
Returns the index of the given step in the sequence, or -1 if the step is not in the sequence.

getStep

public Step getStep(int index)
Return the step at the given index in the sequence.

addStep

public void addStep(int index,
                    Step step)
Inserts a step at the given index in the sequence.

addStep

public void addStep(Step step)
Adds a step to the end of the sequence.

setStep

public void setStep(int index,
                    Step step)
Replaces the step at the given index.

removeStep

public void removeStep(Step step)
Removes the step if it exists in the sequence.

removeStep

public void removeStep(int index)
Removes the step at the given index in the sequence.

stateChanged

public void stateChanged(StepEvent ev)
Propagate step changes to whomever is listening.
Specified by:
stateChanged in interface StepListener