org.safs.rational
Class CFComponent

java.lang.Object
  extended by org.safs.Processor
      extended by org.safs.ComponentFunction
          extended by org.safs.rational.CFComponent
Direct Known Subclasses:
CFButton, CFCheckBox, CFComboBox, CFDatabase, CFFlexColor, CFFlexDate, CFFlexNumericStepper, CFFlexSlider, CFHtmlDocument, CFHtmlImage, CFHtmlLink, CFLabel, CFList, CFMenuBar, CFPageTabList, CFScrollBar, CFTable, CFText, CFToolBar, CFTree, CFWPFLabel, CFWPFSlider

public class CFComponent
extends ComponentFunction

CFComponent, process a generic component. As of OCT 31, 2005 there is a new Java JAI dependency added for compiling the code or using the GetGUIImage command. The download for JAI can be found at:

     http://java.sun.com/products/java-media/jai/
 
The build requires the following JAR files be in the build path:
     jai_core.jar
     jai_codec.jar
 
To actually use the new command and other future image related commands the developer and\or user will need to install the Java JAI support if it does not become part of our standard install.

Since:
JUN 04, 2003
AUG 19, 2003 (DBauman) Original Release
SEP 02, 2005 (bolawl) reverting to previous code w/ some cosmetic cleanup. Also commented out call to getGuiImage() as it is clearly not working (RJl).
OCT 17, 2005 (CANAGL) Added DoubleClick Support
OCT 28, 2005 (CANAGL) Refactored for click variant extensions
OCT 31, 2005 (CANAGL) Adding a generic GetGUIIMage submitted by Bob Lawler. Adds a new Java JAI dependency.
AUG 08, 2006 (PHSABO) Moved getSubAreaRectangle and getClippedSubAreaRectangle helper functions to Processor superclass.
MAR 11, 2008 (JunwuMa)Added HoverMouse,CtrlClick,CtrlRightClick and ShiftClick support
MAR 11, 2008 (LeiWang)Added SetPropertyValue, VerifyGUIImageToFile support
MAR 26, 2008 (LeiWang)Modified GetGuiImage, VerifyGUIImageToFile
MAR 26, 2008 (LeiWang)Added HScrollTo, VScrollTo
APR 21, 2008 (JunwuMa)Added SelectMenuItem, SelectMenuItemContains
VerifyMenuItem, VerifyMenuItemContains
APR 22, 2008 (JunwuMa)Added SetPosition
MAY 8, 2008 (JunwuMa)Added LeftDrag and RightDrag
JUL 11, 2008 (LeiWang)Add static method isJavaDomain(), isDotnetDomain(), isHtmlDomain(), isWinDomain(), isSwtDomain()
JUL 31, 2008 (LeiWang)Modify method verifyMenuItem(),selectMenuItem() Add method findMenuBars()
AUG 11, 2008 (LeiWang)Modify method performScorll() to support .NET application
AUG 11, 2008 (JunwuMa)Add .NET support for setPropertyValue,CaptureObjectDataToFile and VerifyObjectDataToFile.
NOV 11, 2008 (LeiWang)Added method getAbsolutFileName(),capturePropertyToFile() Modified method verifyArrayPropertyToFile(), see defect S0543643.
JAN 12, 2009 (LeiWang)Modify method performScorll() to support FLEX application
JAN 20, 2009 (JunwuMa)Modify methods findMenuBars, selectMenuItem, matchedPathOfMenuItem and verifyMenuItem to support keywords on FLEX menu bar.
FEB 20, 2009 (JunwuMa)Modify inputkeys() to support FLEX for keywords Inputkeys and InputCharacters.
MAY 01, 2009 (CANAGL) Adding Float value support for numeric parameters.
JUN 12, 2009 (LeiWang)Modify method:findMenuBars(),matchedPathOfMenuItem(),selectMenuItem(),verifyMenuItem(). For supporting the menu (type is .Menubar) of win domain.
JUN 30, 2009 (singrk) Added LeftDrag variations using MouseModifiers
NOV 03, 2009 (JunwuMa)Added method findMenuBarsForWPF() as a workaround for finding the menu bars of a DotNet WPF application.
NOV 12, 2009 (CANAGL) Attempt to catch Exceptions resulting from intended Window closures.
FEB 05, 2010 (CANAGL) Adding SendEvent support for Flex. FlexObjectTestObject.performAction() is only supported in RFT 8.1 or later.
FEB 25, 2010 (JunwuMa)Added keywords GetTextFromGUI and SaveTextFromGUI for detecting text on GUI using OCR.
APR 14, 2010 (JunwuMa)Adding keyword LocateScreenImage for RJ.
APR 20, 2010 (LeiWang)Modify method action_GetSaveTextFromGUI(): use static method of OCREngine to get an OCR engine to use.
JUN30, 2011 (Dharmesh4) Added new Keyword MouseClick for RJ.

Field Summary
static java.lang.String ALTLEFTDRAG
           
static java.lang.String ASSIGNPROPERTYVARIABLE
           
static java.lang.String CAPTUREOBJECTDATATOFILE
           
static java.lang.String CAPTUREPROPERTIESTOFILE
           
static java.lang.String CAPTUREPROPERTYTOFILE
           
static java.lang.String CLEARAPPMAPCACHE
           
static java.lang.String CLICK
           
static java.lang.String CLOSEWINDOW
           
static java.lang.String COMPONENTCLICK
           
static java.lang.String CTRLALTLEFTDRAG
           
static java.lang.String CTRLCLICK
           
static java.lang.String CTRLLEFTDRAG
           
static java.lang.String CTRLRIGHTCLICK
           
static java.lang.String CTRLSHIFTLEFTDRAG
           
static java.lang.String DOUBLECLICK
           
static java.lang.String GETGUIIMAGE
           
static java.lang.String GETTEXTFROMGUI
           
static java.lang.String GUIDOESEXIST
           
static java.lang.String GUIDOESNOTEXIST
           
static java.lang.String HOVERMOUSE
           
static java.lang.String HSCROLLTO
           
static java.lang.String INPUTCHARACTERS
           
static java.lang.String INPUTKEYS
           
static java.lang.String ISPROPERTYEXIST
           
protected  boolean keepEncodingConsistent
          Keywords like CaptureXXXXX, will write file with different encoding before.
To keep them consistent, we let them to use the same default encoding
But this will affect the old test, this option is used to tell if we use consistent
encoding for these keywords
Default, we should let it as true to use consistent encoding.
See defect S0751446.
static java.lang.String LEFTDRAG
           
static java.lang.String LOCATESCREENIMAGE
           
static java.lang.String MAXIMIZE
           
static java.lang.String MINIMIZE
           
static java.lang.String MOUSECLICK
           
protected  TestObject obj1
           
static java.lang.String RESTORE
           
static java.lang.String RIGHTCLICK
           
static java.lang.String RIGHTDRAG
           
static java.lang.String SAVETEXTFROMGUI
           
protected  Script script
           
static java.lang.String SELECTMENUITEM
           
static java.lang.String SELECTMENUITEMCONTAINS
           
static java.lang.String SENDEVENT
           
static java.lang.String SETPOSITION
           
static java.lang.String SETPROPERTYVALUE
           
static java.lang.String SHIFTCLICK
           
static java.lang.String SHIFTLEFTDRAG
           
static java.lang.String VERIFYARRAYPROPERTYTOFILE
           
static java.lang.String VERIFYBINARYFILETOFILE
           
static java.lang.String VERIFYCLIPBOARDTOFILE
           
static java.lang.String VERIFYFILETOFILE
           
static java.lang.String VERIFYGUIIMAGETOFILE
           
static java.lang.String VERIFYMENUITEM
           
static java.lang.String VERIFYMENUITEMCONTAINS
           
static java.lang.String VERIFYOBJECTDATATOFILE
           
static java.lang.String VERIFYPROPERTY
           
static java.lang.String VERIFYPROPERTYCONTAINS
           
static java.lang.String VERIFYPROPERTYTOFILE
           
static java.lang.String VERIFYTEXTFILETOFILE
           
static java.lang.String VERIFYVALUECONTAINS
           
static java.lang.String VERIFYVALUEEQUALS
           
static java.lang.String VERIFYVALUES
           
static java.lang.String VERIFYVALUESIGNORECASE
           
static java.lang.String VSCROLLTO
           
static java.lang.String WAITFORGUI
           
static java.lang.String WIN_MAXIMIZED
           
static java.lang.String WIN_MINIMIZED
           
static java.lang.String WIN_NORMAL
           
 
Fields inherited from class org.safs.ComponentFunction
action, compName, mapname, utils, windowName
 
Fields inherited from class org.safs.Processor
breakpointsOn, CASE_INSENSITIVE_FLAG, CASEINSENSITIVE_FLAG, clearProxiesAlways, commandLineBreakpoint, customStr, customText, DEBUG_MESSAGE, debugStr, debugText, DEFAULT_CUSTOM_PROCESSOR_PACKAGE, DEFAULT_CUSTOM_PROCESSOR_SUBPACKAGE, DEFAULT_PROCESSOR_PACKAGE, FAILED_MESSAGE, FAILED_OK_MESSAGE, failedStr, failedText, FAILURE_DETAIL, GENERIC_MESSAGE, genericStr, genericText, LINE_FAILURE_4, log, myBreakpointsOn, otherStr, otherText, PARAM_SIZE_1, PARAM_SIZE_2, PARAM_SIZE_3, PARAM_SIZE_4, params, PASSED_MESSAGE, passedStr, passedText, PRE_TXT_SUCCESS_4, PRE_TXT_SUCCESS_5, processorConfigSet, processorMap, recordProcessed, RECTYPE_DRIVER_COMMAND, RECTYPE_DRIVER_COMMAND_F, RECTYPE_DRIVER_COMMAND_W, RECTYPE_TEST_STEP, RECTYPE_TEST_STEP_F, RECTYPE_TEST_STEP_W, RFSMCache, RFSMOnly, RFT_FIND_SEARCH_MODE_ALGORITHM, RFT_FIND_SEARCH_MODE_CACHE, SAFS_CLEARPROXIESALWAYS_ITEM, SAFS_COMMANDLINEBREAKPOINT_ITEM, SAFS_COMMANDLINEBREAKPOINT_VARIABLE, SAFS_PARAMS_FILE, SAFS_RESBUN_NAME, SAFS_SECSWAITFORCOMPONENT_ITEM, SAFS_SECSWAITFORCOMPONENT_VARIABLE, SAFS_SECSWAITFORWINDOW_ITEM, SAFS_SECSWAITFORWINDOW_VARIABLE, SAFS_TESTDOMAINS_ITEM, SAFS_TESTDOMAINS_VARIABLE, secsWaitForComponent, secsWaitForWindow, SENT_MSG_3, testDomains, testRecordData, TXT_FAILURE_1, TXT_FAILURE_2, TXT_FAILURE_3, TXT_FAILURE_4, TXT_FAILURE_5, TXT_SUCCESS_1, TXT_SUCCESS_2, TXT_SUCCESS_2a, TXT_SUCCESS_3, TXT_SUCCESS_3a, TXT_SUCCESS_4, TXT_SUCCESS_5, WARNING_MESSAGE, WARNING_OK_MESSAGE, warningStr, warningText
 
Constructor Summary
CFComponent()
          
Purpose: constructor, calls super
 
Method Summary
protected  void action_GetSaveTextFromGUI()
          Use OCR to detect the text from captured screen, executing SaveTextFromGUI or SaveTextFromGUI.
protected  java.util.List captureObjectData(TestObject table)
          Captures the object data into a List.
protected  void captureObjectDataToFile()
          A generic implementation for CaptureObjectDataToFile.
protected  java.awt.Point checkForCoord(java.util.Iterator iterator)
          
Purpose: check 'iterator' for coords, either an appmap ref, or x;y notation
protected  java.awt.Point checkForCoord(java.lang.String coord)
          Purpose: Convert a string coordination to java.awt.Point
protected  void componentClick()
          Checks for optional coords parameter and then routes to performClick.
protected  java.lang.String convertObjectValueToString(java.lang.Object value)
          Given an object of any type attempt to convert or extract its intended or visible text value.
protected  Tree extractTreeItemsSub(java.lang.Object nitem)
          Extract a 'Tree' hierarchy from a TestObject.
protected  TestObject[] findMenuBars(TestObject guiObj)
          Note: Only java-swing and .NET are supported.
protected  java.lang.String formatObjectData(java.util.List list)
          Format the List data into a single String.
protected  TopLevelTestObject getAppletsBrowser(GuiTestObject guiObj)
          getParentBrowser Given a component assumed to be inside an Applet, we will attempt to locate the TopLevelTestObject in the "Html" domain that has the containing Java Plug-in object overlapping the same screen location.
protected  java.awt.Rectangle getComponentRectangle()
          
Purpose: Capture the object's GUI image to a file.
protected  void getHelpers()
          Simply calls getHelpersWorker.
 boolean getKeepEncodingConsistent()
           
protected  java.lang.Object getObjectProperty(TestObject o, java.lang.String prop)
          get the RFT value of a property or an indexed property as in rowLabel(0)
protected  java.lang.Object getObjectPropertyFromProperties(TestObject o, java.lang.String prop)
          Attempt to extract a property value from the Hashtable provided from getProperties().
protected  java.lang.Object getUserObject(java.lang.Object obj, java.lang.Integer level)
          
Purpose: getUserObject, should be overridden by children.
protected static boolean isDotnetDomain(TestObject tobj)
           
protected static boolean isFlexDomain(TestObject tobj)
           
protected static boolean isHtmlDomain(TestObject tobj)
           
protected static boolean isJavaDomain(TestObject tobj)
           
protected static boolean isSwtDomain(TestObject tobj)
           
protected  boolean isSWTWidget(TestObject theobj)
          Determine if the TestObject is an Eclipse SWT component.
protected static boolean isWinDomain(TestObject tobj)
           
protected  void listAllProperties(TestObject obj)
          
Purpose: list all TestObject properties, using listProperties and listNonValueProperties
protected  void listAllProperties(TestObject obj, java.lang.String str)
          
Purpose: list all TestObject properties, using listProperties and listNonValueProperties
protected  void listMethods(TestObject obj)
          
Purpose: list TestObject methods
protected  void listNonValueProperties(TestObject obj)
          
Purpose: list 'non-value' TestObject properties
protected  void listProperties(TestObject obj)
          
Purpose: list 'regular' TestObject properties
protected  void localProcess()
          no implementation, just here so that our children know the 'protected' interface
protected  void locateScreenImage()
          T WindowName CompName LocateScreenImage VarName [WhomRelativeTo] [WhomRelativeTo]: relative to the screen or parentWindow default(not set): relative to the screen screen: relative to the screen parent: relative to the parent window locate the GUI if CompName in the GUI of WindowName and write the area to Varname variables set: varname=x y w h (space delimited) varname.x=x varname.y=y varname.w=w varname.h=h
protected  java.lang.String matchedPathOfMenuItem(GuiTestObject guiObj, java.lang.String path, boolean fuzzy, java.lang.String status)
          Note: guiObj is a GuiSubitemTestObject in Java or DotNet domains; a FlexMenuBarTestObject in Flex domain.
protected  void mouseClick(GuiTestObject gto, java.awt.Point clickPoint)
          Attempt to click an object by mouse event.
protected  java.lang.Object parseWhereInfo(java.lang.String whereinfo)
          Parse a string to determine 'where' something should happen on a given component.
protected  void performClick(java.lang.Object point)
          Perform a standard Click, RightClick, or DoubleClick on the component.
protected  void preformDrag()
          preform LeftDrag or RightDrag on component moving from (x1,y1) to (x2,y2).
 void process()
          
Purpose: do the processing.
protected  void selectMenuItem(boolean fuzzy)
          perform SelectMenuItem and SelectMenuItemContains
protected  void sendEvent()
          send an event to the object--assuming it supports receiving events.
protected  void sendFlexEvent()
          called from sendEvent for Flex Domain sendEvent handling.
 void setKeepEncodingConsistent()
           
protected  void setPosition()
          preform SetPosition to move Main Window, resize it and set its status.
protected  Tree tobj(TestObject nitem)
          
Purpose: extract a 'Tree' hierarchy from a TestObject using recursion; The item is for JTree node.
protected  void verifyMenuItem(boolean fuzzy)
          perform actions for keywords verifyMenuItem and verifyMenuItemContains
 
Methods inherited from class org.safs.ComponentFunction
action_getGuiImage, action_verifyGuiImageToFile, componentExecutedFailureMessage, componentFailureMessage, componentSuccessMessage, convertCoords, convertLine, convertNum, getAlternateParams, getHelpersWorker, issueActionFailure, issueActionOnXFailure, issueErrorPerformingAction, issueErrorPerformingActionOnX, issueFileErrorFailure, issueInputRecordFailure, issueParameterCountFailure, issueParameterCountFailure, issueParameterValueFailure, issuePassedSuccess, issuePassedSuccessUsing, issueUnknownErrorFailure, isSupportedRecordType, lookupAppMapCoordReference, lookupAppMapLineReference, lookupAppMapNumReference, lookupAppMapReference, setRectVars, updateFromTestRecordData
 
Methods inherited from class org.safs.Processor
activateBreakpoint, checkBreakpoints, checkMyBreakpoints, delay, distributeConfigInformation, getAppMapItem, getChainedProcessor, getClassInstance, getClearProxiesAlways, getCustomProcClassNames, getCustomProcInstancePath, getLogUtilities, getParams, getProcClassNames, getProcInstance, getProcInstancePath, getRequiredField, getSecsWaitForComponent, getSecsWaitForWindow, getStandardErrorMessage, getTestRecordData, getVariable, hasChainedProcessor, initProcessorAndProcess, instanceProcessorAndProcess, isBreakpointsOn, isComponentFunctionRecord, isDriverCommandRecord, isEngineCommandRecord, isMyBreakpointsOn, isRecordProcessed, isRFSMCache, isRFSMOnly, paramsFailedMsg, paramsFailedMsg, processCustomProcessor, processSubclassProcessor, setBreakpointsOn, setChainedProcessor, setClearProxiesAlways, setCommandLineBreakpoint, setCustomProcInstancePath, setLogUtilities, setMyBreakpointsOn, setParams, setProcInstance, setProcInstancePath, setRecordProcessed, setRFSMCache, setRFSMOnly, setSecsWaitForComponent, setSecsWaitForWindow, setTestDomains, setTestRecordData, setVariable, standardFailureMessage, substituteVariable, validateParamSize, validProcessorClassName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLICK

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

DOUBLECLICK

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

RIGHTCLICK

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

CTRLCLICK

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

CTRLRIGHTCLICK

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

SHIFTCLICK

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

COMPONENTCLICK

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

MOUSECLICK

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

HOVERMOUSE

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

CLOSEWINDOW

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

RESTORE

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

MINIMIZE

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

MAXIMIZE

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

WAITFORGUI

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

VERIFYPROPERTY

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

VERIFYPROPERTYCONTAINS

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

VERIFYVALUES

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

VERIFYVALUESIGNORECASE

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

VERIFYVALUEEQUALS

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

VERIFYVALUECONTAINS

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

ASSIGNPROPERTYVARIABLE

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

INPUTKEYS

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

INPUTCHARACTERS

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

CAPTUREOBJECTDATATOFILE

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

CAPTUREPROPERTIESTOFILE

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

ISPROPERTYEXIST

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

VERIFYOBJECTDATATOFILE

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

VERIFYTEXTFILETOFILE

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

VERIFYFILETOFILE

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

VERIFYGUIIMAGETOFILE

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

CLEARAPPMAPCACHE

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

GETGUIIMAGE

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

GUIDOESEXIST

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

GUIDOESNOTEXIST

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

VERIFYPROPERTYTOFILE

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

VERIFYARRAYPROPERTYTOFILE

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

VERIFYBINARYFILETOFILE

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

VERIFYCLIPBOARDTOFILE

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

SETPROPERTYVALUE

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

HSCROLLTO

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

VSCROLLTO

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

SELECTMENUITEM

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

SELECTMENUITEMCONTAINS

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

VERIFYMENUITEM

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

VERIFYMENUITEMCONTAINS

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

SETPOSITION

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

LEFTDRAG

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

RIGHTDRAG

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

CAPTUREPROPERTYTOFILE

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

SENDEVENT

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

GETTEXTFROMGUI

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

SAVETEXTFROMGUI

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

SHIFTLEFTDRAG

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

CTRLSHIFTLEFTDRAG

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

CTRLLEFTDRAG

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

ALTLEFTDRAG

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

CTRLALTLEFTDRAG

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

LOCATESCREENIMAGE

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

WIN_NORMAL

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

WIN_MINIMIZED

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

WIN_MAXIMIZED

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

script

protected Script script

obj1

protected TestObject obj1

keepEncodingConsistent

protected boolean keepEncodingConsistent
Keywords like CaptureXXXXX, will write file with different encoding before.
To keep them consistent, we let them to use the same default encoding
But this will affect the old test, this option is used to tell if we use consistent
encoding for these keywords
Default, we should let it as true to use consistent encoding.
See defect S0751446.

Constructor Detail

CFComponent

public CFComponent()

Purpose: constructor, calls super

Method Detail

setKeepEncodingConsistent

public void setKeepEncodingConsistent()

getKeepEncodingConsistent

public boolean getKeepEncodingConsistent()

getHelpers

protected void getHelpers()
                   throws SAFSException
Description copied from class: ComponentFunction
Simply calls getHelpersWorker. Subclasses can override this for any additional setup beyond getHelpersWorker.

Overrides:
getHelpers in class ComponentFunction
Throws:
SAFSException

process

public void process()

Purpose: do the processing. Children of us can us this method to call their own 'localProcess' method
Assumptions:
sequence:
testRecordData.setStatusCode(StatusCodes.SCRIPT_NOT_EXECUTED);
localProcess();
if (testRecordData.getStatusCode() === StatusCodes.SCRIPT_NOT_EXECUTED) {
componentProcess(); // CFComponent will do the work
}

Overrides:
process in class Processor

localProcess

protected void localProcess()
no implementation, just here so that our children know the 'protected' interface


parseWhereInfo

protected java.lang.Object parseWhereInfo(java.lang.String whereinfo)
Parse a string to determine 'where' something should happen on a given component. This is generally x,y coordinates, but subclasses can override this to provide other options. This is most often called by the CLICK commands.

Supported formats of whereinfo:

Parameters:
whereinfo - String usually retrieved from the test table.
Returns:
java.awt.Point or null. Subclasses may return other object types as they deem appropriate.

sendFlexEvent

protected void sendFlexEvent()
called from sendEvent for Flex Domain sendEvent handling.


sendEvent

protected void sendEvent()
                  throws SAFSException
send an event to the object--assuming it supports receiving events. Initially, this is being implemented to support the Flex "performAction" functionality, but this can readily be expanded to other component types and technologies.

In general, the command as initially implemented for Flex expects there to be an event name followed by 0 or more parameters. These parameters will be different and defined by the event or technology.

Throws:
SAFSException

selectMenuItem

protected void selectMenuItem(boolean fuzzy)
                       throws SAFSException
perform SelectMenuItem and SelectMenuItemContains

Parameters:
fuzzy, - false: select the menu item that exactly matches the gaven path
Throws:
SAFSException

verifyMenuItem

protected void verifyMenuItem(boolean fuzzy)
                       throws SAFSException
perform actions for keywords verifyMenuItem and verifyMenuItemContains

Parameters:
fuzzy, - to do exactly match if false, otherwise do fuzzy match
Throws:
SAFSException

setPosition

protected void setPosition()
                    throws SAFSException
preform SetPosition to move Main Window, resize it and set its status. Format: "Coords=0,0,640,480;Status=NORMAL". Status can be NORMAL, MINIMAZED and MAXMAZED Alteratively, semi-colon (;) can be used instead of comma (,) to separate numeric data. This would be required when placing the data directly in the test record and NOT in the App Map when using comma-delimited test tables.

Throws:
SAFSException

preformDrag

protected void preformDrag()
                    throws SAFSException
preform LeftDrag or RightDrag on component moving from (x1,y1) to (x2,y2). Format: "T,SwingApp,component,LeftDrag,"Coords=x1;y1;x2;y2"

Throws:
SAFSException

matchedPathOfMenuItem

protected java.lang.String matchedPathOfMenuItem(GuiTestObject guiObj,
                                                 java.lang.String path,
                                                 boolean fuzzy,
                                                 java.lang.String status)
                                          throws SAFSException
Note: guiObj is a GuiSubitemTestObject in Java or DotNet domains; a FlexMenuBarTestObject in Flex domain.

Throws:
SAFSException

findMenuBars

protected TestObject[] findMenuBars(TestObject guiObj)
Note: Only java-swing and .NET are supported.

Parameters:
guiObj - A test object represents an application window from which we try to get menu bars.
Returns:
An array of MenuBars found from parameter guiObj

componentClick

protected void componentClick()
Checks for optional coords parameter and then routes to performClick. Some subclasses may add additional functionality for the optional argument string. For example, CFTable supports "Row=n;Col=n". Subclasses may override componentClick or other methods to detect such extensions and route accordingly.


performClick

protected void performClick(java.lang.Object point)
Perform a standard Click, RightClick, or DoubleClick on the component. Subclasses may override this param

Parameters:
point - java.awt.Point x,y coords relative to the component or null.

mouseClick

protected void mouseClick(GuiTestObject gto,
                          java.awt.Point clickPoint)
Attempt to click an object by mouse event. MouseClick uses low level RFT's API (emitLowLevelEvent).

Parameters:
gto - - GuiTestObject
clickPoint - - Point as location, default center

getObjectPropertyFromProperties

protected java.lang.Object getObjectPropertyFromProperties(TestObject o,
                                                           java.lang.String prop)
Attempt to extract a property value from the Hashtable provided from getProperties(). This is sometimes useful if getProperty does NOT return a specific property's value but getProperties does!

Parameters:
o - - TestObject to get property from
prop - - property to seek
Returns:
null or Object value

getObjectProperty

protected java.lang.Object getObjectProperty(TestObject o,
                                             java.lang.String prop)
                                      throws PropertyNotFoundException
get the RFT value of a property or an indexed property as in rowLabel(0)

Parameters:
o - - TestObject to get property from
prop - - property to seek, can be an indexed property like rowLabel(0)
Returns:
null or Object value or PropertyNotFoundException
Throws:
PropertyNotFoundException

convertObjectValueToString

protected java.lang.String convertObjectValueToString(java.lang.Object value)
                                               throws SAFSException
Given an object of any type attempt to convert or extract its intended or visible text value. This function is intended to be overridden as necessary by subclasses and\or custom classes to extend the number of supported objects that can have their visible text extracted. This implementation handles:

String = value.toString() TestObject = RGuiObjectRecognition.getText(value) Handling something other than these must be done in subclasses.

Parameters:
value - String or TestObject to get the text from
Returns:
String or null -- may be object.toString() which might not be desired.
Throws:
SAFSException
See Also:
RGuiObjectRecognition.getText(TestObject)

captureObjectData

protected java.util.List captureObjectData(TestObject table)
                                    throws java.lang.IllegalArgumentException,
                                           SAFSException
Captures the object data into a List. This is generally for the CaptureObjectDataToFile and VerifyObjectDataToFile commands. Subclasses may provide this as a single List, or a List of Lists for 2D arrays. This implementation assumes the List is a single Object item. We extract the "text" or "itemText" property from the TestObject.

Parameters:
table - TestObject to snapshot data from.
Returns:
List containing a single Object item. Null if an invalid table reference is provided or some other error occurs.
Throws:
SAFSException
java.lang.IllegalArgumentException - if table is not an acceptable TestObject.

formatObjectData

protected java.lang.String formatObjectData(java.util.List list)
                                     throws java.lang.IllegalArgumentException
Format the List data into a single String. This String may include whatever formatting like Tabs, line separators, etc. are needed for the command being executed. This is generally for the CaptureObjectDataToFile and VerifyObjectDataToFile commands. Subclasses may need to override this method as appropriate for these commands.

In this implementation the List is expected to be a single Object provided by captureObjectData. This Object has typically been a Rational NameSet of Strings, a Java Collection of Strings, or a simple Object on which we use toString().

Each final item(s) in the List will be output using the toString().trim() method.

It is expected the data is ready for writing to a file or other similar use without further modification.

Parameters:
list - List returned from captureObjectData
Returns:
String formatted for writing to file or screen.
Throws:
java.lang.IllegalArgumentException - if the List or the Object extracted from the List are null.
See Also:
captureObjectData(TestObject)

captureObjectDataToFile

protected void captureObjectDataToFile()
                                throws SAFSException
A generic implementation for CaptureObjectDataToFile. Provides the primary implementation for validating the filename and writing the data to the specified file. Calls the functions captureObjectData then formatObjectData allowing subclasses like CFTable to override the data capturing and formatting functionality. The String retrieved from formatObjectData is written to the specified file unmodified.

Throws:
SAFSException
See Also:
captureObjectData(TestObject), formatObjectData(java.util.List)

getComponentRectangle

protected java.awt.Rectangle getComponentRectangle()

Purpose: Capture the object's GUI image to a file. Currently, the available formats for the output file are BMP and JPG. Optionally, the user may utilize the SubArea parameter to only capture a portion of the Component. This routine utilizes Java Advanced Imaging (JAI) to output the screen image to the file. JAI must be installed at compile time and runtime.

Overrides:
getComponentRectangle in class ComponentFunction
Returns:
Rectangle bounds of the Component or null. If null is received the class assumes relevant error logging and testRecordData.statuscode changes have already been performed.

action_GetSaveTextFromGUI

protected void action_GetSaveTextFromGUI()
                                  throws SAFSException
Use OCR to detect the text from captured screen, executing SaveTextFromGUI or SaveTextFromGUI. T, Window, Component, SaveTextFromGUI, outputfile [,subArea] [,OCR option] [,LangId] [,scaleRatio] T, Window, Component,GetTextFromGUI, variable [,subArea][,OCR] [,LangId] [,scaleRatio]

Throws:
SAFSException

locateScreenImage

protected void locateScreenImage()
T WindowName CompName LocateScreenImage VarName [WhomRelativeTo] [WhomRelativeTo]: relative to the screen or parentWindow default(not set): relative to the screen screen: relative to the screen parent: relative to the parent window locate the GUI if CompName in the GUI of WindowName and write the area to Varname variables set: varname=x y w h (space delimited) varname.x=x varname.y=y varname.w=w varname.h=h


listAllProperties

protected void listAllProperties(TestObject obj)

Purpose: list all TestObject properties, using listProperties and listNonValueProperties

Parameters:
obj, - TestObject

listAllProperties

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

Purpose: list all TestObject properties, using listProperties and listNonValueProperties

Parameters:
obj, - TestObject
str, - String, used in the header of the list

listProperties

protected void listProperties(TestObject obj)

Purpose: list 'regular' TestObject properties

Parameters:
obj, - TestObject

listNonValueProperties

protected void listNonValueProperties(TestObject obj)

Purpose: list 'non-value' TestObject properties

Parameters:
obj, - TestObject

listMethods

protected void listMethods(TestObject obj)

Purpose: list TestObject methods

Parameters:
obj, - TestObject

extractTreeItemsSub

protected Tree extractTreeItemsSub(java.lang.Object nitem)
                            throws SAFSException
Extract a 'Tree' hierarchy from a TestObject. The method currently only supports swing JTrees.
Assumptions:
this is the mechanism used (gleaned through lots of trial and error):

Parameters:
nitem, - TestObject, the next item
Returns:
org.safs.Tree
Throws:
SAFSException

tobj

protected Tree tobj(TestObject nitem)
             throws java.lang.Exception

Purpose: extract a 'Tree' hierarchy from a TestObject using recursion; The item is for JTree node.
Assumptions:
this is the mechanism used (gleaned through lots of trial and error):

Parameters:
obj, - Object (actually of type GuiSubitemTestObject)
Returns:
org.safs.Tree
Throws:
java.lang.Exception

getUserObject

protected java.lang.Object getUserObject(java.lang.Object obj,
                                         java.lang.Integer level)

Purpose: getUserObject, should be overridden by children. Check if obj instanceof TestObject, if not, return obj; This version hard codes the equivalent of 'obj.toString()' if it is a test object.

Parameters:
obj, - Object obj
level, - Integer
Returns:
either obj, or fi a testobject, the output of 'obj.toString()'

isSWTWidget

protected boolean isSWTWidget(TestObject theobj)
Determine if the TestObject is an Eclipse SWT component.

Parameters:
theobj, - TestObject reference to GUI component
Returns:
true if the component classname begins with 'org.eclipse.swt.'

checkForCoord

protected java.awt.Point checkForCoord(java.util.Iterator iterator)

Purpose: check 'iterator' for coords, either an appmap ref, or x;y notation

Parameters:
iterator, - Iterator
Returns:
java.awt.Point, null if iterator hasn't another element

checkForCoord

protected java.awt.Point checkForCoord(java.lang.String coord)
Purpose: Convert a string coordination to java.awt.Point

Parameters:
coord, - String. is either an appmap ref, or x;y notation
Returns:
java.awt.Point, null if iterator hasn't another element

getAppletsBrowser

protected TopLevelTestObject getAppletsBrowser(GuiTestObject guiObj)
getParentBrowser Given a component assumed to be inside an Applet, we will attempt to locate the TopLevelTestObject in the "Html" domain that has the containing Java Plug-in object overlapping the same screen location. Example of use is inputKeys to an applet component. Applets and the HTMLAppletProxy do not have inputKeys and there is no easy way to get hold of the parent Browser object for an applet. We must simply get the Point on screen of our Component and then attempt to find a TopLevelTestObject (BrowserTestObject?) whose child at that same Point is a Java Plug-In ActiveX control. It is possible that there will be multiple browsers running Applets on screen at the same time. We will match the first one whose applet screen coordinates overlap our component screen coordinates. This will almost always give us the right browser window, but it may be possible for 2 browsers with applets to reside one on top of the other and it may be possible that we will find the wrong one first. There isn't much we can do about that given the API and object properties currently available. If we do see this error in the future we may have to do additional checks like checking process ids, applet rectangle coordinates, and the like, but even these can still result in false matches because 2 browsers could be showing the same applet, the same size, and in 2 browsers that have the same process id.

Parameters:
GuiTestObject - component assumed to be inside a browser applet.
Returns:
TopLevelTestObject of the matching Browser or null.

isJavaDomain

protected static boolean isJavaDomain(TestObject tobj)

isDotnetDomain

protected static boolean isDotnetDomain(TestObject tobj)

isHtmlDomain

protected static boolean isHtmlDomain(TestObject tobj)

isWinDomain

protected static boolean isWinDomain(TestObject tobj)

isSwtDomain

protected static boolean isSwtDomain(TestObject tobj)

isFlexDomain

protected static boolean isFlexDomain(TestObject tobj)