org.safs.rational
Class RGuiObjectRecognition

java.lang.Object
  extended by org.safs.GuiObjectRecognition
      extended by org.safs.rational.RGuiObjectRecognition

public class RGuiObjectRecognition
extends GuiObjectRecognition

External users would normally not use this class directly.
Consequently, the API and associated data is subject to change without notice.

Rational specific implementation for storing and comparing GuiTestObjects a\ against generic recognition strings.

To effectively support "CurrentWindow" recognition strings we now have the need for JNA: Java Native Access


Nested Class Summary
 
Nested classes/interfaces inherited from class org.safs.GuiObjectRecognition
GuiObjectRecognition.GORInfo
 
Field Summary
 
Fields inherited from class org.safs.GuiObjectRecognition
assignSeparator, CATEGORY_CLASS, CATEGORY_CLASS_ID, CATEGORY_CURRENTWINDOW, CATEGORY_CURRENTWINDOW_ID, CATEGORY_DOMAIN, CATEGORY_DOMAIN_ID, CATEGORY_JAVA_CLASS, CATEGORY_PROCESS, CATEGORY_PROCESS_ID, CATEGORY_TYPE, CATEGORY_TYPE_ID, CATEGORY_UNKNOWN_ID, categoryIndex, classCategory, classCategoryID, classInfo, classValue, containerClassesIgnoredForRecognition, containerNamesIgnoredForRecognition, containerTypes, containerTypesIgnoredForRecognition, containerTypesWithOnlyOneChildVisible, DEFAULT_ASSIGN_SEPARATOR, DEFAULT_CLOSE_CAPTION_EXPRESSION, DEFAULT_MATCH_ANY, DEFAULT_OPEN_CAPTION_EXPRESSION, DEFAULT_QUALIFIER_SEPARATOR, DEFUALT_PATH_SEPARATOR, DEFUALT_PROPERTY_QUALIFIER_SEPARATOR, DhtmlElements, domainInfo, domainValue, gorInfos, govLevel, htmlElements, ignoreTypeChildren, linkHtmlElements, pathInfo, processInfo, processValue, QUALIFIER_ABS_INDEX, QUALIFIER_ABS_INDEX_ID, QUALIFIER_CAPTION, QUALIFIER_CAPTION_ID, QUALIFIER_CLASS, QUALIFIER_CLASS_ID, QUALIFIER_CLASS_INDEX, QUALIFIER_CLASS_INDEX_ID, QUALIFIER_HTMLID, QUALIFIER_HTMLID_ID, QUALIFIER_HTMLTEXT, QUALIFIER_HTMLTEXT_ID, QUALIFIER_HTMLTITLE, QUALIFIER_HTMLTITLE_ID, QUALIFIER_ID, QUALIFIER_ID_ID, QUALIFIER_INDEX, QUALIFIER_INDEX_ID, QUALIFIER_JAVA_CLASS, QUALIFIER_JAVACAPTION, QUALIFIER_JAVACAPTION_ID, QUALIFIER_LEVEL, QUALIFIER_LEVEL_ID, QUALIFIER_NAME, QUALIFIER_NAME_CONTAINS, QUALIFIER_NAME_CONTAINS_ID, QUALIFIER_NAME_ID, QUALIFIER_OBJECT_INDEX, QUALIFIER_OBJECT_INDEX_ID, QUALIFIER_PATH, QUALIFIER_PATH_ID, QUALIFIER_PROPERTY, QUALIFIER_PROPERTY_CONTAINS, QUALIFIER_PROPERTY_CONTAINS_ID, QUALIFIER_PROPERTY_ID, QUALIFIER_TEXT, QUALIFIER_TEXT_ID, QUALIFIER_UNKNOWN_ID, qualifierInfo, qualifierMatches, qualifierSeparator, textOKForRecognition, topLevelContainers
 
Constructor Summary
RGuiObjectRecognition(java.lang.String objectInfo, Script script, int govLevel)
          Standard Constructor
RGuiObjectRecognition(java.lang.String objectInfo, java.lang.String aQualifierSeparator, int govLevel, Script script)
          Constructor with Alternate Qualifier Separator
 
Method Summary
static java.lang.String getCaption(TestObject obj)
           
protected  java.util.List getDotNetSuperClassNames(TestObject theObject)
           
static java.lang.String getID(TestObject obj)
           
protected  java.util.List getJavaSuperClassNames(TestObject theObject)
           
 java.lang.Object getMatchingPathObject(java.lang.Object theObject, java.lang.String thePath)
          Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to provide the requested information.
static java.lang.String getName(TestObject obj)
          08.29.2006 - bolawl - With the addition of getObjectAccessibleName(), it's no longer necessary to check for accessibleName here.
 java.lang.String getObjectAccessibleName(java.lang.Object obj)
          Allow individual engines (ie.
 java.lang.String getObjectCaption(java.lang.Object theObject)
          Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to provide the requested information.
 java.lang.String getObjectClassName(java.lang.Object theObject)
          Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to provide the requested information.
 java.lang.String getObjectDomain(java.lang.Object theObject)
          Used internally or by subclasses only.
 java.lang.String getObjectID(java.lang.Object theObject)
          Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to provide the requested information.
 int getObjectLevel(java.lang.Object theObject)
          not yet implemented Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to provide the requested information.
 java.lang.String getObjectName(java.lang.Object theObject)
          Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to provide the requested information.
 java.lang.String getObjectProperty(java.lang.Object theObject, java.lang.String theProperty)
          Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to provide the requested information.
 java.lang.String[] getObjectPropertyNames(java.lang.Object theObject)
          Used internally, or by direct subclasses only.
Subclasses implement tool-dependent mechanism to provide the requested information.
 java.lang.String[] getObjectSuperClassNames(java.lang.Object anObject)
          Used internally, or by direct subclasses.
Subclasses using proxies must override with a tool-dependent mechanism to provide the requested information.
 java.lang.String getObjectText(java.lang.Object theObject)
          Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to provide the requested information.
static java.lang.String getText(TestObject obj)
           
static java.lang.String getUIClassID(TestObject obj)
           
 boolean isMatchingPath(java.lang.Object theObject, java.lang.String thePath)
          Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to determine the requested information.
 boolean isMatchingSubClass(java.lang.Object theObject, java.lang.String theClass, java.lang.String parentClass)
          Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to simply forward this request on to the RGuiClassData.isMatched function after casting the object to the appropriate class.
 boolean isMatchingType(java.lang.Object theObject, java.lang.String theClass)
          Determine if the provided GuiTestObject matches our segment of the recognition string.
 boolean isObjectShowing(java.lang.Object theObject)
          Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to provide the requested information.
static boolean isObjectVisible(TestObject obj)
           
static boolean isTopLevelWindow(TestObject obj)
           
static boolean isVisiblePropertyTrue(TestObject testobj, java.lang.String visibleProp)
           
protected  void listAllProperties(TestObject obj, java.lang.String str)
           
protected  void listMethods(TestObject obj)
           
protected  void listNonValueProperties(TestObject obj)
           
protected  void listProperties(TestObject obj)
           
 
Methods inherited from class org.safs.GuiObjectRecognition
extractClassInfo, getClassCategory, getClassCategoryID, getClassRecognition, getClassValue, getDomainValue, getGovLevel, getMatchingObject, getObjectRecognition, getProcessValue, getQualifierCategory, getQualifierCategoryID, getQualifierCount, getQualifierIDValue, getQualifierRecognition, getQualifierSeparator, getQualifierValue, hasCategoryInfo, hasDomainInfo, hasProcessInfo, initDomainInfo, isContainerClassIgnoredForRecognition, isContainerNameIgnoredForRecognition, isContainerType, isContainerTypeIgnoredForRecognition, isContainerTypeWithOnlyOneChildVisible, isDHtmlElement, isFinalMatch, isHtmlElement, isIgnoredTypeChild, isLinkHtmlElement, isMatchingCaption, isMatchingCaption, isMatchingClass, isMatchingClass, isMatchingID, isMatchingLevel, isMatchingName, isMatchingObject, isMatchingProperty, isMatchingQualifiers, isMatchingText, isTextOKForRecognition, isTopLevelContainer, makeRegexReadyWildcards, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RGuiObjectRecognition

public RGuiObjectRecognition(java.lang.String objectInfo,
                             Script script,
                             int govLevel)
Standard Constructor


RGuiObjectRecognition

public RGuiObjectRecognition(java.lang.String objectInfo,
                             java.lang.String aQualifierSeparator,
                             int govLevel,
                             Script script)
Constructor with Alternate Qualifier Separator

Method Detail

getObjectClassName

public java.lang.String getObjectClassName(java.lang.Object theObject)
Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to provide the requested information. The information is used to determine if a particular object is a match for our stored recognition information.

Specified by:
getObjectClassName in class GuiObjectRecognition
Parameters:
theObject--GuiTestObject - proxy for the object to be evaluated.
Returns:
String value of the requested object class name or null on error.

getObjectSuperClassNames

public java.lang.String[] getObjectSuperClassNames(java.lang.Object anObject)
Description copied from class: GuiObjectRecognition
Used internally, or by direct subclasses.
Subclasses using proxies must override with a tool-dependent mechanism to provide the requested information. The information is used to determine if a particular object is a match for our stored recognition information. This implementation assumes the Java object of interest is provided. Implementations using caches and keys will need to override this method.

Overrides:
getObjectSuperClassNames in class GuiObjectRecognition
Parameters:
theObject--sometimes - a tool-dependent proxy for the object to be evaluated.
Returns:
String[] values of the requested object information. A 0-length array of Super class name for the object to be tested or null objects.

getDotNetSuperClassNames

protected java.util.List getDotNetSuperClassNames(TestObject theObject)
Parameters:
theObject - A proxy object that represents the object to be tested
Returns:
A list of System.Type.FullName, which are ancestor of the objetc to be tested.

getJavaSuperClassNames

protected java.util.List getJavaSuperClassNames(TestObject theObject)
Parameters:
theObject - A proxy object that represents the object to be tested
Returns:
A list of name of Class, which are ancestor of the objetc to be tested.

isMatchingType

public boolean isMatchingType(java.lang.Object theObject,
                              java.lang.String theClass)
Determine if the provided GuiTestObject matches our segment of the recognition string. Primarily just forwards the call to RGuiClassData.getMappedClassType.

Specified by:
isMatchingType in class GuiObjectRecognition
Parameters:
theObject--GuiTestObject - proxy of the actual object to be compared against our recognition string.
theClass - information provided and forwarded to RGuiClassData.isMappedClassType.
Returns:
true if the class matches, or is a subclass of, the class specified in the recognition string. false if we cannot identify an appropriate match or an error occurs.

isMatchingSubClass

public boolean isMatchingSubClass(java.lang.Object theObject,
                                  java.lang.String theClass,
                                  java.lang.String parentClass)
Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to simply forward this request on to the RGuiClassData.isMatched function after casting the object to the appropriate class. We use this method to support the "CurrentWindow" recognition string. isMatchingSubclass should return true IF the class sought is "CurrentWindow" and the object is determined to be the topmost active window with input (keyboard) focus.

Specified by:
isMatchingSubClass in class GuiObjectRecognition
Parameters:
theObject--GuiTestObject - proxy for the object to be evaluated.
theClass - information from GuiObjectRecognition and forwarded to RGuiClassData.isMatched.
parentClass - information provided and forwarded to RGuiClassData.isMatched.
Returns:
true if theObject is determined to satisfy the requested information.

isObjectShowing

public boolean isObjectShowing(java.lang.Object theObject)
Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to provide the requested information. The information is used to determine if a particular object is a match for our stored recognition information.

Specified by:
isObjectShowing in class GuiObjectRecognition
Parameters:
theObject--GuiTestObject - proxy for the object to be evaluated.
Returns:
true if theObject was found to be "showing" or "visible".

getObjectCaption

public java.lang.String getObjectCaption(java.lang.Object theObject)
Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to provide the requested information. The information is used to determine if a particular object is a match for our stored recognition information.

Specified by:
getObjectCaption in class GuiObjectRecognition
Parameters:
theObject--GuiTestObject - proxy for the object to be evaluated.
Returns:
String value of the requested object information or an empty string. Must not return a null value at this time.

getObjectDomain

public java.lang.String getObjectDomain(java.lang.Object theObject)
Used internally or by subclasses only. The object domain is the environment, OS, or programming language origins of theObject. Example: Java, Html, Win, Net, Visual Basic, etc.

Specified by:
getObjectDomain in class GuiObjectRecognition
Parameters:
theObject - -- usually a tool-dependent proxy for the object to be evaluated.
Returns:
String value of "Java" , "Net", "Html", Win", etc..

getObjectName

public java.lang.String getObjectName(java.lang.Object theObject)
Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to provide the requested information. The information is used to determine if a particular object is a match for our stored recognition information.

Specified by:
getObjectName in class GuiObjectRecognition
Parameters:
theObject--GuiTestObject - proxy for the object to be evaluated.
Returns:
String value of the requested object information or an empty string. Must not return a null value at this time.

getObjectAccessibleName

public java.lang.String getObjectAccessibleName(java.lang.Object obj)
Description copied from class: GuiObjectRecognition
Allow individual engines (ie. RJ) to override this method with their own implementation.

Overrides:
getObjectAccessibleName in class GuiObjectRecognition
Returns:
String

getObjectLevel

public int getObjectLevel(java.lang.Object theObject)
not yet implemented Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to provide the requested information.

Level is considered to be the Z-Order--often of top level window objects-- of components on the desktop or in a container. The highest Level is Level=1, and this usually indicates the item is visible and forefront. The next Level is Level=2, and so on.

The information is used to determine if a particular object is a match for our stored recognition information.

Specified by:
getObjectLevel in class GuiObjectRecognition
Parameters:
theObject--TestObject - proxy for the object to be evaluated.
Returns:
int value of the requested object information or -1.

getObjectText

public java.lang.String getObjectText(java.lang.Object theObject)
Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to provide the requested information. The information is used to determine if a particular object is a match for our stored recognition information.

Specified by:
getObjectText in class GuiObjectRecognition
Parameters:
theObject--TestObject - proxy for the object to be evaluated.
Returns:
String value of the requested object information or an empty string. Must not return a null value at this time.

getObjectID

public java.lang.String getObjectID(java.lang.Object theObject)
Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to provide the requested information. The information is used to determine if a particular object is a match for our stored recognition information.

Specified by:
getObjectID in class GuiObjectRecognition
Parameters:
theObject--TestObject - proxy for the object to be evaluated.
Returns:
String value of the requested object information or an empty string. Must not return a null value at this time.

getObjectPropertyNames

public java.lang.String[] getObjectPropertyNames(java.lang.Object theObject)
Used internally, or by direct subclasses only.
Subclasses implement tool-dependent mechanism to provide the requested information.

Specified by:
getObjectPropertyNames in class GuiObjectRecognition
Parameters:
theObject--usually - a tool-dependent proxy for the object to be evaluated.
Returns:
String[] of all known property names. Property names are assumed to be case-sensitive.

getObjectProperty

public java.lang.String getObjectProperty(java.lang.Object theObject,
                                          java.lang.String theProperty)
Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to provide the requested information. The information is used to determine if a particular object is a match for our stored recognition information.

Specified by:
getObjectProperty in class GuiObjectRecognition
Parameters:
theObject--TestObject - proxy for the object to be evaluated.
theProperty - name of the property value to be evaluated in the object.
Returns:
String value of the requested object information. May be an empty string. May be null if the property does not exist.

getMatchingPathObject

public java.lang.Object getMatchingPathObject(java.lang.Object theObject,
                                              java.lang.String thePath)
Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to provide the requested information. Retrieves the resulting object identified with the Path information applied to theObject.

Specified by:
getMatchingPathObject in class GuiObjectRecognition
Parameters:
theObject--StatelessGuiSubitemTestObject - proxy for the object to be evaluated.
thePath - information to locate another object or subitem relative to theObject. this is usually something like a menuitem or tree node where supported.
Returns:
Object child sub-object found relative to theObject

isMatchingPath

public boolean isMatchingPath(java.lang.Object theObject,
                              java.lang.String thePath)
Used internally by GuiObjectRecognition superclass.
Rational RobotJ mechanism to determine the requested information. The information is used to determine if a particular object is a match for our stored recognition information.

Specified by:
isMatchingPath in class GuiObjectRecognition
Parameters:
theObject--StatelessGuiSubitemTestObject - proxy for the object to be evaluated.
thePath - information to locate another object or subitem relative to theObject. this is usually something like a menuitem or tree node where supported.
Returns:
true if the child sub-object was found relative to theObject.

listAllProperties

protected void listAllProperties(TestObject obj,
                                 java.lang.String str)

listProperties

protected void listProperties(TestObject obj)

listNonValueProperties

protected void listNonValueProperties(TestObject obj)

listMethods

protected void listMethods(TestObject obj)

isObjectVisible

public static boolean isObjectVisible(TestObject obj)

isVisiblePropertyTrue

public static boolean isVisiblePropertyTrue(TestObject testobj,
                                            java.lang.String visibleProp)
                                     throws PropertyNotFoundException
Throws:
PropertyNotFoundException

getUIClassID

public static java.lang.String getUIClassID(TestObject obj)

isTopLevelWindow

public static boolean isTopLevelWindow(TestObject obj)

getCaption

public static java.lang.String getCaption(TestObject obj)

getText

public static java.lang.String getText(TestObject obj)

getName

public static java.lang.String getName(TestObject obj)
08.29.2006 - bolawl - With the addition of getObjectAccessibleName(), it's no longer necessary to check for accessibleName here. Super class will be updated to first attempt match on getObjectAccessibleName() and if no match, call getObjectName() (which utlimately calls this function. MARCH 06, 2009 (CANAGL) Fixing NullPointerExceptions


getID

public static java.lang.String getID(TestObject obj)