T-Plan Robot Enterprise 4.2.2
Build No. 4.2.2-20170710.1

com.tplan.robot.imagecomparison.tesseractocr
Class TesseractOCR

java.lang.Object
  extended by com.tplan.robot.imagecomparison.tesseractocr.TesseractOCR
All Implemented Interfaces:
com.tplan.robot.gui.components.ComparisonModuleGuiSupport, AdvancedImageComparisonModule, ExtendedSearchCapabilities, ImageComparisonModule, TextRecognitionGUISupport, Plugin, Configurable, ExtendedParamsObject, Measurable, Stoppable, ImageObserver

public class TesseractOCR
extends Object
implements ImageComparisonModule, Plugin, ImageObserver, ExtendedParamsObject, Configurable, ExtendedSearchCapabilities, com.tplan.robot.gui.components.ComparisonModuleGuiSupport, AdvancedImageComparisonModule, TextRecognitionGUISupport, Stoppable, Measurable

Tesseract OCR version 2 & 3 plugin (http://code.google.com/p/tesseract-ocr).

This plugin allows to call the Tesseract OCR engine version 2 or higher through the T-Plan Robot Enterprise Image Comparison API to extract text from the remote desktop image. This makes it possible to perform text recognition from automated testing scripts through the CompareTo, Screenshot and WaitFor match/mismatch commands or their Java API counterpart methods.

Prior to using this plugin the user has to install and configure Tesseract on the client system (meaning the system running T-Plan Robot Enterprise) as follows:

The integration is based on the Tesseract command line interface (CLI) and the local file system. When executed, the plugin extracts the desktop image or its rectangular part specified through the cmparea parameter. This image is magnified (scaled up) to improve OCR accuracy and saved in the 8-bit black & white format to a file in the system temporary path. The scale factor can be configured in the module preferences and defaults to 2. T-Plan Robot Enterprise version 2.3.1 and later allows to override the configured scale factor value even through the new 'scale' parameter.

Tesseract then gets started as a standard OS process and the image file is passed to it as a CLI argument. The engine stores OCR results to a text file in the temporary path which is then read by the plugin and processed according to the instructions (parameters).

If the OCR throws an error caused by misconfiguration or an I/O error, the plugin returns 0 (meaning 0% to indicate a negative image comparison result). This applies to situations when the Tesseract is not installed at all, when the configured command template doesn't point to the Tesseract binary or when the optional 'language' parameter specified by the calling script doesn't match to a properly installed Tesseract language data file. Text of such errors is made available through the _TOCR_ERROR variable. Testing of existence of this variable is the only way to detect core OCR errors in test scripts.

The plugin by default just performs OCR and stores the resulting text in form of individual text lines to _TOCR_LINE[line_number] variables into the context. The number of resulting text lines is available from the _TOCR_LINE_COUNT variable. T-Plan Robot Enterprise version 2.3.1 and later further on populates the _TOCR_TEXT variable with full recognized multiline text. The plugin returns the value of 1 (100%) to indicate that OCR has been performed successfully regardless of whether it produced any text or not. The following example extracts text from the specified desktop area and types it onto the desktop:

Var _TOCR_LINE_COUNT=0
Compareto method="tocr" cmparea="x:33,y:2,w:200,h:22"
for (i=1; {i}<{_TOCR_LINE_COUNT}+1; i={i}+1) {
   Typeline "{_TOCR_LINE{i}}"
}

When the 'text' or 'pattern' parameter has been specified in the calling command, the produced text is further on processed to verify whether it contains the specified string or whether it matches the specified java.util.regex.Pattern compliant regular expression. The plugin then returns either 0 (fail) or 1 (pass) to indicate the result. The calling command then returns inverted values (0 for pass, 1 for fail) which may be further on tested through if/else in the script. The following example takes advantage of a regular expression to exit the script when the OCR result doesn't start with either the 'Application' or 'application' word.

Compareto method="tocr" cmparea="x:33,y:2,w:200,h:22" pattern="[aA]pplication"
if ({_EXIT_CODE} > 0) {
  Exit 1
}

To change the example to test whether the recognized text contains 'Application' or 'application' change the regular expression to ".*[aA]pplication.*". This makes the pattern match the word even with any leading or trailing text.

Compareto method="tocr" cmparea="x:33,y:2,w:200,h:22" pattern=".*[aA]pplication.*"

Besides regular expressions, T-Plan Robot Enterprise version 2.3.1 and later supports tolerant (fuzzy) text matching based on the Levenshtein distance. It is defined as the minimum number of edits needed to transform one string into the other, with the allowable edit operations being insertion, deletion, or substitution of a single character. This metric is exposed as a new parameter called 'distance' which is an integer number specifying how many characters may be omited or not recognized properly at a maximum to consider the sample text provided in the 'text' parameter equivalent.

Unlike the regular expressions the 'distance' parameter always searches the recognized text for any occurence of a string matching the given text and distance. There's no need to specify that the string is preceded or trailed by another text.

For example, let's set up a simple command which recognizes text on the screen and verifies whether it is like and/or it contains a string like 'apple':

Compareto method="tocr" cmparea="x:33,y:2,w:200,h:22" text="apple" distance="2"

When the text is matched, the index of the match location in the text is stored to the _TOCR_MATCH_INDEX variable. The index starts from 0 which represents the text beginning. The matching substring is further on saved under the _TOCR_MATCH variable. For example, the example above with the recognized text of 'There are Appls' will create the variables as _TOCR_MATCH=Appls and _TOCR_MATCH_INDEX=10.


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


Field Summary
static String CONTEXT_TOCR_ERROR
          Key to the core Tesseract error text.
static String CONTEXT_TOCR_TEXT
          Key to the full OCR result text in the context.
static int DEFAULT_FONT_SIZE
           
static String PARAM_DISTANCE
          Levenshtein distance parameter name 'distance'.
static String PARAM_FILTER
          Filter parameter name 'filter'.
static String PARAM_FONTSIZE
          Font size parameter name 'fontsize'.
static String PARAM_LANGUAGE
          Language parameter name 'language'.
static String PARAM_MODE
          Font size parameter name 'fontsize'.
static String PARAM_PATTERN
          Pattern parameter name 'pattern'.
static String PARAM_SCALE
          Scale factor parameter name 'scale'.
static String PARAM_TEXT
          Text parameter name 'text'.
static String VAR_TOCR_ERROR
          Name of context variable for Tesseract's error output.
static String VAR_TOCR_LINE
          Base name for text lines parsed by Tesseract.
static String VAR_TOCR_LINE_COUNT
          Variable name for number of text lines parsed by Tesseract.
static String VAR_TOCR_LINE_H
           
static String VAR_TOCR_LINE_W
           
static String VAR_TOCR_LINE_X
           
static String VAR_TOCR_LINE_Y
           
static String VAR_TOCR_MATCH
          Variable name for the string which matched during fuzzy string matching.
static String VAR_TOCR_MATCH_CLICK_X
           
static String VAR_TOCR_MATCH_CLICK_Y
           
static String VAR_TOCR_MATCH_COUNT
           
static String VAR_TOCR_MATCH_H
           
static String VAR_TOCR_MATCH_INDEX
          Variable name for the string which matched during fuzzy string matching.
static String VAR_TOCR_MATCH_W
           
static String VAR_TOCR_MATCH_X
           
static String VAR_TOCR_MATCH_Y
           
static String VAR_TOCR_TEXT
          Variable name for full text.
static String VAR_TOCR_TEXT_H
           
static String VAR_TOCR_TEXT_W
           
static String VAR_TOCR_TEXT_X
           
static String VAR_TOCR_TEXT_Y
           
 
Fields inherited from interface com.tplan.robot.imagecomparison.ImageComparisonModule
CONTEXT_OBJECT_IMAGE_COMPARISON_FAILURE_DESC, SEARCH_COORD_LIST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Fields inherited from interface com.tplan.robot.gui.components.ComparisonModuleGuiSupport
PROPERTY_NAME_OBJECT_CHANGED
 
Constructor Summary
TesseractOCR()
           
 
Method Summary
 void checkDependencies(PluginManager manager)
          Check whether the current product installation contains all dependencies (other plugins) required to install this plugin.
 float compare(Image desktopImage, Rectangle area, Image image, String methodParams, ScriptingContext repository, float passRate)
          Compare the desktop image to another image and return a number indicating how much they match.
 float compareToBaseImage(Image desktopImage, Rectangle area, String methodParams, ScriptingContext context, float passRate)
          Compare the desktop image to the base image and return a number indicating how much they match.
 Map<Rectangle,int[]> getAllFailedPixels()
           
 String getCode()
          Get plugin code.
 Map<String,Object> getComparisonParams()
           
 Date getDate()
          Get plugin release date.
 float getDefaultPassRate()
          Get the default pass rate value.
 String getDescription()
          Get plugin description to be displayed in the GUI.
 String getDisplayName()
          Get short plugin name to be displayed in the GUI.
 List<Point> getFailedPixels()
           
 String getHitDescription(Rectangle r, StringBuilder label)
           
 List<Rectangle> getHits()
           
 Class getImplementedInterface()
          Get Class of the exposed functional interface that this plugin implements.
 LinkedHashMap<String,Rectangle> getLineRects()
           
 String getLongDescription()
          Get long description of the object - purpose, usage, parameter syntax etc.
 int[] getLowestSupportedVersion()
          Get the lowest required version of T-Plan Robot Enterprise.
 List<TextSearchResult> getMatches()
           
 String getMessageAfterInstall()
          Get text of a message to be displayed after installation of this plugin.
 String getMessageBeforeInstall()
          Get text of a message to be displayed before installation of this plugin.
 String getMethodDescription()
          Get the method description.
 String getMethodName()
          Get the method name.
 List<String> getParameters()
          Get the list of parameter names supported by the object implementing this interface.
 List getParameterValues(String parameterName)
          Get the list of acceptable values of a particular parameter (if known).
 String getPassRateName()
          Get alternative name for the default "pass rate".
 List<Preference> getPreferences()
          Get metadata of displayable/editable configurable parameters.
 Component getPreviewComponent(Window owner, File selectedFile, StringBuilder title)
           
 float getProgress()
          Get the task progress where 0 means "0% done" and 1 means "100% done".
 Rectangle getRectangle()
           
 String getResultMessage(boolean useHtml, StringBuilder title)
           
 String getShortDescription()
          Get short description which describes in a few words purpose and role of the object.
 String getSupportContact()
          Get support contact.
 Rectangle getText(StringBuilder out)
           
 String getUniqueId()
          Get unique ID associated with the plugin.
 String getVendorHomePage()
          Get the vendor home page.
 String getVendorName()
          Get vendor (provider) name to be displayed in the GUI.
 int[] getVersion()
          Get plugin version in form of an integer array.
 List<Preference> getVisualParameters()
          Get the list of supported parameters encapsulated in Preference instances.
 boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height)
          Dummy method implementing the ImageObserver interface.
 boolean isMethodParamsSupported()
          Define whether this module supports some custom parameters which can be passed via the methodparams parameter of the scripting language.
 boolean isSecondImageRequired()
          Determine whether we are comparing two images or just analyze the desktop image.
 boolean isStopped()
          Find out whether the task has been already stopped.
 boolean isTrackingOfFailedPixelsSupported()
           
 boolean requiresRestart()
          Indicate whether installation of this plugin requires application restart.
 void setBaseImage(Image img)
          Set the base image.
 void setConfiguration(UserConfiguration cfg)
          If an object implementing this interface is a plugin (i.e.
 void setParameters(Map<String,String> paramsAndValues)
          Set parameters and their values in the object.
 void setTrackingOfFailedPixelsEnabled(boolean enabled)
           
 void stop()
          Call this method to request the implementing object to stop the current task or activity.
 boolean usesPassRate()
          Indicate whether the module uses the pass rate as a parameter or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FONT_SIZE

public static final int DEFAULT_FONT_SIZE
See Also:
Constant Field Values

VAR_TOCR_ERROR

public static final String VAR_TOCR_ERROR
Name of context variable for Tesseract's error output.

See Also:
Constant Field Values

VAR_TOCR_LINE

public static final String VAR_TOCR_LINE
Base name for text lines parsed by Tesseract.

See Also:
Constant Field Values

VAR_TOCR_LINE_X

public static final String VAR_TOCR_LINE_X
See Also:
Constant Field Values

VAR_TOCR_LINE_Y

public static final String VAR_TOCR_LINE_Y
See Also:
Constant Field Values

VAR_TOCR_LINE_W

public static final String VAR_TOCR_LINE_W
See Also:
Constant Field Values

VAR_TOCR_LINE_H

public static final String VAR_TOCR_LINE_H
See Also:
Constant Field Values

VAR_TOCR_LINE_COUNT

public static final String VAR_TOCR_LINE_COUNT
Variable name for number of text lines parsed by Tesseract.

See Also:
Constant Field Values

VAR_TOCR_TEXT

public static final String VAR_TOCR_TEXT
Variable name for full text.

See Also:
Constant Field Values

VAR_TOCR_TEXT_X

public static final String VAR_TOCR_TEXT_X
See Also:
Constant Field Values

VAR_TOCR_TEXT_Y

public static final String VAR_TOCR_TEXT_Y
See Also:
Constant Field Values

VAR_TOCR_TEXT_W

public static final String VAR_TOCR_TEXT_W
See Also:
Constant Field Values

VAR_TOCR_TEXT_H

public static final String VAR_TOCR_TEXT_H
See Also:
Constant Field Values

VAR_TOCR_MATCH

public static final String VAR_TOCR_MATCH
Variable name for the string which matched during fuzzy string matching.

See Also:
Constant Field Values

VAR_TOCR_MATCH_X

public static final String VAR_TOCR_MATCH_X
See Also:
Constant Field Values

VAR_TOCR_MATCH_Y

public static final String VAR_TOCR_MATCH_Y
See Also:
Constant Field Values

VAR_TOCR_MATCH_W

public static final String VAR_TOCR_MATCH_W
See Also:
Constant Field Values

VAR_TOCR_MATCH_H

public static final String VAR_TOCR_MATCH_H
See Also:
Constant Field Values

VAR_TOCR_MATCH_COUNT

public static final String VAR_TOCR_MATCH_COUNT
See Also:
Constant Field Values

VAR_TOCR_MATCH_CLICK_X

public static final String VAR_TOCR_MATCH_CLICK_X
See Also:
Constant Field Values

VAR_TOCR_MATCH_CLICK_Y

public static final String VAR_TOCR_MATCH_CLICK_Y
See Also:
Constant Field Values

VAR_TOCR_MATCH_INDEX

public static final String VAR_TOCR_MATCH_INDEX
Variable name for the string which matched during fuzzy string matching.

See Also:
Constant Field Values

PARAM_LANGUAGE

public static final String PARAM_LANGUAGE
Language parameter name 'language'.

See Also:
Constant Field Values

PARAM_TEXT

public static final String PARAM_TEXT
Text parameter name 'text'.

See Also:
Constant Field Values

PARAM_SCALE

public static final String PARAM_SCALE
Scale factor parameter name 'scale'.

See Also:
Constant Field Values

PARAM_DISTANCE

public static final String PARAM_DISTANCE
Levenshtein distance parameter name 'distance'.

See Also:
Constant Field Values

PARAM_PATTERN

public static final String PARAM_PATTERN
Pattern parameter name 'pattern'.

See Also:
Constant Field Values

PARAM_FILTER

public static final String PARAM_FILTER
Filter parameter name 'filter'.

See Also:
Constant Field Values

PARAM_FONTSIZE

public static final String PARAM_FONTSIZE
Font size parameter name 'fontsize'.

See Also:
Constant Field Values

PARAM_MODE

public static final String PARAM_MODE
Font size parameter name 'fontsize'.

See Also:
Constant Field Values

CONTEXT_TOCR_TEXT

public static final String CONTEXT_TOCR_TEXT
Key to the full OCR result text in the context.

See Also:
Constant Field Values

CONTEXT_TOCR_ERROR

public static final String CONTEXT_TOCR_ERROR
Key to the core Tesseract error text.

See Also:
Constant Field Values
Constructor Detail

TesseractOCR

public TesseractOCR()
Method Detail

getMethodName

public String getMethodName()
Description copied from interface: ImageComparisonModule
Get the method name. It will be used as an identificator of the image comparison module in commands of the scripting language (parameter module of the 'CompareTo' and 'Waitfor update' commands) and in default comparison method configuration (user config parameter CompareToCommand.defaultComparisonModule).

Method names are not case sensitive. Be sure not to specify a name which is reserved by the tool or already used by another method. Version 1.3 reserves two names, 'default' and search. You can't override these names.

Specified by:
getMethodName in interface ImageComparisonModule
Returns:
name of the module (image comparison method).

getMethodDescription

public String getMethodDescription()
Description copied from interface: ImageComparisonModule
Get the method description. Though this method is not used in versions 1.2 and lower, future versions may provide a GUI method of adding custom comparison method which will take advantage of the method description.

Specified by:
getMethodDescription in interface ImageComparisonModule
Returns:
Description of the image comparison method (algorithm).

setBaseImage

public void setBaseImage(Image img)
Description copied from interface: ImageComparisonModule
Set the base image.

This is just a convenience method used by the 'Waitfor match' command to perform repeated image comparisons against one image.

The default image comparison algorithm is based on color histograms. When you call this method, a histogram is calculated for the base image and cached for future repeated comparisons performed through the compareToBaseImage() method calls. As calculation of a color histograms is quite a time expensive operation, this approach allows to achieve higher performance.

See the compareToBaseImage() method doc for more info.

Specified by:
setBaseImage in interface ImageComparisonModule

compare

public float compare(Image desktopImage,
                     Rectangle area,
                     Image image,
                     String methodParams,
                     ScriptingContext repository,
                     float passRate)
Description copied from interface: ImageComparisonModule
Compare the desktop image to another image and return a number indicating how much they match.

Specified by:
compare in interface ImageComparisonModule
Parameters:
desktopImage - desktop image.
area - a rectangle area of the remote desktop to be used for image comparison. If the argument is null, the whole remote desktop image will be used.
image - another image to be compared to the desktop image.
methodParams - method parameters passed by the 'methodparams' parameter of the 'CompareTo' and 'Waitfor update' commands. You can use this to pass custom parameters from the script to this module.
repository - a Map with execution context. Note that most of the objects contain there are not public and the parameter is specified here to allow compatibility among the custom and internal comparsion methods.
passRate - pass rate in form of a float value between 0 and 1. This user input value indicates the lowest result which will be considered as match ("passed"). It is in fact the number specified by the 'passrate' parameter of the commands Screenshot, Compareto and Waitfor match/mismatch.
Returns:
a number between 0 and 1. While a value of 0 indicates 0% match (images do not match at all), 1 indicates a 100% match (images are equal).

compareToBaseImage

public float compareToBaseImage(Image desktopImage,
                                Rectangle area,
                                String methodParams,
                                ScriptingContext context,
                                float passRate)
Description copied from interface: ImageComparisonModule
Compare the desktop image to the base image and return a number indicating how much they match.

This is just a convenience method used by the 'Waitfor match' command to perform repeated image comparisons against one image.

The default image comparison algorithm is based on color histograms. A call of this method performs image comparison against precalculated base image histogram rather that against the base image pixels. As calculation of a color histograms is quite a time expensive operation, this approach allows to achieve higher performance.

Any custom implementation of this interface may or may not take advantage of this approach. If you don't want to diferentiate between repeated and one time comparison calls, define the setBaseImage() and compareToBaseImage() methods as follows:

     // Base image
     private Image baseImage;

     // Set the base image
     public void setBaseImage(Image img) {
         baseImage = img;
     }

     // Compare an image with the base image
     public float compareToBaseImage(Image desktopImage) {
         return compare(desktopImage, baseImage);
     }
 

Specified by:
compareToBaseImage in interface ImageComparisonModule
Parameters:
desktopImage - an image to be compared to the base image.
area - a rectangle area of the remote desktop to be used for image comparison. If the argument is null, the whole remote desktop image will be used.
methodParams - method parameters passed by the 'methodparams' parameter of the 'CompareTo' or 'Waitfor update' command.
context - a Map with execution context. Note that most of the objects contain there are not public and the parameter is specified here to allow compatibility among the custom and internal comparsion methods.
passRate - pass rate in form of a float value between 0 and 1. This user input value indicates the lowest result which will be considered as match ("passed"). It is in fact the number specified by the 'passrate' parameter of the commands Screenshot, Compareto and Waitfor match/mismatch.
Returns:
a number between 0 and 1. While a value of 0 indicates 0% match (images do not match at all), 1 indicates a 100% match (images are equal).

isSecondImageRequired

public boolean isSecondImageRequired()
Description copied from interface: ImageComparisonModule
Determine whether we are comparing two images or just analyze the desktop image.

If this method returns true, commands CompareTo and WaitFor update of the scripting language will require presence of the 'template' parameter which specifies an image located in the filesystem to be compared to the current desktop.

If you wish just to analyze the desktop image instead of comparing it to another one, implement this method to return false. The tool will not validate whether an image from the file system is passed correctly. Note that commands will supply null instead of an image in all arguments corresponding to the template image, i.e. expect method calls like compare(desktopImage, null) and setBaseImage(null).

Specified by:
isSecondImageRequired in interface ImageComparisonModule
Returns:
true for comparison mode, false for image analysis.

isMethodParamsSupported

public boolean isMethodParamsSupported()
Description copied from interface: ImageComparisonModule
Define whether this module supports some custom parameters which can be passed via the methodparams parameter of the scripting language.

When this method returns false, the tool will report a syntax error when this module gets used in a command together with the methodparams parameter.

When this method returns true, commands using this module may take advantage of the methodparams parameter to pass custom parameters which are not defined by the scripting language.

The default image comparison algorithm doesn't provide any custom parameters.

Specified by:
isMethodParamsSupported in interface ImageComparisonModule
Returns:
true if the module supports customized parameters, false if not.

getCode

public String getCode()
Description copied from interface: Plugin

Get plugin code. This string serves as an identifier of the functionality delivered by the plugin. For example, desktop client plugins return protocol name like "RFB" or "RDP" as their code.

Plugin code is used by pluggable instance factories to identify a particular plugin. It may be used to replace internal plugins with third party code. For example if you develop a class which implements this and the com.tplan.robot.remoteclient.RemoteDesktop interfaces and the getCode() method returns "RFB", it will replace the internal implementation of the RFB (VNC) client.

Specified by:
getCode in interface Plugin
Returns:
plugin code (identifier). The name must not be null.

getDisplayName

public String getDisplayName()
Description copied from interface: Plugin
Get short plugin name to be displayed in the GUI.

Specified by:
getDisplayName in interface Plugin
Returns:
short plugin name.

getDescription

public String getDescription()
Description copied from interface: Plugin
Get plugin description to be displayed in the GUI.

Specified by:
getDescription in interface Plugin
Returns:
plugin description. May be null.

getVendorName

public String getVendorName()
Description copied from interface: Plugin
Get vendor (provider) name to be displayed in the GUI.

Specified by:
getVendorName in interface Plugin
Returns:
vendor name. May be null.

getSupportContact

public String getSupportContact()
Description copied from interface: Plugin
Get support contact. If the contact is a valid mail link like "mailto:<mailaddress>" or an HTTP link like "http://<link>", the application may follow it with appropriate program (mail client or web browser).

Specified by:
getSupportContact in interface Plugin
Returns:
support contact. May be null or a text to be displayed by the GUI or a valid URI.

getVersion

public int[] getVersion()
Description copied from interface: Plugin
Get plugin version in form of an integer array. Major version numbers are first. For example, version 1.2.3 should be represented as new int[] { 1, 2, 3 }.

Specified by:
getVersion in interface Plugin
Returns:
version number.

getImplementedInterface

public Class getImplementedInterface()
Description copied from interface: Plugin
Get Class of the exposed functional interface that this plugin implements. For example remote desktop clients return com.tplan.robot.remoteclient.RemoteDesktopClient.class.

Specified by:
getImplementedInterface in interface Plugin
Returns:
class instance of the implemented functional interface.

requiresRestart

public boolean requiresRestart()
Description copied from interface: Plugin
Indicate whether installation of this plugin requires application restart. If it returns true, users are asked to restart after plugin installation via GUI.

Specified by:
requiresRestart in interface Plugin
Returns:
true if installation of the plugin requires application restart, false otherwise.

getVendorHomePage

public String getVendorHomePage()
Description copied from interface: Plugin
Get the vendor home page. If the contact is a valid HTTP link like "http://<link>", the application may follow it with appropriate program (typically web browser).

Specified by:
getVendorHomePage in interface Plugin
Returns:
vendor home page URL.

getDate

public Date getDate()
Description copied from interface: Plugin
Get plugin release date.

Specified by:
getDate in interface Plugin
Returns:
plugin release date.

getUniqueId

public String getUniqueId()
Description copied from interface: Plugin

Get unique ID associated with the plugin. The plugin manager uses the ID together with the version string to identify whether a plugin is already installed and whether a newer version of the same plugin is available.

The unique ID in fact identifies a particular plugin delivered by a particular vendor. Plugin developers are recommended to choose an ID and keep it constant for all versions of one particular plugin. The ID is never displayed in the GUI so it doesn't have to be a readable text. To avoid conflicts with other vendors it is recommended to elaborate vendor or author name and feature description into the ID, for example "custom RFB client implemented by John Doe".

Specified by:
getUniqueId in interface Plugin
Returns:
unique plugin ID.

getLowestSupportedVersion

public int[] getLowestSupportedVersion()
Description copied from interface: Plugin
Get the lowest required version of T-Plan Robot Enterprise. If user attempts to install the plugin on a lower version, an error is reported.

Specified by:
getLowestSupportedVersion in interface Plugin
Returns:
the lowest T-Plan Robot Enterprise version supported by this plugin.

getMessageBeforeInstall

public String getMessageBeforeInstall()
Description copied from interface: Plugin
Get text of a message to be displayed before installation of this plugin. It may contain any relevant user information.

Specified by:
getMessageBeforeInstall in interface Plugin
Returns:
message to be displayed before installation.

getMessageAfterInstall

public String getMessageAfterInstall()
Description copied from interface: Plugin
Get text of a message to be displayed after installation of this plugin. It may contain any relevant user information.

Specified by:
getMessageAfterInstall in interface Plugin
Returns:
message to be displayed after installation.

checkDependencies

public void checkDependencies(PluginManager manager)
                       throws DependencyMissingException
Description copied from interface: Plugin
Check whether the current product installation contains all dependencies (other plugins) required to install this plugin. This method is called before the plugin is installed and it should throw a DependencyMissingException if one or more dependencies are missing.

Specified by:
checkDependencies in interface Plugin
Parameters:
manager - shared instance of the plugin manager.
Throws:
DependencyMissingException - when one or more dependencies requested by this plugin is missing.

imageUpdate

public boolean imageUpdate(Image img,
                           int infoflags,
                           int x,
                           int y,
                           int width,
                           int height)
Dummy method implementing the ImageObserver interface.

Specified by:
imageUpdate in interface ImageObserver
Returns:
always returns true.

getParameters

public List<String> getParameters()
Description copied from interface: ExtendedParamsObject
Get the list of parameter names supported by the object implementing this interface.

Specified by:
getParameters in interface ExtendedParamsObject
Returns:
list of supported parameter names.

getParameterValues

public List getParameterValues(String parameterName)
Description copied from interface: ExtendedParamsObject
Get the list of acceptable values of a particular parameter (if known). The method should return null for parameters which are not enumerated "one of" type.

Specified by:
getParameterValues in interface ExtendedParamsObject
Parameters:
parameterName - parameter name
Returns:
list of acceptable parameter values or null if the parameter value is not limited to a particular value set.

setParameters

public void setParameters(Map<String,String> paramsAndValues)
Description copied from interface: ExtendedParamsObject
Set parameters and their values in the object. It will be called by the command and the map will contain parameters parsed on the command line. Parsing of the parameter values should be performed in a way which is not case sensitive (for example through encapsulating the map through the CaseTolerantHashMap class);

Specified by:
setParameters in interface ExtendedParamsObject
Parameters:
paramsAndValues - map of parameters and their values.

getVisualParameters

public List<Preference> getVisualParameters()
Description copied from interface: ExtendedParamsObject
Get the list of supported parameters encapsulated in Preference instances. It allows to specify a larger set of parameter properties such as parameter name ("configuration key" in the Preferences object), label (short description), description, expected value type and optional value limits and relationships with other parameters. This allows the GUI to build and display the parameters in form of GUI components in command property dialogs and validate the values entered by users..

Specified by:
getVisualParameters in interface ExtendedParamsObject
Returns:
list of supported parameters in form of Preference instances.

setConfiguration

public void setConfiguration(UserConfiguration cfg)
Description copied from interface: Configurable

If an object implementing this interface is a plugin (i.e. implements also the Plugin interface) and is instantiated through a supported plugin factory, the Plugin Manager calls this method right after an instance of this object is created.

Custom objects which do not already have their configuration parameters in the default configuration file should take advantage of this method to store their configuration into the shared User Configuration instance. It is recommended to call the UserConfiguration.saveConfiguration() method in the end to save the configuration to the hard drive.

Objects wishing to be notified of changes of configuration parameters should implement the ConfigurationChangeListener interface and register with the UserConfiguration instance through the addConfigurationChangeListener() method.

Specified by:
setConfiguration in interface Configurable
Parameters:
cfg - global shared instance of user configuration preloaded with parameters from the default and user configuration files.

getPreferences

public List<Preference> 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
Returns:
a list of metadata for all public editable configuration parameters.

getShortDescription

public String getShortDescription()
Description copied from interface: ExtendedParamsObject
Get short description which describes in a few words purpose and role of the object. The text should be single line in plain text. This is optional and the method may return null. The short description is typically displayed by the GUI by the object name or ID.

Specified by:
getShortDescription in interface ExtendedParamsObject
Returns:
short object description.

getLongDescription

public String getLongDescription()
Description copied from interface: ExtendedParamsObject
Get long description of the object - purpose, usage, parameter syntax etc. The text may be multiline plain text or HTML with extended link syntax described in CustomHyperlinkListener. This is optional and the method may return null. The long description is typically displayed by the GUI when user selects to view details of the object.

Specified by:
getLongDescription in interface ExtendedParamsObject
Returns:
long object description.

getFailedPixels

public List<Point> getFailedPixels()

setTrackingOfFailedPixelsEnabled

public void setTrackingOfFailedPixelsEnabled(boolean enabled)
Specified by:
setTrackingOfFailedPixelsEnabled in interface ExtendedSearchCapabilities

isTrackingOfFailedPixelsSupported

public boolean isTrackingOfFailedPixelsSupported()
Specified by:
isTrackingOfFailedPixelsSupported in interface ExtendedSearchCapabilities

getRectangle

public Rectangle getRectangle()
Specified by:
getRectangle in interface ExtendedSearchCapabilities

getHits

public List<Rectangle> getHits()
Specified by:
getHits in interface ExtendedSearchCapabilities

getPreviewComponent

public Component getPreviewComponent(Window owner,
                                     File selectedFile,
                                     StringBuilder title)
Specified by:
getPreviewComponent in interface com.tplan.robot.gui.components.ComparisonModuleGuiSupport

getResultMessage

public String getResultMessage(boolean useHtml,
                               StringBuilder title)
Specified by:
getResultMessage in interface com.tplan.robot.gui.components.ComparisonModuleGuiSupport

getHitDescription

public String getHitDescription(Rectangle r,
                                StringBuilder label)
Specified by:
getHitDescription in interface com.tplan.robot.gui.components.ComparisonModuleGuiSupport

getAllFailedPixels

public Map<Rectangle,int[]> getAllFailedPixels()
Specified by:
getAllFailedPixels in interface ExtendedSearchCapabilities

usesPassRate

public boolean usesPassRate()
Description copied from interface: AdvancedImageComparisonModule
Indicate whether the module uses the pass rate as a parameter or not. This information is typically used by the GUI which disables or removes the password field.

Specified by:
usesPassRate in interface AdvancedImageComparisonModule
Returns:
true if the module allows to specify a pass rate, false if not.

getPassRateName

public String getPassRateName()
Description copied from interface: AdvancedImageComparisonModule
Get alternative name for the default "pass rate". This allows to update the GUI component label to be more descriptive, for example when the module calls the pass rate parameter in a different way such as "similarity", "comparison factor" or other.

Specified by:
getPassRateName in interface AdvancedImageComparisonModule
Returns:
alternative pass rate name; null defaults to "pass rate".

getDefaultPassRate

public float getDefaultPassRate()
Description copied from interface: AdvancedImageComparisonModule
Get the default pass rate value. It must be a float value between 0 and 1. This method gets called only if AdvancedImageComparisonModule.usesPassRate() returns true.

Specified by:
getDefaultPassRate in interface AdvancedImageComparisonModule
Returns:
default pass rate value;

getLineRects

public LinkedHashMap<String,Rectangle> getLineRects()
Specified by:
getLineRects in interface TextRecognitionGUISupport

getText

public Rectangle getText(StringBuilder out)
Specified by:
getText in interface TextRecognitionGUISupport

getComparisonParams

public Map<String,Object> getComparisonParams()
Specified by:
getComparisonParams in interface TextRecognitionGUISupport

getMatches

public List<TextSearchResult> getMatches()
Specified by:
getMatches in interface TextRecognitionGUISupport

stop

public void stop()
Description copied from interface: Stoppable
Call this method to request the implementing object to stop the current task or activity.

Specified by:
stop in interface Stoppable

isStopped

public boolean isStopped()
Description copied from interface: Stoppable
Find out whether the task has been already stopped.

Specified by:
isStopped in interface Stoppable
Returns:
true if the task has been stopped, false otherwise. If the task hasn't been started yet, the method should return false.

getProgress

public float getProgress()
Description copied from interface: Measurable
Get the task progress where 0 means "0% done" and 1 means "100% done".

Specified by:
getProgress in interface Measurable
Returns:
a relative number between 0 and 1 indicating how much has been completed.

T-Plan Robot Enterprise 4.2.2
Build No. 4.2.2-20170710.1