|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.extensions.jfcunit.finder.Finder
Abstract class for defining call back classes to test whether a Component
that is being searched for has been found.
Field Summary | |
private boolean |
m_caseIndependent
Ignore case. |
private boolean |
m_debug
The debug state of the finder. |
private boolean |
m_ignoreVisiblity
visibility property defaults to false. |
private int |
m_operation
Operation to be performed when selecting items. |
private org.apache.regexp.RE |
m_patternMatcher
This member is used to evaluate regular expressions. |
private boolean |
m_showDebug
Show Debug. |
private int |
m_wait
The max wait time for a window to appear in milliseconds. |
private static java.lang.String[] |
OP_CODE_STRINGS
String so for the OP codes. |
static int |
OP_CONTAINS
Check that the value is contained. |
static int |
OP_ENDSWITH
Check that the value ends with the given value. |
static int |
OP_EQUALS
Check that the values are equal. |
static int |
OP_MATCH
Match the item using a Regular expression. |
static int |
OP_STARTSWITH
Check that the value starts with the given value. |
private static int |
s_defaultWait
Default wait time. |
private static RobotTestHelper |
s_robot
Robot for debug mode of finders. |
private static boolean |
s_robotException
Robot Exception received. |
Constructor Summary | |
Finder()
|
Method Summary | |
protected void |
createPatternMatcher(java.lang.String patternString,
boolean caseIndependent)
This method is used to filter components' attributes based on a pattern specified by the user. |
boolean |
evaluate(java.lang.String leftside,
java.lang.String rightside)
Evaluate the current operation. |
java.awt.Component |
find()
Find the first component. |
protected java.awt.Component |
find(java.awt.Container[] conts,
int index)
Find the Component matching this finder at the given index within the container specified. |
java.awt.Component |
find(java.awt.Container cont,
int index)
Find the Component matching this finder at the given index within the container specified. |
java.awt.Component |
find(int index)
Find the component at the index. |
java.util.List |
findAll()
Find all of the resulting items in the entire GUI application. |
java.util.List |
findAll(java.awt.Container cont)
Find all of the items matching this finder in the container give. |
java.util.List |
findAll(java.awt.Container[] cont)
Find all of the components for this finder in the set of containers given. |
protected java.util.List |
findAll(java.awt.Container[] cont,
java.util.List results)
This find all uses a recursive pattern for internal processing. |
static java.util.List |
findComponentList(Finder finder,
java.awt.Container cont,
java.util.List pList,
int index)
Method that calls itself repetitively to build up a list of all components in the container instance that is passed in. |
boolean |
getDebug()
Get the debug state of the finder. |
static int |
getDefaultWait()
Get the default wait duration in seconds. |
int |
getOperation()
Get the operation. |
static int |
getOperation(java.lang.String code)
Convert the String to a Operation code. |
static java.lang.String |
getOperationString(int code)
Get the string version of the operation. |
boolean |
getShowDebug()
Get the debug state of the finder. |
int |
getWait()
Get the wait time. |
boolean |
isCaseIndependent()
Get the state of ignore case. |
protected boolean |
isValidForProcessing(java.awt.Component comp,
java.lang.Class cls)
This method is used to check that the window object is an instance of the specified class and is also visible. |
protected boolean |
matchPattern(java.lang.String componentAttribute,
java.lang.String patternString)
This method is used to filter components' attributes based on a pattern specified by the user. |
protected boolean |
matchPattern(java.lang.String componentAttribute,
java.lang.String patternString,
boolean caseIndependent)
This method is used to filter components' attributes based on a pattern specified by the user. |
protected boolean |
matchPattern(java.lang.String componentAttribute,
java.lang.String patternString,
org.apache.regexp.RE re)
This method is used to filter components' attributes based on a pattern specified by the user. |
protected void |
pause(long date)
Puase the finder for a bit. |
protected void |
recreatePatternMatcher(java.lang.String patternString,
boolean caseIndependent)
Recreate the pattern. |
void |
setCaseIndependent(boolean ignoreCase)
Set the finder into a case independent mode. |
void |
setDebug(boolean value)
Set the debug state of the finder. |
static void |
setDefaultWait(int wait)
Set the default wait time for the finders. |
void |
setIgnoreVisibility(boolean value)
Set the ignore visiblity property, to generate the proper index when a dialog is closed. |
void |
setOperation(int operation)
Set the operation to be performed by this finder. |
void |
setShowDebug(boolean value)
Set the debug state of the finder. |
void |
setWait(int wait)
Set the max wait time for a window to appear. |
abstract boolean |
testComponent(java.awt.Component comp)
Method that returns true if the given component matches the search criteria. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static RobotTestHelper s_robot
private static boolean s_robotException
private static final java.lang.String[] OP_CODE_STRINGS
public static final int OP_MATCH
public static final int OP_STARTSWITH
public static final int OP_ENDSWITH
public static final int OP_EQUALS
public static final int OP_CONTAINS
private org.apache.regexp.RE m_patternMatcher
private boolean m_caseIndependent
private boolean m_debug
private boolean m_ignoreVisiblity
private boolean m_showDebug
private int m_operation
private static int s_defaultWait
private int m_wait
Constructor Detail |
public Finder()
Method Detail |
public static final int getOperation(java.lang.String code)
code
- String version of the Operation.
public static final java.lang.String getOperationString(int code)
code
- int Finder.OP_code
public final boolean getDebug()
public final void setOperation(int operation)
operation
- Operation to be performed.Exact match
,
Matches a Regular Expression
,
Starts with
,
Ends with
,
Contains
public final int getOperation()
public final void setShowDebug(boolean value)
value
- true if debugging should be enabled.public final boolean getShowDebug()
public final void setWait(int wait)
wait
- time in seconds.public final int getWait()
public static final void setDefaultWait(int wait)
wait
- int duration to wait by default.public static final int getDefaultWait()
public final boolean evaluate(java.lang.String leftside, java.lang.String rightside)
leftside
- String to be compared.rightside
- String or Regular expression.
public void setCaseIndependent(boolean ignoreCase)
ignoreCase
- true if case should be ignored.public boolean isCaseIndependent()
public final void setDebug(boolean value)
value
- true if debugging should be enabled.public final void setIgnoreVisibility(boolean value)
value
- true if the visibility should be ignored.public abstract boolean testComponent(java.awt.Component comp)
comp
- The Component
to test
Component
is a matchprotected java.awt.Component find(java.awt.Container[] conts, int index)
conts
- Container to be searched.index
- Index of the item.
public final java.awt.Component find(int index)
index
- Index of the item to be found.
public java.awt.Component find(java.awt.Container cont, int index)
cont
- Container to be searched.index
- Index of the item.
public final java.awt.Component find()
public java.util.List findAll()
public java.util.List findAll(java.awt.Container cont)
cont
- Container to be searched.
public java.util.List findAll(java.awt.Container[] cont)
cont
- Container[] Set of containers to search.
protected java.util.List findAll(java.awt.Container[] cont, java.util.List results)
cont
- Container[] Container list.results
- List to which resulting items should
be added.
public static final java.util.List findComponentList(Finder finder, java.awt.Container cont, java.util.List pList, int index)
finder
- An instance of the finder which implements the testComponent()
method.cont
- The Container inside which the component is to be found.pList
- The return list.index
- The index of the component. The first component matching the
criteria will have index 0, the second 1, etc.
protected final boolean isValidForProcessing(java.awt.Component comp, java.lang.Class cls)
comp
- The Component
to be checkedcls
- The type of the component
protected void recreatePatternMatcher(java.lang.String patternString, boolean caseIndependent)
patternString
- String pattern string.caseIndependent
- boolean true if the case
should be ignored.protected void createPatternMatcher(java.lang.String patternString, boolean caseIndependent)
PatternCompiler.compile()
throwing a NullPointerException and in this case, return true if the componentAttribute
is also null.
The pattern syntax can be found at the Jakarta RegExp API Documentation in RE
.
patternString
- The pattern to match withcaseIndependent
- Whether the match should be case independent (true) or not (false)protected boolean matchPattern(java.lang.String componentAttribute, java.lang.String patternString, boolean caseIndependent)
PatternCompiler.compile()
throwing a NullPointerException and in this case, return true if the componentAttribute
is also null.
The pattern syntax can be found at the Jakarta RegExp API Documentation in RE
.
componentAttribute
- The attribute text of the component to match againstpatternString
- The pattern to match withcaseIndependent
- Whether the match should be case independent (true) or not (false)
createPatternMatcher(String, boolean)
,
#matchPattern(String, String)}
protected boolean matchPattern(java.lang.String componentAttribute, java.lang.String patternString)
PatternCompiler.compile()
throwing a NullPointerException and in this case, return true if the componentAttribute
is also null.
The pattern syntax can be found at the Jakarta RegExp API Documentation in RE
.
componentAttribute
- The attribute text of the component to match againstpatternString
- The pattern to match with
protected final boolean matchPattern(java.lang.String componentAttribute, java.lang.String patternString, org.apache.regexp.RE re)
PatternCompiler.compile()
throwing a NullPointerException and in this case, return true if the componentAttribute
is also null.
The pattern syntax can be found at the Jakarta RegExp API Documentation in RE
.
componentAttribute
- The attribute text of the component to match againstpatternString
- The pattern to match withre
- The RE pattern matcher to be used
protected final void pause(long date)
date
- Termination time of the finder.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |