org.safs.rational
Class RGuiObjectVector

java.lang.Object
  extended by org.safs.GuiObjectVector
      extended by org.safs.rational.RGuiObjectVector

public class RGuiObjectVector
extends GuiObjectVector


Field Summary
protected static java.util.Vector bannedWinMailslots
           
static java.lang.String DEFAULT_ACTIVEX_DOMAIN_NAME
           
static java.lang.String DEFAULT_FLEX_DOMAIN_NAME
           
static java.lang.String DEFAULT_HTML_DOMAIN_NAME
           
static java.lang.String DEFAULT_JAVA_DOMAIN_NAME
           
static java.lang.String DEFAULT_NET_DOMAIN_NAME
           
static java.lang.String DEFAULT_SWT_DOMAIN_NAME
           
static java.lang.String DEFAULT_WIN_DOMAIN_NAME
           
 
Fields inherited from class org.safs.GuiObjectVector
ACTIVE_WINDOW_REFERENCE, cache, childName, childSeparator, DEFAULT_CHILD_SEPARATOR, DESKTOP_REFERENCE, DOTNET_POPUPMENU, FULLPATH_SEARCH_MODE_PREFIX, GENERIC_OBJECTTYPE_POPUPWINDOW, INITIAL_CACHE_SIZE, isFullPathSearchString, isMappedClassSearchString, isRftFindSearchString, MAPPEDCLASS_SEARCH_MODE_PREFIX, MODE_ENGINE_PROCESSING, MODE_EXTERNAL_PROCESSING, OBJECTTYPE_POPUPCONTAINER, OBJECTTYPE_POPUPMENU, OBJECTTYPE_POPUPWINDOW, path, pathVector, process_mode, recognitionStringPrefixes, RFT_FIND_SEARCH_MODE_PREFIX, SIMPLETYPE_POPUPMENU, WIN_POPUPMENU, windowName
 
Constructor Summary
RGuiObjectVector()
          Calls the minimal RGuiObjectVector constructor.
RGuiObjectVector(java.lang.String window, java.lang.String child, java.lang.String pathString)
          Calls the RGuiObjectVector constructor.
RGuiObjectVector(java.lang.String window, java.lang.String child, java.lang.String pathString, Script script)
          Calls the GuiObjectVector constructor and then initGuiObjectRecognition().
 
Method Summary
protected  java.util.ArrayList addTopWindowsFromDomainToWindowList(DomainTestObject domain, java.util.ArrayList windowList)
          Note: This method will add the top windows of a domain and also the owned windows by these top windows.
 GuiChildIterator createGuiChildIterator(java.util.List gather)
          Provide our RGuiChildIterator instance as required.
 GuiChildIterator createGuiChildIterator(java.lang.Object aparent, GuiObjectVector govVector, java.util.List gather)
          Provide our RGuiChildIterator instance as required.
 GuiObjectRecognition createGuiObjectRecognition(java.lang.String subpath, int govLevel)
          Provide our RGuiObjectRecognition instance as required during initialization.
protected  DomainTestObject[] deduceValidDomains(DomainTestObject[] domains)
          Attempts to remove WIN domains that are likely bad associations with other domains like NET and, maybe, HTML.
protected  java.lang.Object getCachedItem(java.lang.Object key)
          Attempts to retrieve an item from cache using the provided key.
 java.util.ArrayList getCachedKeysByValue(java.lang.Object item)
          Retrieve keys from the cache using a value item.
 java.lang.Object[] getChildObjects(java.lang.Object parent)
          Return an array representing all known window objects.
 RGuiObjectRecognition getChildRecognition(int index)
          Casts the GuiObjectRecognition from getChildGuiObjectRecognition to our subclass.
 TestObject getChildTestObject(TestObject aparent, java.util.List gather)
          get matching child TestObject for this RGuiObjectVector.
 java.lang.Object[] getDomainParentObjects(java.lang.String domainname)
          Return an array representing all known window objects in the specified domain.
 GuiClassData getGuiClassData()
          Return our RGuiClassData subclass as required.
 java.lang.Object getMatchingParentObject()
          Tries to see if we have an RFT Mapped Object before doing the standard search.
 java.lang.Object[] getParentObjects()
          Return an array representing all known window objects.
protected  java.util.ArrayList getParentsByDomainName(java.util.ArrayList parents, java.lang.String domainname)
          Retrieve ALL parent objects from ALL domains matching the given domainname.
 Script getScript()
          Return the constructor-stored Script object.
 TestObject getTopTestObject()
          Find the one parent object that matches the recognition string set by setPathVector(String).
 TestObject getTopTestObject(DomainTestObject domain)
          Call this routine instead of getMatchingParentObject() directly.
static boolean isActiveXDomain(TestObject tobj)
           
static boolean isBannedWinDomain(DomainTestObject domain)
          return true if bannedWinMailslots contains this domains mailslot id.
static boolean isDotnetDomain(TestObject tobj)
           
static boolean isFlexDomain(TestObject tobj)
           
static boolean isHtmlDomain(TestObject tobj)
           
static boolean isJavaDomain(TestObject tobj)
           
protected  boolean isOwnerSameTestContext(TestObject owner, TestObject owned)
           
static boolean isSwtDomain(TestObject tobj)
           
 boolean isValidGuiContainer(java.lang.Object object)
          Return true if the object is a gui container.
 boolean isValidGuiObject(java.lang.Object object)
          Return true if the object is a GuiTestObject.
static boolean isWinDomain(TestObject tobj)
           
 void setActiveWindow(java.lang.Object _comp)
          Make the Window referenced by _comp the active window.
 void setScript(Script script)
          Required when alternate constructors are used.
 
Methods inherited from class org.safs.GuiObjectVector
convertToKeys, getChildGuiObjectRecognition, getChildMatchData, getChildName, getFinalChildGuiObjectRecognition, getGuiObjectType, getMatchingChildObject, getParentGuiObjectRecognition, getPathVector, getProcessMode, getRecognitionDepth, getVectorString, getWindowName, initGuiObjectRecognition, isFullPathSearchMode, isMappedClassSearchMode, isMatchingParent, isRftFindSearchMode, isSeekingPopupMenu, isTopLevelPopupContainer, isTopLevelPopupWindow, iterateChildMatchData, iterateChildren, makeUniqueCacheKey, putCachedItem, removeCachedItem, removeRStringPrefixes, resetExternalModeCache, setChildName, setFullPathSearchMode, setMappedClassSearchMode, setPathVector, setProcessMode, setRftFindSearchMode, setWindowName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_JAVA_DOMAIN_NAME

public static final java.lang.String DEFAULT_JAVA_DOMAIN_NAME
See Also:
Constant Field Values

DEFAULT_HTML_DOMAIN_NAME

public static final java.lang.String DEFAULT_HTML_DOMAIN_NAME
See Also:
Constant Field Values

DEFAULT_WIN_DOMAIN_NAME

public static final java.lang.String DEFAULT_WIN_DOMAIN_NAME
See Also:
Constant Field Values

DEFAULT_NET_DOMAIN_NAME

public static final java.lang.String DEFAULT_NET_DOMAIN_NAME
See Also:
Constant Field Values

DEFAULT_SWT_DOMAIN_NAME

public static final java.lang.String DEFAULT_SWT_DOMAIN_NAME
See Also:
Constant Field Values

DEFAULT_FLEX_DOMAIN_NAME

public static final java.lang.String DEFAULT_FLEX_DOMAIN_NAME
See Also:
Constant Field Values

DEFAULT_ACTIVEX_DOMAIN_NAME

public static final java.lang.String DEFAULT_ACTIVEX_DOMAIN_NAME
See Also:
Constant Field Values

bannedWinMailslots

protected static java.util.Vector bannedWinMailslots
See Also:
deduceValidDomains
Constructor Detail

RGuiObjectVector

public RGuiObjectVector()
Calls the minimal RGuiObjectVector constructor. Instances created with this minimal constructor MUST still have windowName, childName, pathVector, and Script set prior to calling initGuiObjectRecognition().

See Also:
GuiObjectVector.setWindowName(String), GuiObjectVector.setChildName(String), GuiObjectVector.setPathVector(String), script, GuiObjectVector.initGuiObjectRecognition()

RGuiObjectVector

public RGuiObjectVector(java.lang.String window,
                        java.lang.String child,
                        java.lang.String pathString)
Calls the RGuiObjectVector constructor. Instances created with this constructor MUST still have Script set prior to calling initGuiObjectRecognition().

Parameters:
window -
child -
pathString -
See Also:
script, GuiObjectVector.initGuiObjectRecognition(), GuiObjectVector.GuiObjectVector(String, String, String), GuiObjectVector.initGuiObjectRecognition()

RGuiObjectVector

public RGuiObjectVector(java.lang.String window,
                        java.lang.String child,
                        java.lang.String pathString,
                        Script script)
Calls the GuiObjectVector constructor and then initGuiObjectRecognition().

Parameters:
window -
child -
pathString -
script -
See Also:
GuiObjectVector.GuiObjectVector(String, String, String), GuiObjectVector.initGuiObjectRecognition()
Method Detail

setScript

public void setScript(Script script)
Required when alternate constructors are used. The script MUST be set prior to functional use of this object.

Parameters:
script -

createGuiChildIterator

public GuiChildIterator createGuiChildIterator(java.lang.Object aparent,
                                               GuiObjectVector govVector,
                                               java.util.List gather)
Provide our RGuiChildIterator instance as required.

Specified by:
createGuiChildIterator in class GuiObjectVector
Parameters:
aparent - is NOT a cached key, but should be the actual engine-specific object that should have already been retrieved from internal cache if MODE_EXTERNAL_PROCESSING.
See Also:
GuiObjectVector.createGuiChildIterator(Object, GuiObjectVector, List)

createGuiChildIterator

public GuiChildIterator createGuiChildIterator(java.util.List gather)
Provide our RGuiChildIterator instance as required.

Specified by:
createGuiChildIterator in class GuiObjectVector
See Also:
GuiObjectVector.createGuiChildIterator(List)

createGuiObjectRecognition

public GuiObjectRecognition createGuiObjectRecognition(java.lang.String subpath,
                                                       int govLevel)
Provide our RGuiObjectRecognition instance as required during initialization.

Specified by:
createGuiObjectRecognition in class GuiObjectVector
See Also:
GuiObjectVector#createGuiObjectRecognition(String)

getGuiClassData

public GuiClassData getGuiClassData()
Return our RGuiClassData subclass as required.

Specified by:
getGuiClassData in class GuiObjectVector

getScript

public Script getScript()
Return the constructor-stored Script object.


getChildRecognition

public RGuiObjectRecognition getChildRecognition(int index)
Casts the GuiObjectRecognition from getChildGuiObjectRecognition to our subclass.

See Also:
GuiObjectVector.getChildGuiObjectRecognition(int)

isBannedWinDomain

public static boolean isBannedWinDomain(DomainTestObject domain)
return true if bannedWinMailslots contains this domains mailslot id. The domain is assumed to be a WIN domain. No domain name check is made.


deduceValidDomains

protected DomainTestObject[] deduceValidDomains(DomainTestObject[] domains)
Attempts to remove WIN domains that are likely bad associations with other domains like NET and, maybe, HTML. A "bad association" is assumed to be when a WIN domain communication MailSlot ID is the same as another domain. Brief experience suggests that a WIN domain with the same Mailslot ID as a Net domain will hang or freeze RFT and produce ChannelSend Timeout exceptions. These usually last up to 2 minutes for each "bad" TestObject found in the "bad" WIN domain. This brief experience is on RFT V8.1.1.1 as of MAY 2010. However, additional testing has shown that Excel has Net domains even when no Net domain window is exposed or open. Thus, Excel will NOT be found if this function is used AND the desired target is the Excel window itself.

Parameters:
domains[] -
Returns:
domains[] with potentially invalid domains removed

getParentsByDomainName

protected java.util.ArrayList getParentsByDomainName(java.util.ArrayList parents,
                                                     java.lang.String domainname)
Retrieve ALL parent objects from ALL domains matching the given domainname. Example: "Java" or "Net" etc.

Parameters:
domainname - String name of the domain type (like "Java") to retrieve.
Returns:
Object array of ALL parent objects from all matching domains. May return null if none are found. NOV 06, 2008 (LeiWang) After enable windows of some domains, we will try to get their parents from the DomainTestObject. The method DynamicEnabler.getRootTestObjectWindows will return some native windows of opreation system which wrapped the window of certain domain. Take a .NET window as example: 1. Use DynamicEnabler.getRootTestObjectWindows to get windows We will get window's RS as Class=WindowsForms10.Window.8.app.0.378734a, and we will also get many native children like Maxiam, Minimum, ScrolBar etc. 2. Use DomainTestObject to get windows We will get window's RS as Type=DotNetWindow, which means the matched window's class is System.Windows.Forms.Form and is mapped to type "DotNetWindow" defined by us. The number of children of this window is much smaller, they are children of window System.Windows.Forms.Form which are the objects that we really want. So I will keep only those windows got from DomainTestObject. If we need really the windows from DynamicEnabler.getRootTestObjectWindows(), We can add them to the list also. I will not include them for now.

getMatchingParentObject

public java.lang.Object getMatchingParentObject()
Tries to see if we have an RFT Mapped Object before doing the standard search. This is primarily when used by STAF Process Container.

Overrides:
getMatchingParentObject in class GuiObjectVector
Returns:
Object or null if no match found. Will be a cached key if MODE_EXTERNAL_PROCESSING.

getParentObjects

public java.lang.Object[] getParentObjects()
Return an array representing all known window objects. This requires the "domain" be set by getTopTestObject, or some other means, prior to the call. If domain is not set, then parent objects from ALL supported domains will be returned. This can impact performance. If getProcessMode()==MODE_EXTERNAL_PROCESSING then the routine will reset the internal cache and store all objects in the cache returning the keys for the objects instead of the objects themselves.

Specified by:
getParentObjects in class GuiObjectVector
See Also:
GuiObjectVector.getParentObjects(), GuiObjectVector.getProcessMode(), GuiObjectVector.convertToKeys(Object[])

getDomainParentObjects

public java.lang.Object[] getDomainParentObjects(java.lang.String domainname)
Return an array representing all known window objects in the specified domain. If getProcessMode()==MODE_EXTERNAL_PROCESSING then the routine will reset the internal cache and store all objects in the cache returning the keys for the objects instead of the objects themselves.

Specified by:
getDomainParentObjects in class GuiObjectVector
Parameters:
domainname - should be one of the supported org.safs.Domains constants like "Java", "Html", "Win", etc..
See Also:
GuiObjectVector.getDomainParentObjects(String), GuiObjectVector.getProcessMode(), GuiObjectVector.convertToKeys(Object[])

isOwnerSameTestContext

protected boolean isOwnerSameTestContext(TestObject owner,
                                         TestObject owned)

addTopWindowsFromDomainToWindowList

protected java.util.ArrayList addTopWindowsFromDomainToWindowList(DomainTestObject domain,
                                                                  java.util.ArrayList windowList)
Note: This method will add the top windows of a domain and also the owned windows by these top windows.

Parameters:
domain - An ojbect of class DomainTestObject which represents Java, Html, Net,Win ect.
windowList - A List contains those found windows

getChildObjects

public java.lang.Object[] getChildObjects(java.lang.Object parent)
Return an array representing all known window objects. This requires the "domain" be set by getTopTestObject, or some other means, prior to the call. If getProcessMode()==MODE_EXTERNAL_PROCESSING then the routine will store all objects in the cache returning the keys for the objects instead of the objects themselves.

Specified by:
getChildObjects in class GuiObjectVector
Parameters:
parent - - will convert from key if MODE_EXTERNAL_PROCESSING
Returns:
array of objects or an empty array of new Object[0].
See Also:
GuiObjectVector.convertToKeys(Object[]), GuiObjectVector.makeUniqueCacheKey(Object), GuiObjectVector.putCachedItem(Object, Object), GuiObjectVector.getCachedItem(Object)

isValidGuiObject

public boolean isValidGuiObject(java.lang.Object object)
Return true if the object is a GuiTestObject.

Specified by:
isValidGuiObject in class GuiObjectVector
Parameters:
object - - will convert from key if MODE_EXTERNAL_PROCESSING.
See Also:
GuiObjectVector.isValidGuiObject(Object)

isValidGuiContainer

public boolean isValidGuiContainer(java.lang.Object object)
Return true if the object is a gui container.

Specified by:
isValidGuiContainer in class GuiObjectVector
Parameters:
object - - will convert from key if MODE_EXTERNAL_PROCESSING.
See Also:
GuiObjectVector.isValidGuiContainer(Object)

getTopTestObject

public TestObject getTopTestObject(DomainTestObject domain)
Call this routine instead of getMatchingParentObject() directly. This routine must set the Rational DomainTestObject domain and then invokes getMatchingParentObject().

It also casts the returned object to GuiTestObject--a subclass of TestObject.

See Also:
GuiObjectVector.getMatchingParentObject(), GuiTestObject

getTopTestObject

public TestObject getTopTestObject()
Find the one parent object that matches the recognition string set by setPathVector(String). Invokes getMatchingParentObject(), returns a TestObject.

Returns:
TestObject
See Also:
getTopTestObject(DomainTestObject)

getChildTestObject

public TestObject getChildTestObject(TestObject aparent,
                                     java.util.List gather)
get matching child TestObject for this RGuiObjectVector. If getProcessMode()==MODE_EXTERNAL_PROCESSING the call to getMatchingChildObject should be OK as getCachedItem should still return the aparent TestObject issued and found NOT to be a valid key.

Parameters:
aparent, - TestObject
gather, - java.util.List
Returns:
GuiTestObject subclass of TestObject
See Also:
GuiObjectVector.getMatchingChildObject(Object, List), GuiObjectVector.getCachedItem(Object)

setActiveWindow

public void setActiveWindow(java.lang.Object _comp)
Description copied from class: GuiObjectVector
Make the Window referenced by _comp the active window. If getProcessMode()==MODE_EXTERNAL_PROCESSING the implementor should assume the _comp is actually stored in the internal cache and the _comp in hand is actually a key to the cached object that must be retrieved using getCachedItem(object).

Specified by:
setActiveWindow in class GuiObjectVector
Parameters:
_comp - is expected to be of type Interface ITopWindow
See Also:
GuiObjectVector.setActiveWindow(java.lang.Object)

isJavaDomain

public static boolean isJavaDomain(TestObject tobj)

isDotnetDomain

public static boolean isDotnetDomain(TestObject tobj)

isHtmlDomain

public static boolean isHtmlDomain(TestObject tobj)

isActiveXDomain

public static boolean isActiveXDomain(TestObject tobj)

isWinDomain

public static boolean isWinDomain(TestObject tobj)

isSwtDomain

public static boolean isSwtDomain(TestObject tobj)

isFlexDomain

public static boolean isFlexDomain(TestObject tobj)

getCachedItem

protected java.lang.Object getCachedItem(java.lang.Object key)
Description copied from class: GuiObjectVector
Attempts to retrieve an item from cache using the provided key. If the key is a String, will attempt to convert it to upper-case before using it. If not found will attempt to use key as-is. If not found will return key as-is.

Overrides:
getCachedItem in class GuiObjectVector
Parameters:
key - Object to use as lookup reference into cache
Returns:
Object stored in cache or key as provided.
See Also:
GuiObjectVector.makeUniqueCacheKey(Object), GuiObjectVector.putCachedItem(Object, Object), GuiObjectVector.removeCachedItem(Object)

getCachedKeysByValue

public java.util.ArrayList getCachedKeysByValue(java.lang.Object item)
Retrieve keys from the cache using a value item. In RFT(RJ) engine, the cache is supposed to store pairs like One same value may be put into the cache more than one time, and owns different keys. Return an ArrayList with all matching keys inside.

Parameters:
item, - a cached TestObject for being looked up in cache.
Returns:
ArrayList, all matching keys in cache stored in this ArrayList.
See Also:
GuiObjectVector.makeUniqueCacheKey(Object), GuiObjectVector.putCachedItem(Object, Object), GuiObjectVector.removeCachedItem(Object)