com.rational.test.ft.domain.java

Class PseudoTopLevelProxy

  • All Implemented Interfaces:
    com.rational.test.ft.domain.IChannelObject, com.rational.test.ft.domain.IDataDriven, com.rational.test.ft.domain.IProxyBase, IPropertyFilter, com.rational.test.ft.object.interfaces.IGraphical


    public class PseudoTopLevelProxy
    extends JavaGuiProxy
    implements com.rational.test.ft.object.interfaces.IGraphical
    This class does not represent a true top level proxy, it exists solely to block recording against children that can not properly respond when a popup window is displaying. There are issues with message pumps in the core JVM that cause deadly embrace situations when popup windows (menus and combolistbox popups) are being displayed. The only real work around is to not allow access to nested controls and limit top level control interaction when these popup windows are displayed.

    This class will never get recorded, it will always cause the recording to pass to the associated real proxy object. The only action that can be recorded is a clickDisabled command that is smart enough to not trip over the JVM deadly embrace.

    The deadly embrace occurs on any action that requires the JVM to sync with the UI thread while a popup window is being displayed. Actions such as getLocationOnScreen must be avoided while in this situation, unles they are performed against the heavvyweight wincow and not against the Java control that represents that window.

    Since:
    RFT1.1
    • Field Detail

      • debug

        protected static com.rational.test.ft.util.FtDebug debug
      • topLevelProxy

        protected com.rational.test.ft.domain.ProxyTestObject topLevelProxy
      • topLevelWindow

        protected com.rational.test.ft.sys.graphical.Window topLevelWindow
      • topLevelRect

        protected java.awt.Rectangle topLevelRect
    • Constructor Detail

      • PseudoTopLevelProxy

        public PseudoTopLevelProxy(com.rational.test.ft.domain.ProxyTestObject topLevelProxy,
                                   com.rational.test.ft.sys.graphical.Window topLevelWindow,
                                   java.awt.Rectangle topLevelRect)
        This sole constructor for all proxy objects sets the SUT object as a member variable for the proxy. All interactions with the supplied object are performed through this class.
    • Method Detail

      • getTopLevelProxy

        public com.rational.test.ft.domain.ProxyTestObject getTopLevelProxy()
      • getTestObjectClassName

        public java.lang.String getTestObjectClassName()
        Set to null when the JPopupMenu is not interesting.
        Specified by:
        getTestObjectClassName in interface com.rational.test.ft.domain.IProxyBase
        Overrides:
        getTestObjectClassName in class JavaGuiProxy
        Returns:
        No test Object, or the default TestObject if determined to be interesting.
      • getParent

        public com.rational.test.ft.domain.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 com.rational.test.ft.domain.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.
      • 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 may be "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_COMBO_LIST_BOX.
        Overrides:
        getRole in class JavaProxy
        Returns:
        A brief type name that describes the role this object plays in the UI.
        Since:
        RFT1.0
      • shouldBeMapped

        public boolean shouldBeMapped()
        Returns true; by default, all test objects are mapped. This method should be overriden by proxies that do not contain interesting persistent information. Objects that the script may want to interact with should always return true.
        Overrides:
        shouldBeMapped in class JavaGuiProxy
        Returns:
        true, unless overriden in a super class.
      • getTopWindow

        public com.rational.test.ft.object.interfaces.ITopWindow getTopWindow()
        All Gui Components must be inside a top-level object. This method returns the TopWindow. Note that if this object is a top-level object, it returns an interface to itself.
        Overrides:
        getTopWindow in class JavaGuiProxy
      • getTopMappableWindow

        public com.rational.test.ft.object.interfaces.ITopWindow getTopMappableWindow()
        All Gui Components must be inside a top-level object. This method returns the TopWindow. Note that if this object is a top-level object, we return an interface to ourself.
        Overrides:
        getTopMappableWindow in class JavaGuiProxy
      • getChildrenEnumeration

        public java.util.Enumeration getChildrenEnumeration()
        Return an enumeration of mappable proxies for the children of this object.
        Specified by:
        getChildrenEnumeration in class JavaGuiProxy
        Returns:
        The child proxies relative to this proxy.
      • getImmediateChildren

        public java.util.Enumeration getImmediateChildren()
        Return 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.
      • processSingleMouseEvent

        public void processSingleMouseEvent(com.rational.test.ft.domain.IMouseActionInfo action)
        Return a MethodSpecification for the specified mouse event. This is the primary record interface for mouse events against a particular control.
        Overrides:
        processSingleMouseEvent in class JavaGuiProxy
        Parameters:
        action - The event cache and other mouse state information for this mouse action.
        See Also:
        MethodSpecification
      • getMethodSpecForPoint

        public com.rational.test.ft.sys.MethodSpecification getMethodSpecForPoint(java.awt.Point pt)
        Return a MethodSpecification for a method that returns a java.awt.Point for the specified coordinates. By default, a method specification for IGraphical.getScreenPoint is returned. However, if a proxy can find
        Overrides:
        getMethodSpecForPoint in class JavaGuiProxy
        Parameters:
        x - The screen relative x coordinate.
        y - The screen relative y coordinate.
        See Also:
        MethodSpecification
      • isShowing

        public boolean isShowing()
        Check 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()
        Check 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.
      • getScriptCommandFlags

        public com.rational.test.ft.script.ScriptCommandFlags getScriptCommandFlags()
        This method returns an active state value that reflects the state of the test object at the time of the call. The state includes values such as enabled and showing< and allows the find algorithm to wait until a required state has been achieved.
        Overrides:
        getScriptCommandFlags in class JavaGuiProxy
        Returns:
        An object that reflects the active state of the represented test object.
      • isOpaque

        public boolean isOpaque()
        Check 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.
      • hasFocus

        public boolean hasFocus()
        Check the component under evaluation to determine if it has keyboard focus.
        Specified by:
        hasFocus in interface com.rational.test.ft.object.interfaces.IGraphical
        Specified by:
        hasFocus in class JavaGuiProxy
        Returns:
        true if component has keyboard focus, else false.
      • isPointInObject

        public boolean isPointInObject(java.awt.Point pt)
        Determines if the specified screen relative point is contained in the component under evaluation. Note that the point is relative to the top left corner of the screen, and not the component itself or its parent.

        This functionality is performed by the proxy due to potentially unusual aspects associated with functionality. While typically the getScreenRectangle is used to resolve this query, there are situations for which this is not accurate. For instance if the clickable region on a button is not rectangular, just checking whether the point is in the rectangle is not valid.

        Specified by:
        isPointInObject in interface com.rational.test.ft.object.interfaces.IGraphical
        Overrides:
        isPointInObject in class JavaGuiProxy
        Parameters:
        pt - Screen relative point to check.
        Returns:
        true if component contains thePoint, else false.
        See Also:
        getScreenRectangle()
      • 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()
      • 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.
      • getClippedScreenRectangle

        public java.awt.Rectangle getClippedScreenRectangle()
        Specified by:
        getClippedScreenRectangle in interface com.rational.test.ft.object.interfaces.IGraphical
        Overrides:
        getClippedScreenRectangle in class JavaGuiProxy
      • getVisualClippedRectangle

        public java.awt.Rectangle getVisualClippedRectangle()
        The optimized way to obtain the ClippedRectangle.
        Overrides:
        getVisualClippedRectangle in class com.rational.test.ft.domain.ProxyTestObject
        Returns:
        The ClippedScreen Rectangle of the control
      • getScreenPoint

        public java.awt.Point getScreenPoint(java.awt.Point pt)
        Returns the screen relative point, given an object relative point.
        Specified by:
        getScreenPoint in interface com.rational.test.ft.object.interfaces.IGraphical
        Overrides:
        getScreenPoint in class JavaGuiProxy
        Parameters:
        pt - The Object relative point.
        Returns:
        A screen relative point.
      • getActionRect

        protected java.awt.Rectangle getActionRect()
        Gets the screen relative rectangle and throws an invalid action exception if the rectangle is not valid.
        Overrides:
        getActionRect in class JavaGuiProxy
        Returns:
        The adjusted rectangle surrounding component relative to the screen.
      • activateTopWindow

        protected void activateTopWindow()
        Overload the inherited implementation to never attempt to activate the ComboListBox popup window. It just goes away when activated.
        Overrides:
        activateTopWindow in class JavaGuiProxy