CONTROL - type of the encapsulated object.@ControlType(value=java.lang.Object.class) @ControlInterfaces(value={Mouse.class,Keyboard.class,Drag.class}) public abstract class Wrap<CONTROL> extends Object
as(java.lang.Class),
is(java.lang.Class)| Modifier and Type | Field and Description |
|---|---|
static String |
BOUNDS_PROP_NAME |
static String |
CLICKPOINT_PROP_NAME |
static String |
CONTROL_CLASS_PROP_NAME |
static String |
CONTROL_PROP_NAME |
static String |
IMAGE_CAPTURER_PROPERTY |
static String |
IMAGE_LOADER_PROPERTY |
static String |
INPUT_FACTORY_PROPERTY |
static String |
NAME_PROP_NAME |
static String |
OUTPUT |
static String |
POSITION_PROP_NAME |
static String |
TEXT_PROP_NAME |
static String |
TOOLTIP_PROP_NAME |
static String |
VALUE_PROP_NAME |
static Timeout |
WAIT_STATE_TIMEOUT |
static String |
WRAPPER_CLASS_PROP_NAME |
| Modifier | Constructor and Description |
|---|---|
protected |
Wrap(Environment env)
Fur null source.
|
protected |
Wrap(Environment env,
CONTROL node) |
| Modifier and Type | Method and Description |
|---|---|
<INTERFACE extends ControlInterface> |
as(Class<INTERFACE> interfaceClass)
Returns an implementation of interface associated with this object.
|
<TYPE,INTERFACE extends TypeControlInterface<TYPE>> |
as(Class<INTERFACE> interfaceClass,
Class<TYPE> type)
Returns an implementation of interface associated with the object.
|
Drag |
drag()
A shortcut to
as(MouseTarget.class).drag() |
Point |
getClickPoint()
Return default point to click, drag.
|
CONTROL |
getControl() |
Class<?> |
getControlClass() |
Environment |
getEnvironment() |
Object |
getFieldProperty(String name) |
Object |
getMethodProperty(String name) |
HashMap<String,Object> |
getProperties()
Returns a a map of all known controls properties including values from
methods marked by
@Property and values of methods/field from
@MethodProperties/
FieldProperties correspondingly. |
HashMap<String,Object> |
getPropertiesQiuet()
Returns a a map of all controls properties which is possible to obtain.
|
<P> P |
getProperty(Class<P> valueClass,
String name) |
Object |
getProperty(String name)
Get property of the wrapped object.
|
<INTERFACE extends ControlInterface> |
getProperty(String name,
Class<INTERFACE> intrfc)
Get property out of the control interface.
|
<TYPE,INTERFACE extends TypeControlInterface<TYPE>> |
getProperty(String name,
Class<INTERFACE> intrfc,
Class<TYPE> type)
Get property out of the control interface.
|
abstract Rectangle |
getScreenBounds()
Returns control bounds in screen coordinates.
|
Image |
getScreenImage()
Captures the screen area held by the component.
|
Image |
getScreenImage(Rectangle rect)
Captures portion of the screen area held by the component.
|
static DefaultWrapper |
getWrapper() |
boolean |
hasFieldProperty(String name) |
boolean |
hasMethodProperty(String name) |
<INTERFACE extends ControlInterface> |
is(Class<INTERFACE> interfaceClass)
Checks if the control could be treated as a ControlInterface.
|
<TYPE,INTERFACE extends TypeControlInterface<TYPE>> |
is(Class<INTERFACE> interfaceClass,
Class<TYPE> type)
Checks if the control could be treated as a parametrized
ControlInterface.
|
Keyboard |
keyboard()
A shortcut to
as(KeyTarget.class).wrap() |
Mouse |
mouse()
A shortcut to
as(MouseTarget.class).mouse() |
void |
setEnvironment(Environment env) |
Point |
toAbsolute(Point local)
Transforms point in local control coordinate system to screen
coordinates.
|
Point |
toLocal(Point local)
Transforms point in screen coordinates to local control coordinate
system.
|
void |
waitImage(Image golden,
Rectangle rect,
String resID,
String diffID)
Waits for a portion of image to be exact the same as the parameter.
|
void |
waitImage(Image golden,
String resID,
String diffID)
Waits for image to be exact the same as the parameter.
|
<TYPE,INTERFACE extends TypeControlInterface<TYPE>> |
waitProperty(String property,
Class<INTERFACE> intrfc,
Class<TYPE> type,
Object value)
Wait for the property
property of control interface to get the specified value. |
<INTERFACE extends ControlInterface> |
waitProperty(String property,
Class<INTERFACE> intrfc,
Object value)
Wait for the property
property of control interface to get the specified value. |
void |
waitProperty(String property,
Object value)
Wait for the property
property to get the specified value. |
<V> V |
waitState(State<V> state) |
<V> V |
waitState(State<V> state,
V value)
TODO javadoc
|
public static final String BOUNDS_PROP_NAME
public static final String CLICKPOINT_PROP_NAME
public static final String CONTROL_CLASS_PROP_NAME
public static final String CONTROL_PROP_NAME
public static final String INPUT_FACTORY_PROPERTY
public static final String IMAGE_LOADER_PROPERTY
public static final String IMAGE_CAPTURER_PROPERTY
public static final String TEXT_PROP_NAME
public static final String POSITION_PROP_NAME
public static final String VALUE_PROP_NAME
public static final String WRAPPER_CLASS_PROP_NAME
public static final String TOOLTIP_PROP_NAME
public static final String NAME_PROP_NAME
public static final Timeout WAIT_STATE_TIMEOUT
public static final String OUTPUT
protected Wrap(Environment env)
env - The environmentEnvironmentprotected Wrap(Environment env, CONTROL node)
env - The environmentnode - The encapsulated objectEnvironmentpublic static DefaultWrapper getWrapper()
public Environment getEnvironment()
Environmentpublic void setEnvironment(Environment env)
@Property(value="clickPoint") public Point getClickPoint()
@Property(value="bounds") public abstract Rectangle getScreenBounds()
JemmyException - if the control is not visiblepublic Point toAbsolute(Point local)
local - the local coordinatetoLocal(org.jemmy.Point)public Point toLocal(Point local)
local - the local coordinatetoAbsolute(org.jemmy.Point)public Image getScreenImage()
public Image getScreenImage(Rectangle rect)
rect - Part of the control to capturepublic void waitImage(Image golden, Rectangle rect, String resID, String diffID)
golden - the image to match againstrect - A portion of control to compare.resID - ID of a result image to save in case of failure. No image
saved if null.diffID - ID of a diff image to save in case of failure. No image
saved if null.as(java.lang.Class)public void waitImage(Image golden, String resID, String diffID)
golden - the image to match againstresID - ID of a result image to save in case of failure. No image
saved if null.diffID - ID of a diff image to save in case of failure. No image
saved if null.as(java.lang.Class)public <V> V waitState(State<V> state, V value)
V - the states typestate - the statevalue - the state valueTimeoutExpiredException - in case the wait is unsuccessful.public <V> V waitState(State<V> state)
V - the states typestate - the stateTimeoutExpiredException - in case the wait is unsuccessful.public <INTERFACE extends ControlInterface> boolean is(Class<INTERFACE> interfaceClass)
Wrap#as(java.lang.Class) will be called. This implementation
checks whether the class implements the necessary interface. It also
works for root interfaces such as
MouseTarget and
KeyTarget, which implementations are encapsulated. If some
other functionality is desired, must be overriden together with
as(java.lang.Class)INTERFACE - the control interfaceinterfaceClass - the interface classtrue if the control is an ControlInterface,
false otherwiseis(java.lang.Class)public <TYPE,INTERFACE extends TypeControlInterface<TYPE>> boolean is(Class<INTERFACE> interfaceClass, Class<TYPE> type)
Wrap#as(java.lang.Class, java.lang.Class) will be called.
This implementation checks whether the class implements the necessary
interface. It also works for root interfaces such as
MouseTarget and
KeyTarget, which implementations are encapsulated. If some
other functionality is desired, must be overriden together with
as(java.lang.Class)TYPE - the type interfaceINTERFACE - the control interfaceinterfaceClass - the interface classtype - The parameter class.true if the control is an ControlInterface,
false otherwiseis(java.lang.Class)public <INTERFACE extends ControlInterface> INTERFACE as(Class<INTERFACE> interfaceClass)
INTERFACE - the control interfaceinterfaceClass - the interface classis(java.lang.Class)public <TYPE,INTERFACE extends TypeControlInterface<TYPE>> INTERFACE as(Class<INTERFACE> interfaceClass, Class<TYPE> type)
TYPE - the type interfaceINTERFACE - the control interfaceinterfaceClass - the interface classtype - The parameter class.is(java.lang.Class)@As(value=Mouse.class) public Mouse mouse()
as(MouseTarget.class).mouse()@As(value=Drag.class) public Drag drag()
as(MouseTarget.class).drag()@As(value=Keyboard.class) public Keyboard keyboard()
as(KeyTarget.class).wrap()public Object getProperty(String name)
org.jemmy.control.Propertyorg.jemmy.control.MethodPropertiesorg.jemmy.control.FieldPropertiesname - property nameJemmyException - if no property foundProperty,
MethodProperties,
FieldPropertiespublic <INTERFACE extends ControlInterface> Object getProperty(String name, Class<INTERFACE> intrfc)
INTERFACE - the control interfacename - the property nameintrfc - the interface classpublic <TYPE,INTERFACE extends TypeControlInterface<TYPE>> Object getProperty(String name, Class<INTERFACE> intrfc, Class<TYPE> type)
TYPE - the type interfaceINTERFACE - the control interfacename - the property nameintrfc - the interface classtype - The parameter class.public void waitProperty(String property, Object value)
property to get the specified value.
WAIT_STATE_TIMOUT timeout is usedproperty - name of the property being waited forvalue - property value to waitpublic <INTERFACE extends ControlInterface> void waitProperty(String property, Class<INTERFACE> intrfc, Object value)
property of control interface to get the specified value.
WAIT_STATE_TIMOUT timeout is usedINTERFACE - the control interfaceproperty - the property nameintrfc - the interface classvalue - the new parameter valuepublic <TYPE,INTERFACE extends TypeControlInterface<TYPE>> void waitProperty(String property, Class<INTERFACE> intrfc, Class<TYPE> type, Object value)
property of control interface to get the specified value.
WAIT_STATE_TIMOUT timeout is usedTYPE - the type interfaceINTERFACE - the control interfaceproperty - the property nameintrfc - the interface classtype - the parameter class.value - the new parameter valuepublic boolean hasFieldProperty(String name)
public boolean hasMethodProperty(String name)
public HashMap<String,Object> getProperties()
@Property and values of methods/field from
@MethodProperties/
FieldProperties correspondingly.RuntimeException - should there be an exception thrown while
getting a propertypublic HashMap<String,Object> getPropertiesQiuet()
getProperties() only exception is swallowed should there be
an exception thrown while getting a property.Copyright © 2018. All rights reserved.