public class TemplateImageBean extends Properties implements com.tplan.robot.gui.components.PropertyFileDescriptor
Template image bean is a container for data from the template image meta
data file. It gets saved by T-Plan Robot Enterprise when the template image is created
or edited. To populate the bean with data of an existing template image create
a new bean instance using its default constructor and then call
the loadImageProperties(java.io.File)
method to associate it with
a particular template image (any existing meta data will be loaded by this method).
Image bean of the last compared template is also available to test scripts
through the ScriptingContext.getSearchHitTemplateMetaData()
method..
T-Plan Robot Enterprise, (C) 2009-2022 T-Plan Limited. All rights reserved.
Modifier and Type | Field and Description |
---|---|
static String |
PARAM_CLICK_X
Click point X coordinate parameter name.
|
static String |
PARAM_CLICK_Y
Click point Y coordinate parameter name.
|
static String |
PARAM_DESCRIPTION
Description parameter name.
|
static String |
PARAM_DESKTOP_HEIGHT
Source desktop height parameter name.
|
static String |
PARAM_DESKTOP_WIDTH
Source desktop width parameter name.
|
static String |
PARAM_HEIGHT
Image height parameter name.
|
static String |
PARAM_SOURCE_X
Source X coordinate parameter name.
|
static String |
PARAM_SOURCE_Y
Source Y coordinate parameter name.
|
static String |
PARAM_WIDTH
Image width parameter name..
|
Constructor and Description |
---|
TemplateImageBean() |
Modifier and Type | Method and Description |
---|---|
boolean |
canAddCustomProperties()
Indicates whether the editor should allow inserting of custom properties.
|
Point |
getClickPoint()
Get the image click point.
|
String |
getDescription()
Get the template image description.
|
Dimension |
getDesktopSize()
Get the desktop image size.
|
File |
getFile()
Get the bean meta data file.
|
Integer |
getHeight()
Get image height.
|
File |
getImageFile()
Get the image file.
|
String |
getPropertyDescription(String propertyName)
Get description of a property.
|
String[] |
getPropertyNames()
Get acceptable or known property names.
|
Class |
getPropertyType(String propertyName)
Get the property value type.
|
Dimension |
getSize()
Get image size.
|
Point |
getSourcePoint()
Get the template image source point.
|
Rectangle |
getSourceRectangle()
Get the source rectangle (the original template image location
in the desktop image).
|
Integer |
getWidth()
Get image width.
|
boolean |
loadImageProperties(File imageFile)
Load image meta data of a template image file.
|
boolean |
save()
Save the data to the meta data file.
|
static void |
saveImage(File imgFile,
Dimension screenSize,
BufferedImage img,
Rectangle r,
Point p)
Save a template image and create its property file (template image bean).
|
void |
setClickPoint(Point p)
Set the image click point.
|
void |
setDescription(String desc)
Set the template image description.
|
void |
setDesktopSize(int width,
int height)
Set size of the desktop the image was created from.
|
void |
setSize(int width,
int height)
Set the image size.
|
void |
setSourcePoint(Point p)
Set the template image source point.
|
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keys, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, toString, values
public static final String PARAM_SOURCE_X
public static final String PARAM_SOURCE_Y
public static final String PARAM_WIDTH
public static final String PARAM_HEIGHT
public static final String PARAM_CLICK_X
public static final String PARAM_CLICK_Y
public static final String PARAM_DESCRIPTION
public static final String PARAM_DESKTOP_WIDTH
public static final String PARAM_DESKTOP_HEIGHT
public boolean loadImageProperties(File imageFile) throws IOException
imageFile
- a template image file.IOException
- if the meta data file exists but can not be read.public boolean save() throws IOException
IOException
- on an I/O error.public String getDescription()
public void setDescription(String desc)
desc
- template image description.public void setClickPoint(Point p)
p
- new click point (null unsets).public Point getClickPoint()
public void setSourcePoint(Point p)
p
- a new value of source point.public Point getSourcePoint()
public void setSize(int width, int height)
width
- image width.height
- image height.public void setDesktopSize(int width, int height)
width
- desktop image width.height
- desktop image height.public Dimension getSize()
public Dimension getDesktopSize()
public Integer getWidth()
public Integer getHeight()
public Rectangle getSourceRectangle()
public File getFile()
loadImageProperties(java.io.File)
method.public File getImageFile()
loadImageProperties(java.io.File)
method.public static void saveImage(File imgFile, Dimension screenSize, BufferedImage img, Rectangle r, Point p) throws IOException
imgFile
- the image file.screenSize
- the source screen size.img
- the template image to save.r
- the template image rectangle.p
- the target click point (in absolute screen coordinates). It will
be converted to relative coordinates internally.IOException
- when either the image or the bean fails to save to
file.public String getPropertyDescription(String propertyName)
com.tplan.robot.gui.components.PropertyFileDescriptor
getPropertyDescription
in interface com.tplan.robot.gui.components.PropertyFileDescriptor
propertyName
- the property name.public Class getPropertyType(String propertyName)
com.tplan.robot.gui.components.PropertyFileDescriptor
getPropertyType
in interface com.tplan.robot.gui.components.PropertyFileDescriptor
propertyName
- the property name.public String[] getPropertyNames()
com.tplan.robot.gui.components.PropertyFileDescriptor
getPropertyNames
in interface com.tplan.robot.gui.components.PropertyFileDescriptor
public boolean canAddCustomProperties()
com.tplan.robot.gui.components.PropertyFileDescriptor
canAddCustomProperties
in interface com.tplan.robot.gui.components.PropertyFileDescriptor
PropertyFileDescriptor.getPropertyNames()
. Return true to enable any
property names.