Outputable
, Timeoutable
ComponentOperator
public abstract class Operator extends java.lang.Object implements Timeoutable, Outputable
Modifier and Type | Class | Description |
---|---|---|
static interface |
Operator.ComponentVisualizer |
Interface used to make component visible & ready to to make operations with.
|
static class |
Operator.DefaultPathParser |
Used for parsing of path-like strings where path components are
separated by a string-separator: "drive|directory|subdirectory|file".
|
static class |
Operator.DefaultStringComparator |
Default StringComparator implementation.
|
static class |
Operator.Finder |
Allows to bind a compponent by a component type.
|
protected class |
Operator.MapAction |
Can be used to simplify nonprimitive type component's methods mapping.
|
protected class |
Operator.MapBooleanAction |
Can be used to simplify boolean component's methods mapping.
|
protected class |
Operator.MapByteAction |
Can be used to simplify byte component's methods mapping.
|
protected class |
Operator.MapCharacterAction |
Can be used to simplify char component's methods mapping.
|
protected class |
Operator.MapDoubleAction |
Can be used to simplify double component's methods mapping.
|
protected class |
Operator.MapFloatAction |
Can be used to simplify float component's methods mapping.
|
protected class |
Operator.MapIntegerAction |
Can be used to simplify int component's methods mapping.
|
protected class |
Operator.MapLongAction |
Can be used to simplify long component's methods mapping.
|
protected class |
Operator.MapVoidAction |
Can be used to simplify void component's methods mapping.
|
protected class |
Operator.NoBlockingAction |
Can be used to make nonblocking operation implementation.
|
static interface |
Operator.PathParser |
Used for parsing of path-like strings.
|
static interface |
Operator.StringComparator |
Interface to compare string resources like labels, button text, ...
|
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
CLASS_DPROP |
Identifier for a "class" property.
|
static java.lang.String |
TO_STRING_DPROP |
Identifier for a "toString" property.
|
Constructor | Description |
---|---|
Operator() |
Inits environment.
|
Modifier and Type | Method | Description |
---|---|---|
static void |
addOperatorPackage(java.lang.String pkgName) |
Adds package to the list of packages containing operators.
|
protected java.lang.String[] |
addToDump(java.util.Hashtable table,
java.lang.String title,
java.lang.Object[] items) |
Adds array of objects to dump hashtable.
|
protected java.lang.String[] |
addToDump(java.util.Hashtable table,
java.lang.String title,
java.lang.Object[][] items) |
Adds two dimentional array of objects to dump hashtable.
|
void |
copyEnvironment(Operator anotherOperator) |
Copies all environment (output, timeouts,
visualizer) from another operator.
|
static ComponentOperator |
createOperator(java.awt.Component comp) |
Creates operator for component.
|
CharBindingMap |
getCharBindingMap() |
Returns CharBindingMap used for keyboard operations.
|
int |
getCharKey(char c) |
Returns key code to be pressed for character typing.
|
int |
getCharModifiers(char c) |
Returns modifiers mask for character typing.
|
int[] |
getCharsKeys(char[] c) |
Returns key codes to by pressed for characters typing.
|
int[] |
getCharsKeys(java.lang.String s) |
Returns key codes to by pressed for the string typing.
|
int[] |
getCharsModifiers(char[] c) |
Returns modifiers masks for characters typing.
|
int[] |
getCharsModifiers(java.lang.String s) |
Returns modifiers masks for the string typing.
|
Operator.StringComparator |
getComparator() |
Returns object which is used for string comparison.
|
static Operator.ComponentVisualizer |
getDefaultComponentVisualizer() |
Returns an object to be used by default to prepare component.
|
static int |
getDefaultMouseButton() |
Returns default mouse button mask.
|
static Operator.PathParser |
getDefaultPathParser() |
Returns an object used for parsing of path-like strings.
|
static Operator.StringComparator |
getDefaultStringComparator() |
Returns string comparator used to init operators.
|
static boolean |
getDefaultVerification() |
Says weither newly created operators perform operations verifications by default.
|
java.util.Hashtable |
getDump() |
Returns information about component.
|
static Operator |
getEnvironmentOperator() |
Returns an operator containing default environment.
|
TestOut |
getOutput() |
Returns print output streams or writers.
|
java.lang.String[] |
getParentPath(java.lang.String[] path) |
Creates new array which has all elements from
first array, except last element.
|
ComponentChooser[] |
getParentPath(ComponentChooser[] path) |
|
Operator.PathParser |
getPathParser() |
Returns object which is used for parsing of path-like strings.
|
static int |
getPopupMouseButton() |
Returns mask of mouse button which used to popup expanding.
|
JemmyProperties |
getProperties() |
Returns a JemmyProperty object assigned to this operator.
|
QueueTool |
getQueueTool() |
Returns QueueTool is used to work with queue.
|
abstract java.awt.Component |
getSource() |
Returns object operator is used for.
|
Timeouts |
getTimeouts() |
Return current timeouts.
|
boolean |
getVerification() |
Says weither operator performs operation verifications.
|
Operator.ComponentVisualizer |
getVisualizer() |
Returns component visualizer.
|
boolean |
isCaptionEqual(java.lang.String caption,
java.lang.String match) |
Compares string using getComparator StringComparator.
|
static boolean |
isCaptionEqual(java.lang.String caption,
java.lang.String match,
boolean ce,
boolean ccs) |
Deprecated.
use another methods with the same name.
|
static boolean |
isCaptionEqual(java.lang.String caption,
java.lang.String match,
Operator.StringComparator comparator) |
Compares caption (button text, window title, ...) with a sample text.
|
protected void |
lockQueue() |
Equivalent to
getQueue().lock(); . |
java.lang.String[] |
parseString(java.lang.String path) |
Parses a string to a string array
using a PathParser assigned to this operator.
|
java.lang.String[] |
parseString(java.lang.String path,
java.lang.String delim) |
Parses strings like "1|2|3" into arrays {"1", "2", "3"}.
|
void |
printDump() |
Prints component information into operator output.
|
protected void |
produceNoBlocking(Operator.NoBlockingAction action) |
Performs an operation without time control.
|
protected void |
produceNoBlocking(Operator.NoBlockingAction action,
java.lang.Object param) |
Performs an operation without time control.
|
protected java.lang.Object |
produceTimeRestricted(Action action,
long wholeTime) |
Performs an operation with time control.
|
protected java.lang.Object |
produceTimeRestricted(Action action,
java.lang.Object param,
long wholeTime) |
Performs an operation with time control.
|
protected java.lang.Object |
runMapping(Operator.MapAction action) |
To map nonprimitive type component's method.
|
protected boolean |
runMapping(Operator.MapBooleanAction action) |
To map boolean component's method.
|
protected byte |
runMapping(Operator.MapByteAction action) |
To map byte component's method.
|
protected char |
runMapping(Operator.MapCharacterAction action) |
To map char component's method.
|
protected double |
runMapping(Operator.MapDoubleAction action) |
To map double component's method.
|
protected float |
runMapping(Operator.MapFloatAction action) |
To map float component's method.
|
protected int |
runMapping(Operator.MapIntegerAction action) |
To map int component's method.
|
protected long |
runMapping(Operator.MapLongAction action) |
To map long component's method.
|
protected void |
runMapping(Operator.MapVoidAction action) |
To map void component's method.
|
void |
setCharBindingMap(CharBindingMap map) |
Defines CharBindingMap.
|
void |
setComparator(Operator.StringComparator comparator) |
Defines object which is used for string comparison.
|
static Operator.ComponentVisualizer |
setDefaultComponentVisualizer(Operator.ComponentVisualizer visualizer) |
Specifies an object to be used by default to prepare component.
|
static Operator.PathParser |
setDefaultPathParser(Operator.PathParser parser) |
Specifies an object used for parsing of path-like strings.
|
static Operator.StringComparator |
setDefaultStringComparator(Operator.StringComparator comparator) |
Defines string comparator to be assigned in constructor.
|
static boolean |
setDefaultVerification(boolean verification) |
Defines weither newly created operators should perform operation verifications by default.
|
void |
setOutput(TestOut out) |
Defines print output streams or writers.
|
void |
setPathParser(Operator.PathParser parser) |
Specifies object which is used for parsing of path-like strings.
|
JemmyProperties |
setProperties(JemmyProperties properties) |
Assigns a JemmyProperty object to this operator.
|
void |
setTimeouts(Timeouts timeouts) |
Defines current timeouts.
|
boolean |
setVerification(boolean verification) |
Defines weither operator should perform operation verifications.
|
void |
setVisualizer(Operator.ComponentVisualizer vo) |
Changes component visualizer.
|
java.lang.String |
toStringSource() |
Returns toString() result from component of this operator.
|
protected void |
unlockAndThrow(java.lang.Exception e) |
Unlocks Queue and then throw exception.
|
protected void |
unlockQueue() |
Equivalent to
getQueue().unlock(); . |
void |
waitState(ComponentChooser state) |
Waits a state specified by a ComponentChooser instance.
|
public static final java.lang.String CLASS_DPROP
getDump()
,
Constant Field Valuespublic static final java.lang.String TO_STRING_DPROP
getDump()
,
Constant Field Valuespublic static Operator.ComponentVisualizer setDefaultComponentVisualizer(Operator.ComponentVisualizer visualizer)
visualizer
- ComponentVisualizer implementationsetVisualizer(Operator.ComponentVisualizer)
,
getDefaultComponentVisualizer()
,
DefaultVisualizer
public static Operator.ComponentVisualizer getDefaultComponentVisualizer()
getVisualizer()
,
setDefaultComponentVisualizer(Operator.ComponentVisualizer)
public static Operator.StringComparator setDefaultStringComparator(Operator.StringComparator comparator)
comparator
- the comparator to be used by default.getDefaultStringComparator()
,
Operator.StringComparator
public static Operator.StringComparator getDefaultStringComparator()
setDefaultStringComparator(Operator.StringComparator)
,
Operator.StringComparator
public static Operator.PathParser setDefaultPathParser(Operator.PathParser parser)
parser
- the parser.Operator.PathParser
,
getDefaultPathParser()
public static Operator.PathParser getDefaultPathParser()
Operator.PathParser
,
setDefaultPathParser(org.netbeans.jemmy.operators.Operator.PathParser)
public static boolean setDefaultVerification(boolean verification)
verification
- a verification mode to be used by default.getDefaultVerification()
,
setVerification(boolean)
public static boolean getDefaultVerification()
setDefaultVerification(boolean)
,
getVerification()
public static boolean isCaptionEqual(java.lang.String caption, java.lang.String match, boolean ce, boolean ccs)
caption
- String to be compared with match. Method returns false, if parameter is null.match
- Sample to compare with. Method returns true, if parameter is null.ce
- Compare exactly. If true, text can be a substring of caption.ccs
- Compare case sensitively. If true, both text and caption are
converted to upper case before comparison.isCaptionEqual(java.lang.String, java.lang.String, boolean, boolean)
public static boolean isCaptionEqual(java.lang.String caption, java.lang.String match, Operator.StringComparator comparator)
caption
- String to be compared with matchmatch
- Sample to compare withcomparator
- StringComparator instance.isCaptionEqual(java.lang.String, java.lang.String, boolean, boolean)
public static int getDefaultMouseButton()
InputEvent.BUTTON*_MASK
field valuepublic static int getPopupMouseButton()
InputEvent.BUTTON*_MASK
field valuepublic static ComponentOperator createOperator(java.awt.Component comp)
comp
- Component to create operator for.addOperatorPackage(String)
public static void addOperatorPackage(java.lang.String pkgName)
pkgName
- Package name.createOperator(Component)
public static Operator getEnvironmentOperator()
public abstract java.awt.Component getSource()
public QueueTool getQueueTool()
public void copyEnvironment(Operator anotherOperator)
anotherOperator
- an operator to copy the environment to.public void setTimeouts(Timeouts timeouts)
Timeoutable
setTimeouts
in interface Timeoutable
timeouts
- A collection of timeout assignments.Timeoutable.getTimeouts()
public Timeouts getTimeouts()
Timeoutable
getTimeouts
in interface Timeoutable
Timeoutable.setTimeouts(org.netbeans.jemmy.Timeouts)
public Operator.ComponentVisualizer getVisualizer()
getDefaultComponentVisualizer()
,
setVisualizer(Operator.ComponentVisualizer)
public void setVisualizer(Operator.ComponentVisualizer vo)
vo
- a visualizer to assign to this operator.setDefaultComponentVisualizer(Operator.ComponentVisualizer)
,
getVisualizer()
public JemmyProperties getProperties()
setProperties(org.netbeans.jemmy.JemmyProperties)
public JemmyProperties setProperties(JemmyProperties properties)
properties
- a properties to assign to this operator.getProperties()
public void setCharBindingMap(CharBindingMap map)
map
- a CharBindingMap to use for keyboard operations.CharBindingMap
,
JemmyProperties.setCurrentCharBindingMap(CharBindingMap)
,
getCharBindingMap()
public CharBindingMap getCharBindingMap()
setCharBindingMap(org.netbeans.jemmy.CharBindingMap)
public void setOutput(TestOut out)
Outputable
setOutput
in interface Outputable
out
- Identify the streams or writers used for print output.Outputable.getOutput()
public TestOut getOutput()
Outputable
getOutput
in interface Outputable
Outputable.setOutput(org.netbeans.jemmy.TestOut)
public Operator.StringComparator getComparator()
Operator.StringComparator
,
Operator.DefaultStringComparator
,
setComparator(org.netbeans.jemmy.operators.Operator.StringComparator)
public void setComparator(Operator.StringComparator comparator)
comparator
- a comparator to use for string comparision.Operator.StringComparator
,
Operator.DefaultStringComparator
,
getComparator()
public Operator.PathParser getPathParser()
setPathParser(org.netbeans.jemmy.operators.Operator.PathParser)
public void setPathParser(Operator.PathParser parser)
parser
- a parser to use for path parsing.getPathParser()
public boolean setVerification(boolean verification)
verification
- new value.setDefaultVerification(boolean)
,
getDefaultVerification()
,
getVerification()
public boolean getVerification()
setDefaultVerification(boolean)
,
getDefaultVerification()
,
setVerification(boolean)
public java.lang.String[] getParentPath(java.lang.String[] path)
path
- an original arraypublic ComponentChooser[] getParentPath(ComponentChooser[] path)
public java.lang.String[] parseString(java.lang.String path)
path
- an original stringpublic java.lang.String[] parseString(java.lang.String path, java.lang.String delim)
path
- an original stringdelim
- a delimiter stringpublic int getCharKey(char c)
c
- Character to be typed.KeyEvent.VK_*
fields.CharBindingMap
public int getCharModifiers(char c)
c
- Character to be typed.InputEvent.*_MASK
fields.CharBindingMap
public int[] getCharsKeys(char[] c)
c
- Characters to be typed.KeyEvent.VK_*
values.CharBindingMap
public int[] getCharsModifiers(char[] c)
c
- Characters to be typed.InputEvent.*_MASK
fields.CharBindingMap
public int[] getCharsKeys(java.lang.String s)
s
- String to be typed.KeyEvent.VK_*
values.CharBindingMap
public int[] getCharsModifiers(java.lang.String s)
s
- String to be typed.InputEvent.*_MASK
fields.CharBindingMap
public boolean isCaptionEqual(java.lang.String caption, java.lang.String match)
caption
- a captionmatch
- a patterncaption
and match
matchisCaptionEqual(java.lang.String, java.lang.String, boolean, boolean)
public void printDump()
public java.util.Hashtable getDump()
*_DPROP
fields for
each operator type.public void waitState(ComponentChooser state)
state
- a ComponentChooser defining the state criteria.TimeoutExpiredException
- if the state has not
achieved in a value defined by "ComponentOperator.WaitStateTimeout"
protected java.lang.Object produceTimeRestricted(Action action, java.lang.Object param, long wholeTime)
action
- an action to execute.param
- an action parameters.wholeTime
- a time for the action to be finished.protected java.lang.Object produceTimeRestricted(Action action, long wholeTime)
action
- an action to execute.wholeTime
- a time for the action to be finished.protected void produceNoBlocking(Operator.NoBlockingAction action, java.lang.Object param)
action
- an action to execute.param
- an action parameters.protected void produceNoBlocking(Operator.NoBlockingAction action)
action
- an action to execute.protected void lockQueue()
getQueue().lock();
.protected void unlockQueue()
getQueue().unlock();
.protected void unlockAndThrow(java.lang.Exception e)
e
- an exception to be thrown.protected java.lang.Object runMapping(Operator.MapAction action)
action
- a mapping action.Operator.MapAction
protected char runMapping(Operator.MapCharacterAction action)
action
- a mapping action.runMapping(Operator.MapAction)
,
Operator.MapCharacterAction
protected byte runMapping(Operator.MapByteAction action)
action
- a mapping action.runMapping(Operator.MapAction)
,
Operator.MapByteAction
protected int runMapping(Operator.MapIntegerAction action)
action
- a mapping action.runMapping(Operator.MapAction)
,
Operator.MapIntegerAction
protected long runMapping(Operator.MapLongAction action)
action
- a mapping action.runMapping(Operator.MapAction)
,
Operator.MapLongAction
protected float runMapping(Operator.MapFloatAction action)
action
- a mapping action.runMapping(Operator.MapAction)
,
Operator.MapFloatAction
protected double runMapping(Operator.MapDoubleAction action)
action
- a mapping action.runMapping(Operator.MapAction)
,
Operator.MapDoubleAction
protected boolean runMapping(Operator.MapBooleanAction action)
action
- a mapping action.runMapping(Operator.MapAction)
,
Operator.MapBooleanAction
protected void runMapping(Operator.MapVoidAction action)
action
- a mapping action.runMapping(Operator.MapAction)
,
Operator.MapVoidAction
protected java.lang.String[] addToDump(java.util.Hashtable table, java.lang.String title, java.lang.Object[] items)
table
- a table to add properties to.title
- property names prefix. Property names are constructed by
adding a number to the prefix:
title + "_" + Iteger.toString("ordinal index")
items
- an array of property values.protected java.lang.String[] addToDump(java.util.Hashtable table, java.lang.String title, java.lang.Object[][] items)
table
- a table to add properties to.title
- property names prefix. Property names are constructed by
adding two numbers to the prefix:
title + "_" + Iteger.toString("row index") + "_" + Iteger.toString("column index")
items
- an array of property values.public java.lang.String toStringSource()
getSource()
.toString() in dispatch thread.