abbot.editor
Class ScriptEditor

java.lang.Object
  extended by abbot.editor.ScriptEditor
All Implemented Interfaces:
EditorConstants, Resolver, ActionListener, EventListener

public class ScriptEditor
extends Object
implements ActionListener, Resolver, EditorConstants

This is the 'model' behind the script editor UI.

Acts as a resolver, using the currently in-context script as the component resolver.


Field Summary
static int KC_INVERT
          Key to use to invert an assertion/wait.
static int KC_WAIT
          Key to use to insert a wait instead of an assertion.
 
Fields inherited from interface abbot.editor.EditorConstants
ACTION_CAPTURE, ACTION_CAPTURE_ALL, ACTION_CAPTURE_COMPONENT, ACTION_CAPTURE_IMAGE, ACTION_DYNAMIC, ACTION_EDITOR_ABOUT, ACTION_EDITOR_BUGREPORT, ACTION_EDITOR_EMAIL, ACTION_EDITOR_QUIT, ACTION_EDITOR_USERGUIDE, ACTION_EDITOR_WEBSITE, ACTION_EXPORT_HIERARCHY, ACTION_GET_VMARGS, ACTION_INSERT_ANNOTATION, ACTION_INSERT_APPLET, ACTION_INSERT_CALL, ACTION_INSERT_COMMENT, ACTION_INSERT_EXPRESSION, ACTION_INSERT_FIXTURE, ACTION_INSERT_LAUNCH, ACTION_INSERT_SAMPLE, ACTION_INSERT_SCRIPT, ACTION_INSERT_SEQUENCE, ACTION_INSERT_TERMINATE, ACTION_PREFIX, ACTION_RUN, ACTION_RUN_LAUNCH, ACTION_RUN_SELECTED, ACTION_RUN_TERMINATE, ACTION_RUN_TO, ACTION_SCRIPT_CLEAR, ACTION_SCRIPT_CLOSE, ACTION_SCRIPT_DELETE, ACTION_SCRIPT_DUPLICATE, ACTION_SCRIPT_NEW, ACTION_SCRIPT_OPEN, ACTION_SCRIPT_RENAME, ACTION_SCRIPT_SAVE, ACTION_SCRIPT_SAVE_AS, ACTION_SELECT_COMPONENT, ACTION_SELECT_TESTSUITE, ACTION_STEP_CUT, ACTION_STEP_GROUP, ACTION_STEP_MOVE_DOWN, ACTION_STEP_MOVE_UP, ACTION_TOGGLE_AWT_MODE, ACTION_TOGGLE_FORKED, ACTION_TOGGLE_SLOW_PLAYBACK, ACTION_TOGGLE_STOP_ON_ERROR, ACTION_TOGGLE_STOP_ON_FAILURE, MENU_CAPTURE, MENU_EDIT, MENU_FILE, MENU_HELP, MENU_INSERT, MENU_TEST
 
Constructor Summary
ScriptEditor(EditorContext ec)
          Constructs a ScriptEditor which handles script editing logic.
 
Method Summary
 void actionPerformed(ActionEvent ev)
          Respond to various components.
 ComponentReference addComponent(Component comp)
          From abbot.Resolver.
 void addComponentReference(ComponentReference ref)
          From abbot.Resolver.
(package private)  void addStep(Step step)
          Insert a new step at the current cursor location.
protected  boolean checkSaveBeforeClose()
           
 void copyFixture(Script src)
          Copy the fixture from the given script into the current one.
(package private)  void dispose()
           
 String getComponentID(Component comp)
          Returns null if not found.
 ComponentReference getComponentReference(Component comp)
          From abbot.Resolver.
 ComponentReference getComponentReference(String refid)
          From abbot.Resolver.
 Collection getComponentReferences()
          From abbot.Resolver.
 String getContext(Step step)
          From abbot.Resolver.
 ClassLoader getContextClassLoader()
          From abbot.Resolver.
 File getDirectory()
          From abbot.Resolver.
 Hierarchy getHierarchy()
          Get Hierarchy used by this Resolver.
 Object getProperty(String name)
          From abbot.Resolver.
(package private)  Resolver getResolverContext()
           
(package private)  void insertApplet()
          Insert an applet step.
(package private)  void insertLaunch()
          Insert a launch step.
(package private)  void insertTerminate()
          Insert a terminate step.
static void main(String[] args)
          Launch the script editor, with an argument of either a test suite class or a script filename.
(package private)  void newScript(File file, boolean copyFixture)
          Create a new script at the given filename, or open it if it already exists.
(package private)  void quitApplication()
          Quit the application.
(package private)  void saveNestedScripts(Sequence seq)
           
 void setProperty(String name, Object value)
          From abbot.Resolver.
(package private)  void setScript(String filename)
          Set the current test script.
 void setStatus(String msg)
          Set the contents of the status message.
 void setStatus(String msg, String extended, int type)
          Set the contents of the status message.
static void showEditor(EditorContext ec)
          Launch the script editor, with an argument that represents a variety of editor customizations.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

KC_INVERT

public static final int KC_INVERT
Key to use to invert an assertion/wait.

See Also:
Constant Field Values

KC_WAIT

public static final int KC_WAIT
Key to use to insert a wait instead of an assertion. Use option key on mac, control key anywhere else.

Constructor Detail

ScriptEditor

public ScriptEditor(EditorContext ec)
Constructs a ScriptEditor which handles script editing logic. ScriptEditorFrame provides the view/controller.

See Also:
ScriptEditorFrame
Method Detail

actionPerformed

public void actionPerformed(ActionEvent ev)
Respond to various components.

Specified by:
actionPerformed in interface ActionListener

insertLaunch

void insertLaunch()
Insert a launch step.


insertApplet

void insertApplet()
Insert an applet step.


insertTerminate

void insertTerminate()
Insert a terminate step.


setScript

void setScript(String filename)
Set the current test script.


checkSaveBeforeClose

protected boolean checkSaveBeforeClose()
Returns:
true if it's ok to exit.

quitApplication

void quitApplication()
Quit the application.


setStatus

public void setStatus(String msg)
Set the contents of the status message.


setStatus

public void setStatus(String msg,
                      String extended,
                      int type)
Set the contents of the status message.


getComponentID

public String getComponentID(Component comp)
Returns null if not found.


addStep

void addStep(Step step)
Insert a new step at the current cursor location.


newScript

void newScript(File file,
               boolean copyFixture)
Create a new script at the given filename, or open it if it already exists. Optionally copies the fixture from the current script.


copyFixture

public void copyFixture(Script src)
Copy the fixture from the given script into the current one.


saveNestedScripts

void saveNestedScripts(Sequence seq)
                 throws IOException
Throws:
IOException

getResolverContext

Resolver getResolverContext()

getComponentReference

public ComponentReference getComponentReference(String refid)
From abbot.Resolver.

Specified by:
getComponentReference in interface Resolver

getComponentReference

public ComponentReference getComponentReference(Component comp)
From abbot.Resolver.

Specified by:
getComponentReference in interface Resolver

addComponentReference

public void addComponentReference(ComponentReference ref)
From abbot.Resolver.

Specified by:
addComponentReference in interface Resolver

addComponent

public ComponentReference addComponent(Component comp)
From abbot.Resolver.

Specified by:
addComponent in interface Resolver

getComponentReferences

public Collection getComponentReferences()
From abbot.Resolver.

Specified by:
getComponentReferences in interface Resolver

getContext

public String getContext(Step step)
From abbot.Resolver.

Specified by:
getContext in interface Resolver

getDirectory

public File getDirectory()
From abbot.Resolver.

Specified by:
getDirectory in interface Resolver

setProperty

public void setProperty(String name,
                        Object value)
From abbot.Resolver.

Specified by:
setProperty in interface Resolver

getProperty

public Object getProperty(String name)
From abbot.Resolver.

Specified by:
getProperty in interface Resolver

getContextClassLoader

public ClassLoader getContextClassLoader()
From abbot.Resolver.

Specified by:
getContextClassLoader in interface Resolver

getHierarchy

public Hierarchy getHierarchy()
Description copied from interface: Resolver
Get Hierarchy used by this Resolver.

Specified by:
getHierarchy in interface Resolver

toString

public String toString()
Overrides:
toString in class Object

dispose

void dispose()

main

public static void main(String[] args)
Launch the script editor, with an argument of either a test suite class or a script filename.


showEditor

public static void showEditor(EditorContext ec)
Launch the script editor, with an argument that represents a variety of editor customizations.



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

SourceForge