T-Plan Robot Enterprise 3.5.2
Build No. 3.5.2-20140701.1

com.tplan.robot.scripting.commands.impl
Class TypeLineCommand

java.lang.Object
  extended by com.tplan.robot.scripting.commands.AbstractCommandHandler
      extended by com.tplan.robot.scripting.commands.impl.PressCommand
          extended by com.tplan.robot.scripting.commands.impl.TypeCommand
              extended by com.tplan.robot.scripting.commands.impl.TypeLineCommand
All Implemented Interfaces:
GUIConstants, Plugin, Configurable, ConfigurationChangeListener, AdvancedCommandHandler, CommandHandler, EditorFriendlyCommandHandler, EventListener

public class TypeLineCommand
extends TypeCommand

Handler implementing functionality of the TypeLine command.


T-Plan Robot Enterprise, (C) 2009-2014 T-Plan Limited. All rights reserved.


Field Summary
 
Fields inherited from class com.tplan.robot.scripting.commands.impl.PressCommand
fakeShiftPreference, PARAM_DELAY, PARAM_LOCATION, PARAM_LOCATION_LEFT, PARAM_LOCATION_NUMPAD, PARAM_LOCATION_RIGHT, PARAM_LOCATION_STANDARD, PARAM_RELEASE
 
Fields inherited from class com.tplan.robot.scripting.commands.AbstractCommandHandler
ALT, CONTEXT_COMMAND_CALL_COMPILED_PARAMETER_MAP, CONTEXT_COMMAND_CALL_SOURCE_PARAMETER_MAP, CONTEXT_COMPILE_SINGLE_COMMAND_MODE, CONTEXT_LAST_WAIT_FACTOR, CONTEXT_WAIT_FACTOR_ERR_MSG_SHOWN, CTRL, PARAM_COUNT, PARAM_ONFAIL, PARAM_ONPASS, PARAM_WAIT, SHIFT, WINDOWS
 
Fields inherited from interface com.tplan.robot.scripting.commands.EditorFriendlyCommandHandler
CATEGORY_ADMIN, CATEGORY_DESKTOP, CATEGORY_IMAGE_OPS, CATEGORY_IO, CATEGORY_REPORTING, CATEGORY_UNKNOWN
 
Fields inherited from interface com.tplan.robot.gui.GUIConstants
DEFAULT_TPLAN_ROBOT_FILE_EXTENSION, EVENT_ADD_CUSTOM_ACTION_MSG, EVENT_ADD_STABLE_ACTION_MSG, EVENT_DISPLAY_HASHTABLE, EVENT_DISPLAY_PREFERENCES, EVENT_DOCUMENT_CHANGED, EVENT_MOUSE_MOVED, EVENT_REMOVE_CUSTOM_ACTION_MSG, EVENT_REMOVE_STABLE_ACTION_MSG, EVENT_SELECTION_CHANGED, EVENT_STATUSBAR_MSG, HELP_URL_JAPI, HELP_URL_SPEC, HELP_URLS
 
Constructor Summary
TypeLineCommand()
           
 
Method Summary
 int execute(List args, Map values, ScriptingContext context)
          Execute the command.
 String[] getCommandNames()
          Get command names.
 KeyStroke getContextShortcut()
          Get preferred hot key for the GUI command wizard.
 List getPreferences()
          Get metadata of displayable/editable configurable parameters.
 String getShortDescription(Map<String,String> parameters, TestScriptInterpret interpret)
          Get short description (up to 50 chars) of what the command does.
 List getStablePopupMenuItems()
          Get a list of stable actions.
 List<Preference> getVisualParameters(LinkedHashMap<String,Object> parameters, TestScriptInterpret interpret)
          Get the list of visual parameters for construction of a dynamic command editor window.
 void validate(List args, Map values, Map variableContainer, ScriptingContext context)
          Validate if the command complies with the command syntax.The command is already pre-parsed to a list of parameter names and a map of [name, value] pairs.
 
Methods inherited from class com.tplan.robot.scripting.commands.impl.TypeCommand
checkVisualParameters, configurationChanged, getCategory, getContextArgument, getContextAttributes, getVisualParameters, handleTypeEvent, hasCustomParameterComponent, hasCustomPropertyDialog, hasFixedArgument, validatePress
 
Methods inherited from class com.tplan.robot.scripting.commands.impl.PressCommand
getArguments, getParameters, getParameterValues, handlePressEvent, sendKeyEvent
 
Methods inherited from class com.tplan.robot.scripting.commands.AbstractCommandHandler
addCommandListener, canRunWithoutConnection, checkDependencies, checkPauseAndStop, compileParameters, createConfigureAction, executeFallBackCodeOrProcedure, fireCommandEvent, getBooleanSafely, getCode, getDate, getDescription, getDisplayName, getImplementedInterface, getIntegerSafely, getLowestSupportedVersion, getMessageAfterInstall, getMessageBeforeInstall, getSupportContact, getUniqueId, getVendorHomePage, getVendorName, getVersion, isGlobalPrerequisity, multiplyWaitTime, reloadCommand, removeCommandListener, requiresOriginalValues, requiresRestart, setConfiguration, toLinkedMap, validateOnPassAndOnFail, wait
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.tplan.robot.scripting.commands.CommandHandler
addCommandListener, canRunWithoutConnection, isGlobalPrerequisity, removeCommandListener
 

Constructor Detail

TypeLineCommand

public TypeLineCommand()
Method Detail

validate

public void validate(List args,
                     Map values,
                     Map variableContainer,
                     ScriptingContext context)
              throws SyntaxErrorException
Description copied from interface: CommandHandler
Validate if the command complies with the command syntax.The command is already pre-parsed to a list of parameter names and a map of [name, value] pairs.

Specified by:
validate in interface CommandHandler
Overrides:
validate in class TypeCommand
Parameters:
args - a list of parameters.
values - a map of [param, value] pairs resulted from parsing of the command.
variableContainer - output map for values.
context - execution context.
Throws:
SyntaxErrorException - when the command doesn't meet the required syntax.

getCommandNames

public String[] getCommandNames()
Description copied from interface: CommandHandler

Get command names. A command name is the first word in a script line, e.g. "Type" or "Press". Though most commands have just one name, you may use this method to define any number of command aliases. You may even use one class to implement more commands if you want. In such a case you need to define more command names and implement a different behavior for each command.

Please note that command name parsing is NOT case sensitive. You don't have to define the names as e.g. { "MyCommand", "mycommand" }. Script parser will always parse the command name in a script and convert it to upper case using the String.toUpperCase(). Such a command name will be then used to look for a command implementation in the command table.

Specified by:
getCommandNames in interface CommandHandler
Overrides:
getCommandNames in class TypeCommand
Returns:
array of command names.

execute

public int execute(List args,
                   Map values,
                   ScriptingContext context)
            throws SyntaxErrorException,
                   IOException
Description copied from interface: CommandHandler

Execute the command.

Argument context will contain all necessary objects that the command may possibly use, for example the com.tplan.robot.gui.FrameBufferPanel and com.tplan.robot.api.rfb.RfbModule instances etc. If the command e.g. needs to send some key events to the RFB server, you should save the reference to the RfbModuleImpl instance and use its methods to fire the required key events.

Specified by:
execute in interface CommandHandler
Overrides:
execute in class TypeCommand
Parameters:
args - a list of parameters.
values - a map of [param, value] pairs resulted from parsing of the command.
context - execution context.
Returns:
command exit code.
Throws:
SyntaxErrorException - when the command doesn't meet the required syntax.
IOException - an instance of I/O exception may be thrown if an error occurs in communication with the underlying desktop client.

getPreferences

public List getPreferences()
Description copied from interface: Configurable
Get metadata of displayable/editable configurable parameters. This method should declare a list of metadata for all configurable parameters which may be editable in the GUI. If the returned list is not null and contains at least one parameter, it gets picked up by the Preferences dialog which creates a panel with GUI components allowing to edit the declared configuration parameters.

Specified by:
getPreferences in interface Configurable
Overrides:
getPreferences in class TypeCommand
Returns:
a list of metadata for all public editable configuration parameters.

getStablePopupMenuItems

public List getStablePopupMenuItems()
Description copied from interface: CommandHandler
Get a list of stable actions. They will be used to build up a pop up menu displayed on a right mouse click onto the commend in the editor. Though it is not explicitly declared, the list must contain javax.swing.Action instances.

Specified by:
getStablePopupMenuItems in interface CommandHandler
Overrides:
getStablePopupMenuItems in class AbstractCommandHandler
Returns:
list of stable context pop up menu actions.

getContextShortcut

public KeyStroke getContextShortcut()
Description copied from interface: CommandHandler
Get preferred hot key for the GUI command wizard. When such a key is pressed in the editor, the GUI inserts the command template into the editor document. The key returned by this method is just a recommendation and the GUI may decide to assign another one to the command, for example when there is a conflict with another existing one.

Specified by:
getContextShortcut in interface CommandHandler
Overrides:
getContextShortcut in class TypeCommand
Returns:
hot key invoking insertion of a command template into the GUI editor..

getVisualParameters

public List<Preference> getVisualParameters(LinkedHashMap<String,Object> parameters,
                                            TestScriptInterpret interpret)
Description copied from interface: EditorFriendlyCommandHandler

Get the list of visual parameters for construction of a dynamic command editor window.

This method will be called only after the EditorFriendlyCommandHandler.hasCustomPropertyDialog(java.util.LinkedHashMap, com.tplan.robot.scripting.interpret.TestScriptInterpret, int, javax.swing.Action[]) and EditorFriendlyCommandHandler.hasCustomParameterComponent(java.util.LinkedHashMap, com.tplan.robot.scripting.interpret.TestScriptInterpret, com.tplan.robot.gui.preferences.PreferencePanel[]) methods return false.

Specified by:
getVisualParameters in interface EditorFriendlyCommandHandler
Overrides:
getVisualParameters in class TypeCommand
Parameters:
parameters - input parameters parsed from the already existing command or preselected through the Command Wizard menu.
interpret - test script interpret owning the edited script.
Returns:
list of visual parameters. If the list is null and the command does not provide a custom component through the EditorFriendlyCommandHandler.hasCustomPropertyDialog(java.util.LinkedHashMap, com.tplan.robot.scripting.interpret.TestScriptInterpret, int, javax.swing.Action[]) and EditorFriendlyCommandHandler.hasCustomParameterComponent(java.util.LinkedHashMap, com.tplan.robot.scripting.interpret.TestScriptInterpret, com.tplan.robot.gui.preferences.PreferencePanel[]) methods, it will be considered as not editable through the GUI.

getShortDescription

public String getShortDescription(Map<String,String> parameters,
                                  TestScriptInterpret interpret)
Description copied from interface: EditorFriendlyCommandHandler
Get short description (up to 50 chars) of what the command does. This will be used for the list (menu) of available actions in the GUI.

Specified by:
getShortDescription in interface EditorFriendlyCommandHandler
Overrides:
getShortDescription in class TypeCommand
Parameters:
parameters - map of parameters and their values. All values are in the format recognized by token parser (TokenParserImpl.getParser()) which may be used to convert them to native Java objects such as Number, Point, Rectangle etc.
interpret - test script interpret owning the edited script.
Returns:
short command description.

T-Plan Robot Enterprise 3.5.2
Build No. 3.5.2-20140701.1