org.safs.rational
Class CFToolBar

java.lang.Object
  extended by org.safs.Processor
      extended by org.safs.ComponentFunction
          extended by org.safs.rational.CFComponent
              extended by org.safs.rational.CFToolBar

public class CFToolBar
extends CFComponent


Purpose: CFToolBar, process a CFToolBar component
Lifetime: instantiated by TestStepProcessor

Since:
OCT 30, 2008
OCT 30, 2008 (LeiWang) Original Release
DEC 01, 2008 (LeiWang) Add method getObjectTooltip(); Modify method clickButtonTooltip(): If RFT API toolbar.click(Script.atToolTipText(tooltip)) can not work, then we will find the object ourself and perform a click on it. See defect S0539954
DEC 08, 2008 (LeiWang) Add keywords ClickUnverifiedButtonText, ClickButtonText. Add methods getObjectText(), getObjectTooltip(), performClick(), clickButtonText() isOnSelectedState(), getMatchedTestObjectFromChildren(), getFirstMatchingPathTestObject() to implement new added keywords. Modify method clickButtonTooltip(): call performClick() to click item.
DEC 12, 2008 (LeiWang) Modify method performClick(): add a new parameter point to it. Modify method clickButtonText(): If the third parameter point exists, then try to click at this point.
JAN 07, 2009 (LeiWang) Modify method clickButtonIndex(): If the parameter point exists, then try to click at this point. See defect S0551177.

Field Summary
static java.lang.String CLICKBUTTONINDEX
           
static java.lang.String CLICKBUTTONTEXT
           
static java.lang.String CLICKBUTTONTOOLTIP
           
static java.lang.String CLICUNVERIFIEDKBUTTONTEXT
           
static java.lang.String PATH_SEPARATOR
           
static java.lang.String TYPETEXT
           
static java.lang.String TYPETOOLTIP
           
 
Fields inherited from class org.safs.rational.CFComponent
ALTLEFTDRAG, ASSIGNPROPERTYVARIABLE, CAPTUREOBJECTDATATOFILE, CAPTUREPROPERTIESTOFILE, CAPTUREPROPERTYTOFILE, CLEARAPPMAPCACHE, CLICK, CLOSEWINDOW, COMPONENTCLICK, CTRLALTLEFTDRAG, CTRLCLICK, CTRLLEFTDRAG, CTRLRIGHTCLICK, CTRLSHIFTLEFTDRAG, DOUBLECLICK, GETGUIIMAGE, GUIDOESEXIST, GUIDOESNOTEXIST, HOVERMOUSE, HSCROLLTO, INPUTCHARACTERS, INPUTKEYS, LEFTDRAG, MAXIMIZE, MINIMIZE, obj1, RESTORE, RIGHTCLICK, RIGHTDRAG, script, SELECTMENUITEM, SELECTMENUITEMCONTAINS, SETPOSITION, SETPROPERTYVALUE, SHIFTCLICK, SHIFTLEFTDRAG, VERIFYARRAYPROPERTYTOFILE, VERIFYBINARYFILETOFILE, VERIFYCLIPBOARDTOFILE, VERIFYFILETOFILE, VERIFYGUIIMAGETOFILE, VERIFYMENUITEM, VERIFYMENUITEMCONTAINS, VERIFYOBJECTDATATOFILE, VERIFYPROPERTY, VERIFYPROPERTYCONTAINS, VERIFYPROPERTYTOFILE, VERIFYTEXTFILETOFILE, VERIFYVALUECONTAINS, VERIFYVALUEEQUALS, VERIFYVALUES, VERIFYVALUESIGNORECASE, VSCROLLTO, WAITFORGUI, WIN_MAXIMIZED, WIN_MINIMIZED, 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, 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_4, TXT_SUCCESS_5, WARNING_MESSAGE, WARNING_OK_MESSAGE, warningStr, warningText
 
Constructor Summary
CFToolBar()
          
Purpose: constructor, calls super
 
Method Summary
protected  java.lang.String clickButtonIndex(java.lang.String indexString)
           
protected  java.lang.String clickButtonText(java.lang.String textOrPath, boolean toVerify)
          If textOrPath is a single, click on the item whose text match to the parameter in this toolbar.
protected  java.lang.String clickButtonTooltip(java.lang.String tooltip)
           
protected  TestObject getFirstMatchingPathTestObject(TestObject testObject, boolean caseInsensitive, java.lang.String path, java.lang.String pathSeparator)
          Get the first matched object from children of parameter testObject.
protected  TestObject getMatchedTestObjectFromChildren(TestObject toolbarObject, boolean caseInsensitive, java.lang.String stringToMatch, java.lang.String matchType)
           
protected  java.lang.String getObjectText(TestObject testObject)
          Try to get the text of the testObject.
protected  java.lang.String getObjectTooltip(TestObject testObject)
          Try to get the tooltip of the testObject.
protected  boolean isOnSelectedState(GuiTestObject guiTestObject)
          Verify if the item's state is selected.
protected  void localProcess()
          
Purpose: process: process the testRecordData
This is our specific version.
protected  void performActionWithOneParameter()
          Purpose: Perform ClickAtIndex ClickAtTooltip
protected  boolean performClick(GuiTestObject testObject, java.awt.Point point)
          Try to perform a click on the given GuiTestObject, if RFT API click() can not work then try to invoke some native call to perform click.
 
Methods inherited from class org.safs.rational.CFComponent
captureObjectData, captureObjectDataToFile, checkForCoord, checkForCoord, componentClick, convertObjectValueToString, extractTreeItemsSub, findMenuBars, formatObjectData, getAppletsBrowser, getComponentRectangle, getHelpers, getObjectProperty, getObjectPropertyFromProperties, getUserObject, isDotnetDomain, isFlexDomain, isHtmlDomain, isJavaDomain, isSwtDomain, isSWTWidget, isWinDomain, listAllProperties, listAllProperties, listMethods, listNonValueProperties, listProperties, matchedPathOfMenuItem, parseWhereInfo, performClick, preformDrag, process, selectMenuItem, setPosition, tobj, verifyMenuItem
 
Methods inherited from class org.safs.ComponentFunction
action_getGuiImage, action_verifyGuiImageToFile, componentExecutedFailureMessage, componentFailureMessage, componentSuccessMessage, convertCoords, convertNum, getAlternateParams, getHelpersWorker, issueActionFailure, issueActionOnXFailure, issueErrorPerformingAction, issueErrorPerformingActionOnX, issueFileErrorFailure, issueInputRecordFailure, issueParameterCountFailure, issueParameterCountFailure, issueParameterValueFailure, issuePassedSuccess, issuePassedSuccessUsing, issueUnknownErrorFailure, isSupportedRecordType, lookupAppMapCoordReference, lookupAppMapNumReference, lookupAppMapReference, 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, paramsFailedMsg, paramsFailedMsg, processCustomProcessor, processSubclassProcessor, setBreakpointsOn, setChainedProcessor, setClearProxiesAlways, setCommandLineBreakpoint, setCustomProcInstancePath, setLogUtilities, setMyBreakpointsOn, setParams, setProcInstance, setProcInstancePath, setRecordProcessed, 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

CLICKBUTTONINDEX

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

CLICKBUTTONTOOLTIP

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

CLICKBUTTONTEXT

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

CLICUNVERIFIEDKBUTTONTEXT

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

TYPETEXT

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

TYPETOOLTIP

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

PATH_SEPARATOR

public static final java.lang.String PATH_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

CFToolBar

public CFToolBar()

Purpose: constructor, calls super

Method Detail

localProcess

protected void localProcess()

Purpose: process: process the testRecordData
This is our specific version. We subclass the generic CFComponent. The actions handled here are:


Side Effects: Processor.testRecordData statusCode is set based on the result of the processing
State Read: Processor.testRecordData, Processor.params
Assumptions: none

Overrides:
localProcess in class CFComponent

performActionWithOneParameter

protected void performActionWithOneParameter()
                                      throws SAFSException
Purpose: Perform ClickAtIndex ClickAtTooltip

Throws:
SAFSException

clickButtonIndex

protected java.lang.String clickButtonIndex(java.lang.String indexString)
                                     throws SAFSException
Throws:
SAFSException

clickButtonTooltip

protected java.lang.String clickButtonTooltip(java.lang.String tooltip)
                                       throws SAFSException
Throws:
SAFSException

clickButtonText

protected java.lang.String clickButtonText(java.lang.String textOrPath,
                                           boolean toVerify)
                                    throws SAFSException
If textOrPath is a single, click on the item whose text match to the parameter in this toolbar. Else if textOrPath is a string with "->", click on the subitem whose path math the parameter in this toolbar.

Parameters:
textOrPath - The text can be a single string or a string containning "->"
toVerify - If true, verify the item's state is checked.
Returns:
Throws:
SAFSException

isOnSelectedState

protected boolean isOnSelectedState(GuiTestObject guiTestObject)
Verify if the item's state is selected. The item's type can be one of javax.swing.AbstractButton, System.Windows.Forms.ToolStripItem, java.awt.Checkbox

Parameters:
guiTestObject -
Returns:

performClick

protected boolean performClick(GuiTestObject testObject,
                               java.awt.Point point)
                        throws SAFSException
Try to perform a click on the given GuiTestObject, if RFT API click() can not work then try to invoke some native call to perform click.

Parameters:
testObject - A GuiTestObejct
point - The point inside the testObject at where the mouse should click.
Returns:
Throws:
SAFSException

getObjectTooltip

protected java.lang.String getObjectTooltip(TestObject testObject)
Try to get the tooltip of the testObject. Now we treat two kind of object: 1. Java swing object which extends from javax.swing.JComponent 2. DotNet object which extnds from System.Windows.Forms.ToolStripItem or System.Windows.Forms.ToolBarButton

Parameters:
testObject -
Returns:

getObjectText

protected java.lang.String getObjectText(TestObject testObject)
Try to get the text of the testObject. Now we treat two kind of object: 1. Java swing object which extends from javax.swing.AbstractButton 2. DotNet object which extnds from System.Windows.Forms.ToolStripItem or System.Windows.Forms.ToolBarButton

Parameters:
testObject -
Returns:

getMatchedTestObjectFromChildren

protected TestObject getMatchedTestObjectFromChildren(TestObject toolbarObject,
                                                      boolean caseInsensitive,
                                                      java.lang.String stringToMatch,
                                                      java.lang.String matchType)
Parameters:
toolbarObject - The toolbar contains every kinds of items.
caseInsensitive - True if match with case insensitive.
stringToMatch - Text or Path or Tooltip to be matched
matchType - It can be "Text" or "Tooltip", which are defined as constant TYPETEXT and TYPETOOLTIP
Returns:

getFirstMatchingPathTestObject

protected TestObject getFirstMatchingPathTestObject(TestObject testObject,
                                                    boolean caseInsensitive,
                                                    java.lang.String path,
                                                    java.lang.String pathSeparator)
Get the first matched object from children of parameter testObject.

Parameters:
testObject - A tree object from which we search a mathced object.
caseInsensitive - If true, use String.equalsIgnoreCase() to match text.
path - A string like "a->b->c"
pathSeparator - A stirng like "->", which is used to separate node text.
Returns: