IBM Rational Functional Tester
Version 8.1.1000
IBM Rational Functional Tester Proxy SDK Reference

Project Version 2.3

com.rational.test.ft.domain.java.awt
Class ComponentProxy

java.lang.Object   extended by com.rational.test.ft.sys.RegisteredObject       extended by com.rational.test.ft.domain.ProxyTestObject
          extended by com.rational.test.ft.domain.java.JavaProxy
              extended by com.rational.test.ft.domain.java.JavaGuiProxy
                  extended by com.rational.test.ft.domain.java.awt.ComponentProxy
All Implemented Interfaces:
IChannelObject, IDataDriven, IProxyBase, IPropertyFilter, ISetParent, com.rational.test.ft.object.interfaces.IGraphical
Direct Known Subclasses:
AppletProxy, AppletViewerProxy.AppletWrapperProxy, ButtonProxy, CanvasProxy, CheckboxProxy, ChoiceProxy, JComponentProxy, LabelProxy, ListProxy, PanelProxy, ScrollbarProxy, ScrollPaneProxy, TextAreaProxy, TopLevelWindowProxy

public class ComponentProxy
extends JavaGuiProxy
implements ISetParent

A proxy for java.awt.Component.


Nested Class Summary
protected  class ComponentProxy.ChildEnumerator
           
protected  class ComponentProxy.ImmediateChildEnumerator
           
 
Field Summary
protected  boolean childrenEnumerated
           
protected static java.lang.String CLASSINDEX
           
protected static int CLASSINDEXWEIGHT
           
protected static int MAX_NAME
           
protected static java.lang.String NAMEPROPERTY
           
protected static int NAMEPROPERTYWEIGHT
           
protected static java.lang.String PRIORLABEL
           
protected static int PRIORLABELWEIGHT
           
 
Fields inherited from class com.rational.test.ft.domain.java.JavaGuiProxy
LEFT, preDownState, processMouseEventHandler, ROLEINDEX, ROLEINDEXWEIGHT, TESTDATA_SPECIALFRAMESTATE, TESTDATA_SPECIALFRAMESTATE_DESCRIPTION, topLevelWindow
 
Fields inherited from class com.rational.test.ft.domain.java.JavaProxy
debug, uniqueId
 
Fields inherited from class com.rational.test.ft.domain.ProxyTestObject
BROWSERTABTESTOBJECT_CLASSNAME, BROWSERTESTOBJECT_CLASSNAME, COLORDIALOGTESTOBJECT_CLASSNAME, CROSSDOMAINCONTAINER_CLASSNAME, DOCUMENTTESTOBJECT_CLASSNAME, DOMAINTESTOBJECT_CLASSNAME, ECLIPSETOPLEVELTESTOBJECT_CLASSNAME, EMBEDDEDBROWSERTESTOBJECT_CLASSNAME, FILEDIALOGTESTOBJECT_CLASSNAME, FRAMESUBITEMTESTOBJECT_CLASSNAME, FRAMETESTOBJECT_CLASSNAME, GEFEDITPARTTESTOBJECT_CLASSNAME, GUISUBITEMTESTOBJECT_CLASSNAME, GUITESTOBJECT_CLASSNAME, INTERNALFRAMETESTOBJECT_CLASSNAME, MESSAGEBOXTESTOBJECT_CLASSNAME, PALETTEGUISUBITEMTESTOBJECT_CLASSNAME, PROCESSTESTOBJECT_CLASSNAME, SCROLLSUBITEMTESTOBJECT_CLASSNAME, SCROLLTESTOBJECT_CLASSNAME, SELECTGUISUBITEMTESTOBJECT_CLASSNAME, SELECTSCROLLGUISUBITEMTESTOBJECT_CLASSNAME, SHELLTESTOBJECT_CLASSNAME, STATELESSGUISUBITEMTESTOBJECT_CLASSNAME, SUBITEMTESTOBJECT_CLASSNAME, TABITEMTESTOBJECT_CLASSNAME, TESTOBJECT_CLASSNAME, TEXTGUISUBITEMTESTOBJECT_CLASSNAME, TEXTGUITESTOBJECT_CLASSNAME, TEXTSCROLLTESTOBJECT_CLASSNAME, TEXTSELECTGUISUBITEMTESTOBJECT_CLASSNAME, TOGGLEGUITESTOBJECT_CLASSNAME, TOGGLETESTOBJECT_CLASSNAME, TOPLEVELSUBITEMTESTOBJECT_CLASSNAME, TOPLEVELTESTOBJECT_CLASSNAME, TRACKBARTESTOBJECT_CLASSNAME, vomClippedRectangle
 
Fields inherited from class com.rational.test.ft.sys.RegisteredObject
theTestObject
 
Fields inherited from interface com.rational.test.ft.domain.IDataDriven
INCLUDE_ALL, INCLUDE_JUSTOBJECT, INCLUDE_SIBLINGS
 
Constructor Summary
ComponentProxy(java.lang.Object theObjectInTheSUT)
          Sets the SUT object as a member variable for the proxy.
 
Method Summary
 boolean canBeScrolled()
          Returns true if the object is associated with scrollbar(s).
 void childConstructed(ProxyTestObject child)
          Inform the parent when child proxies are constructed so additional recognition properties can be added when needed.
 java.lang.Object getChildAtPoint(java.awt.Point pt)
          Finds the child object that is at the specified point.
protected  ProxyTestObject getChildProxy(java.lang.Object childObject, ProxyTestObject parentProxy)
           
 java.util.Enumeration getChildrenEnumeration()
          Returns an enumeration of proxies for the children of this object.
 java.awt.Rectangle getClippedRect(java.awt.Rectangle childRect)
           
protected  java.awt.Component[] getComponentChildren()
           
 java.lang.String getDescriptiveName()
          Returns a name that can be used to describe the associated UI object in a script.
 ProxyTestObject[] getEmbeddedBrowsers()
           
 java.util.Enumeration getImmediateChildren()
          Returns an enumeration of proxies for the immediate children of this object.
protected  java.lang.String getLabelText()
          Returns the label text associated with an isLabelled proxy.
protected  java.lang.String getLeadingLabel()
          Used to generate an interesting descriptive name for controls without persistent text.
 java.awt.Point getLocationOnScreen()
          Returns the screen location for this object.
 ProxyTestObject[] getMappableChildren()
          Uses getChildren to implement.
 ProxyTestObject getMappableParent()
          Returns a proxy object for the parent of this object.
 java.lang.String getName()
          Gets the name of the object.
 ProxyTestObject[] getOwnedObjects()
          Returns an array of proxies for the objects owned by this object.
 ProxyTestObject getOwner()
          Returns a proxy object for the owner of this object.
 ProxyTestObject getParent()
          Returns a proxy object for the parent of this object.
 ProxyTestObject getParent2()
          Gets the parent of the current object without taking JavaGuiProxy.shouldBeMapped() into consideration.
 java.lang.Object getParentObject()
          Returns an object for the parent of this object.
 java.lang.Object getProperty(java.lang.String propertyName)
          Get the value for a specific property.
 java.lang.String getRole()
          Returns TestObjectRole.ROLE_AWT.
 java.awt.Rectangle getScreenRectangle()
          Returns the rectangle that contains the component being evaluated relative to the top left corner of the screen.
 ProxyTestObject getTopParent()
          Returns a proxy object for the top parent of this object.
 com.rational.test.ft.sys.graphical.Window getWindow()
           
 boolean hasFocus()
          Always returns false because there is not a direct way to determine who has the focus in the AWT world.
protected static boolean isDopeyDynamicName(java.lang.Object theTestObject, java.lang.String name)
           
 boolean isEnabled()
          Checks the component under evaluation to determine if it is enabled or disabled.
 boolean isHScroll()
          Returns true if the object is a horizontal scrollbar.
protected  boolean isLabelled()
          Returns true if the particular proxy has a label that can be used as a recognition property for another test object.
 boolean isOpaque()
          Checks the component under evaluation to determine if it is opaque or transparent.
 boolean isRecognitionProperty(java.lang.String propName)
          Currently, at componentProxy level, we don't consider name property having values button0, button1 etc as recognition properties
 boolean isShowing()
          Checks the component under evaluation to determine if it is showing (as opposed to hidden).
 boolean isVScroll()
          Returns true if the object is a vertical scrollbar.
 void setParent(ProxyTestObject parent)
          For controls that do not have direct ties to the parent object the tie needs to be explicitly defined.
 
Methods inherited from class com.rational.test.ft.domain.java.JavaGuiProxy
activateTopWindow, click, click, click, click, doubleClick, doubleClick, doubleClick, doubleClick, drag, drag, drag, drag, dragToScreenPoint, dragToScreenPoint, dragToScreenPoint, dumpAction, ensureObjectIsVisible, getActionRect, getCachedRectX, getCachedRectY, getClippedScreenRectangle, getMethodSpecForPoint, getProcessMouseEventHandler, getRegisteredTopLevelWindow, getScreenPoint, getScreenPoint, getScriptCommandFlags, getTestObjectClassName, getTopMappableWindow, getTopWindow, hover, hover, hover, hover, isDrag, isPointInObject, isPointInObject, modifiersChanged, mouseMove, mouseMove, nClick, nClickDrag, nClickDragToScreenPoint, processHoverMouseEvent, processMouseEvent, processSingleMouseEvent, scrollRectToVisible, setProcessMouseEventHandler, setTopLevelWindow, shouldBeMapped
 
Methods inherited from class com.rational.test.ft.domain.java.JavaProxy
addMappableChildrenToVector, addRecognitionProperty, allowProperty, getAddedRecognitionPropertyValue, getChildren, getIndexer, getIndexers, getMethods, getNonValueProperties, getProperties, getRecognitionProperties, getRecognitionPropertyWeight, getStandardProperties, getTestDataTypes, getTestDomain, getTopMappableParent, getUniqueId, getVisualClippableParent, hasAddedRecognitionProperties, setIndexer, setProperty
 
Methods inherited from class com.rational.test.ft.domain.ProxyTestObject
addDataDrivableCommands, baseClassMatch, canTakeVP, equals, findChildrenWithProperties, findChildrenWithPropertiesAndInvoke, getChannel, getChildren, getDataDrivableCommand, getDataDrivableCommands, getField, getIgnorableProperties, getMappableChildren, getMappableParent, getObjectClassName, getObjectCustomClassName, getOwnedObjects, getParent, getProxy, getScriptCommandAnchor, getTestData, getVisualClippedRectangle, getVisualMappableChildren, getVisualTopParent, getVOMSpecificProperty, hasSpecialFrameState, isClassIndexConsidered, isSameObject, isValidObject, ping, suppressKeyAction, updateTestData
 
Methods inherited from class com.rational.test.ft.sys.RegisteredObject
addProxyReference, dereference, getObject, getRegisteredId, getTransactionId, isReferenced, isReleaseRequired, register, registerTransiently, release, toString, unregister
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_NAME

protected static final int MAX_NAME
See Also:
Constant Field Values

CLASSINDEX

protected static final java.lang.String CLASSINDEX
See Also:
Constant Field Values

CLASSINDEXWEIGHT

protected static final int CLASSINDEXWEIGHT
See Also:
Constant Field Values

PRIORLABEL

protected static final java.lang.String PRIORLABEL
See Also:
Constant Field Values

PRIORLABELWEIGHT

protected static final int PRIORLABELWEIGHT
See Also:
Constant Field Values

NAMEPROPERTY

protected static final java.lang.String NAMEPROPERTY
See Also:
Constant Field Values

NAMEPROPERTYWEIGHT

protected static final int NAMEPROPERTYWEIGHT
See Also:
Constant Field Values

childrenEnumerated

protected boolean childrenEnumerated
Constructor Detail

ComponentProxy

public ComponentProxy(java.lang.Object theObjectInTheSUT)
Sets the SUT object as a member variable for the proxy. All interactions with the supplied object are performed through this class.

Method Detail

getName

public java.lang.String getName()
Gets the name of the object.


getDescriptiveName

public java.lang.String getDescriptiveName()
Returns a name that can be used to describe the associated UI object in a script. This name may be further adjusted to become unique to the script, but it acts as the base for the name used in the script. Only characters used in Java identifiers should be returned (alphabetic, numeric, or underscore characters). Non-identifier characters cause script compilation failures. An example of what to return is "OKButton" for a java.awt.Button with the text "OK" on it.

Specified by:
getDescriptiveName in class JavaGuiProxy
Returns:
A descriptive object name.

getRole

public java.lang.String getRole()
Returns TestObjectRole.ROLE_AWT.

Overrides:
getRole in class JavaProxy
Returns:
A brief type name that describes the role this object plays in the UI.
Since:
RFT1.0

isShowing

public boolean isShowing()
Checks the component under evaluation to determine if it is showing (as opposed to hidden).

Specified by:
isShowing in interface com.rational.test.ft.object.interfaces.IGraphical
Specified by:
isShowing in class JavaGuiProxy
Returns:
true if component is showing, else false.

isEnabled

public boolean isEnabled()
Checks the component under evaluation to determine if it is enabled or disabled.

Specified by:
isEnabled in interface com.rational.test.ft.object.interfaces.IGraphical
Specified by:
isEnabled in class JavaGuiProxy
Returns:
true if component is enabled, else false.

isOpaque

public boolean isOpaque()
Checks the component under evaluation to determine if it is opaque or transparent.

Specified by:
isOpaque in interface com.rational.test.ft.object.interfaces.IGraphical
Overrides:
isOpaque in class JavaGuiProxy
Returns:
true if component is opaque, else false.

canBeScrolled

public boolean canBeScrolled()
Returns true if the object is associated with scrollbar(s). By default, it returns false<\b>.

Returns:
true if the object is associated with scrollbar(s).

isVScroll

public boolean isVScroll()
Returns true if the object is a vertical scrollbar. By default, it returns false<\b>.

Returns:
true if the object is scrollbar.

isHScroll

public boolean isHScroll()
Returns true if the object is a horizontal scrollbar. By default, it returns false<\b>.

Returns:
true if the object is scrollbar.

hasFocus

public boolean hasFocus()
Always returns false because there is not a direct way to determine who has the focus in the AWT world. This does not represent a significant loss in functionality for AWT because the associated HWND can be queried to determine who has the focus. It is possible to monitor focus events, but this is not a significant enough issue, given the extreme and error-prone solution.

Specified by:
hasFocus in interface com.rational.test.ft.object.interfaces.IGraphical
Specified by:
hasFocus in class JavaGuiProxy
Returns:
Always false for AWT.

getScreenRectangle

public java.awt.Rectangle getScreenRectangle()
Returns the rectangle that contains the component being evaluated relative to the top left corner of the screen. This commonly consists of two operations (getLocationOnScreen and getSize) combined into a single operation.

Specified by:
getScreenRectangle in interface com.rational.test.ft.object.interfaces.IGraphical
Specified by:
getScreenRectangle in class JavaGuiProxy
Returns:
The adjusted rectangle surrounding component relative to the screen.
See Also:
IGraphical.isPointInObject(java.awt.Point), IGraphical.getClippedScreenRectangle()

getClippedRect

public java.awt.Rectangle getClippedRect(java.awt.Rectangle childRect)
Overrides:
getClippedRect in class JavaGuiProxy

getLocationOnScreen

public java.awt.Point getLocationOnScreen()
Returns the screen location for this object.

Returns:
The screen location of the test object.

getParent

public ProxyTestObject getParent()
Returns a proxy object for the parent of this object. Returns null if this object has no parent.

Specified by:
getParent in class JavaGuiProxy
Returns:
The proxy for the parent test object or null for a top-level window.

getParentObject

public java.lang.Object getParentObject()
Returns an object for the parent of this object. Returns null if this object has no parent.

Specified by:
getParentObject in class JavaGuiProxy
Returns:
The parent test object or null for a top level window.

getMappableParent

public ProxyTestObject getMappableParent()
Returns a proxy object for the parent of this object. Returns null if this object has no parent.

Specified by:
getMappableParent in class JavaGuiProxy
Returns:
The proxy for the parent test object or null for a top-level window.

getTopParent

public ProxyTestObject getTopParent()
Returns a proxy object for the top parent of this object. Returns itself if this object has no parent.

Overrides:
getTopParent in class JavaProxy
Returns:
The proxy for the top-parent test object or itself for a top-level window.

getParent2

public ProxyTestObject getParent2()
Gets the parent of the current object without taking JavaGuiProxy.shouldBeMapped() into consideration.


setParent

public void setParent(ProxyTestObject parent)
For controls that do not have direct ties to the parent object the tie needs to be explicitly defined. If not set the proxy would need to go searching for the parent in the test object hierarchy.

Specified by:
setParent in interface ISetParent
Parameters:
parent - The parent proxy.
Since:
RFT1.0

childConstructed

public void childConstructed(ProxyTestObject child)
Inform the parent when child proxies are constructed so additional recognition properties can be added when needed. By default nothing happens in this method.

Overrides:
childConstructed in class JavaProxy
Parameters:
child - The child proxy that was just constructed.

getChildAtPoint

public java.lang.Object getChildAtPoint(java.awt.Point pt)
Finds the child object that is at the specified point. Note that the point is relative to the top left corner of the screen, and not the component itself or its parent.

If this object has no children, it should return null.

Specified by:
getChildAtPoint in interface com.rational.test.ft.object.interfaces.IGraphical
Overrides:
getChildAtPoint in class JavaGuiProxy
Parameters:
pt - Screen relative point to check.
Returns:
The object at the point or null if no child object is found.
See Also:
getScreenRectangle()

getMappableChildren

public ProxyTestObject[] getMappableChildren()
Uses getChildren to implement.

Overrides:
getMappableChildren in class JavaProxy
Returns:
null, if no known children.

getChildrenEnumeration

public java.util.Enumeration getChildrenEnumeration()
Returns an enumeration of proxies for the children of this object.

Specified by:
getChildrenEnumeration in class JavaGuiProxy
Returns:
The child proxies relative to this proxy.

getChildProxy

protected ProxyTestObject getChildProxy(java.lang.Object childObject,                                         ProxyTestObject parentProxy)

getComponentChildren

protected java.awt.Component[] getComponentChildren()

isLabelled

protected boolean isLabelled()
Returns true if the particular proxy has a label that can be used as a recognition property for another test object.

Returns:
true if the particular proxy has a label that can be used as a recognition property for another test object.
See Also:
getChildrenEnumeration(), getLabelText()

getLabelText

protected java.lang.String getLabelText()
Returns the label text associated with an isLabelled proxy. This text is used to recognize siblings in the test object finds. This method is only called if the proxy has reported itself as isLabelled().

Returns:
The label text associated with an isLabelled proxy.
See Also:
getChildrenEnumeration(), isLabelled()

getImmediateChildren

public java.util.Enumeration getImmediateChildren()
Returns an enumeration of proxies for the immediate children of this object.

Specified by:
getImmediateChildren in class JavaGuiProxy
Returns:
The child proxies relative to this proxy.

getOwner

public ProxyTestObject getOwner()
Returns a proxy object for the owner of this object. Returns null if this object has no owner.

Overrides:
getOwner in class JavaProxy
Returns:
The proxy for the owning object or null for a top object without an owner.

getOwnedObjects

public ProxyTestObject[] getOwnedObjects()
Returns an array of proxies for the objects owned by this object.

Overrides:
getOwnedObjects in class JavaProxy
Returns:
An array of proxies of objects owned by this proxy.

isDopeyDynamicName

protected static boolean isDopeyDynamicName(java.lang.Object theTestObject,                                             java.lang.String name)

getProperty

public java.lang.Object getProperty(java.lang.String propertyName)
Get the value for a specific property.

Overrides:
getProperty in class JavaProxy
Parameters:
propertyName - The name of the property to fetch.
Returns:
The active value of the specified property for the associated test object.
See Also:
ProxyTestObject.getProperties(), ProxyTestObject.setProperty(String,Object), ProxyTestObject.getRecognitionProperties(), ProxyTestObject.addRecognitionProperty(String,Object,int)

isRecognitionProperty

public boolean isRecognitionProperty(java.lang.String propName)
Currently, at componentProxy level, we don't consider name property having values button0, button1 etc as recognition properties

Overrides:
isRecognitionProperty in class JavaProxy
Parameters:
propName -
Returns:
true if the property is a recognition property

getLeadingLabel

protected java.lang.String getLeadingLabel()
Used to generate an interesting descriptive name for controls without persistent text. This method returns the persistent text on a label that immediately precedes this control in the parent's hierarchy.

Returns:
A leading label component's text.

getWindow

public com.rational.test.ft.sys.graphical.Window getWindow()

getEmbeddedBrowsers

public ProxyTestObject[] getEmbeddedBrowsers()