abbot.script
Class Action

java.lang.Object
  |
  +--abbot.script.Step
        |
        +--abbot.script.Call
              |
              +--abbot.script.Action
All Implemented Interfaces:
Serializable, Tags, XMLifiable

public class Action
extends Call

Encapsulate an action. Usage:

<action method="..." args="...">
<action method="..." args="component_id[,...]" class="...">
An Action reproduces a user semantic action (such as a mouse click, menu selection, or drag/drop action) on a particular component. The id of the component being operated on must be the first argument, and the class of that component must be identified by the class tag if the action is not provided by the base ComponentTester class.

Note that the method name is the name of the actionXXX method, e.g. to click a button (actionClick on AbstractButtonTester), the XML would appear thus:

<action method="actionClick" args="My Button" class=javax.swing.AbstractButton>
Note that if the first argument is a Component, the class tag is required. Note also that the specified class is the tested class, not the target class for the method invocation.

See Also:
Serialized Form

Fields inherited from interface abbot.script.Tags
TAG_ACTION, TAG_ARGS, TAG_ASSERT, TAG_AWTTESTSCRIPT, TAG_CALL, TAG_CLASS, TAG_CLASSPATH, TAG_COMMENT, TAG_COMPONENT, TAG_COUNT, TAG_DELEGATE, TAG_DESC, TAG_DOCBASE, TAG_EVENT, TAG_FILENAME, TAG_FORKED, TAG_HEIGHT, TAG_HORDER, TAG_ID, TAG_INDEX, TAG_INVERT, TAG_INVOKER, TAG_KEYCHAR, TAG_KEYCODE, TAG_KIND, TAG_LAUNCH, TAG_METHOD, TAG_MODIFIERS, TAG_NAME, TAG_PARAMS, TAG_PARENT, TAG_POLL_INTERVAL, TAG_PROPERTY, TAG_SAMPLE, TAG_SCRIPT, TAG_SEQUENCE, TAG_SLOW, 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_VMARGS, TAG_VORDER, TAG_WAIT, TAG_WIDTH, TAG_WINDOW, TAG_X, TAG_Y
 
Constructor Summary
Action(Resolver resolver, Map attributes)
           
Action(Resolver resolver, String description, String methodName, String[] args)
          Action for a method in the ComponentTester base class.
Action(Resolver resolver, String description, String methodName, String[] args, Class targetClass)
           
 
Method Summary
 Map getAttributes()
          Return custom attributes for an Action.
protected  String getDefaultDescription()
          Return a default description for this action.
protected  Method getMethod()
          Resolve the method name into its final form.
protected  Object getTarget(Method m)
          Return the target of the invocation.
 Class getTargetClass()
          Get the class of the target of the method invocation.
 String getUsage()
          Return the proper XML usage for this step.
 String getXMLTag()
          Return the XML tag for this step.
 void setTargetClassName(String cn)
          Ensure the default class name is "java.awt.Component".
 
Methods inherited from class abbot.script.Call
encode, getArgs, getEncodedArguments, getMethodName, getTargetClassName, invoke, resolveMethod, runStep, setArguments, setMethodName
 
Methods inherited from class abbot.script.Step
addAttributes, addContent, createAttributeMap, createStep, createStep, getDescription, getFinder, getResolver, parseStepAttributes, resolve, resolveClass, resolveTester, run, setDescription, setScriptError, simpleClassName, toEditableString, toString, toXML, toXMLString, usage, usage
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Action

public Action(Resolver resolver,
              Map attributes)

Action

public Action(Resolver resolver,
              String description,
              String methodName,
              String[] args)
Action for a method in the ComponentTester base class.

Action

public Action(Resolver resolver,
              String description,
              String methodName,
              String[] args,
              Class targetClass)
Method Detail

setTargetClassName

public void setTargetClassName(String cn)
Ensure the default class name is "java.awt.Component". The target class must be a subclass of java.awt.Component.
Overrides:
setTargetClassName in class Call

getXMLTag

public String getXMLTag()
Return the XML tag for this step.
Overrides:
getXMLTag in class Call

getAttributes

public Map getAttributes()
Return custom attributes for an Action.
Overrides:
getAttributes in class Call

getUsage

public String getUsage()
Return the proper XML usage for this step.
Overrides:
getUsage in class Call

getDefaultDescription

protected String getDefaultDescription()
Return a default description for this action.
Overrides:
getDefaultDescription in class Call

getTargetClass

public Class getTargetClass()
                     throws InvalidScriptException
Description copied from class: Call
Get the class of the target of the method invocation. This is public to provide editors access to the class being used (for example, providing a menu of all available methods).
Overrides:
getTargetClass in class Call

getTarget

protected Object getTarget(Method m)
                    throws InvalidScriptException
Return the target of the invocation.
Overrides:
getTarget in class Call

getMethod

protected Method getMethod()
                    throws InvalidScriptException
Resolve the method name into its final form.
Overrides:
getMethod in class Call


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

SourceForge