|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.safs.Processor
org.safs.ComponentFunction
org.safs.rational.CFComponent
public class CFComponent
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.
| 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 |
| 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 java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String CLICK
public static final java.lang.String DOUBLECLICK
public static final java.lang.String RIGHTCLICK
public static final java.lang.String CTRLCLICK
public static final java.lang.String CTRLRIGHTCLICK
public static final java.lang.String SHIFTCLICK
public static final java.lang.String COMPONENTCLICK
public static final java.lang.String MOUSECLICK
public static final java.lang.String HOVERMOUSE
public static final java.lang.String CLOSEWINDOW
public static final java.lang.String RESTORE
public static final java.lang.String MINIMIZE
public static final java.lang.String MAXIMIZE
public static final java.lang.String WAITFORGUI
public static final java.lang.String VERIFYPROPERTY
public static final java.lang.String VERIFYPROPERTYCONTAINS
public static final java.lang.String VERIFYVALUES
public static final java.lang.String VERIFYVALUESIGNORECASE
public static final java.lang.String VERIFYVALUEEQUALS
public static final java.lang.String VERIFYVALUECONTAINS
public static final java.lang.String ASSIGNPROPERTYVARIABLE
public static final java.lang.String INPUTKEYS
public static final java.lang.String INPUTCHARACTERS
public static final java.lang.String CAPTUREOBJECTDATATOFILE
public static final java.lang.String CAPTUREPROPERTIESTOFILE
public static final java.lang.String ISPROPERTYEXIST
public static final java.lang.String VERIFYOBJECTDATATOFILE
public static final java.lang.String VERIFYTEXTFILETOFILE
public static final java.lang.String VERIFYFILETOFILE
public static final java.lang.String VERIFYGUIIMAGETOFILE
public static final java.lang.String CLEARAPPMAPCACHE
public static final java.lang.String GETGUIIMAGE
public static final java.lang.String GUIDOESEXIST
public static final java.lang.String GUIDOESNOTEXIST
public static final java.lang.String VERIFYPROPERTYTOFILE
public static final java.lang.String VERIFYARRAYPROPERTYTOFILE
public static final java.lang.String VERIFYBINARYFILETOFILE
public static final java.lang.String VERIFYCLIPBOARDTOFILE
public static final java.lang.String SETPROPERTYVALUE
public static final java.lang.String HSCROLLTO
public static final java.lang.String VSCROLLTO
public static final java.lang.String SELECTMENUITEM
public static final java.lang.String SELECTMENUITEMCONTAINS
public static final java.lang.String VERIFYMENUITEM
public static final java.lang.String VERIFYMENUITEMCONTAINS
public static final java.lang.String SETPOSITION
public static final java.lang.String LEFTDRAG
public static final java.lang.String RIGHTDRAG
public static final java.lang.String CAPTUREPROPERTYTOFILE
public static final java.lang.String SENDEVENT
public static final java.lang.String GETTEXTFROMGUI
public static final java.lang.String SAVETEXTFROMGUI
public static final java.lang.String SHIFTLEFTDRAG
public static final java.lang.String CTRLSHIFTLEFTDRAG
public static final java.lang.String CTRLLEFTDRAG
public static final java.lang.String ALTLEFTDRAG
public static final java.lang.String CTRLALTLEFTDRAG
public static final java.lang.String LOCATESCREENIMAGE
public static final java.lang.String WIN_NORMAL
public static final java.lang.String WIN_MINIMIZED
public static final java.lang.String WIN_MAXIMIZED
protected Script script
protected TestObject obj1
protected boolean keepEncodingConsistent
| Constructor Detail |
|---|
public CFComponent()
| Method Detail |
|---|
public void setKeepEncodingConsistent()
public boolean getKeepEncodingConsistent()
protected void getHelpers()
throws SAFSException
ComponentFunction
getHelpers in class ComponentFunctionSAFSExceptionpublic void process()
process in class Processorprotected void localProcess()
protected java.lang.Object parseWhereInfo(java.lang.String whereinfo)
Supported formats of whereinfo:
whereinfo - String usually retrieved from the test table.
protected void sendFlexEvent()
protected void sendEvent()
throws SAFSException
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.
SAFSException
protected void selectMenuItem(boolean fuzzy)
throws SAFSException
fuzzy, - false: select the menu item that exactly matches the gaven path
SAFSException
protected void verifyMenuItem(boolean fuzzy)
throws SAFSException
fuzzy, - to do exactly match if false, otherwise do fuzzy match
SAFSException
protected void setPosition()
throws SAFSException
SAFSException
protected void preformDrag()
throws SAFSException
SAFSException
protected java.lang.String matchedPathOfMenuItem(GuiTestObject guiObj,
java.lang.String path,
boolean fuzzy,
java.lang.String status)
throws SAFSException
SAFSExceptionprotected TestObject[] findMenuBars(TestObject guiObj)
guiObj - A test object represents an application window from which
we try to get menu bars.
protected void componentClick()
protected void performClick(java.lang.Object point)
point - java.awt.Point x,y coords relative to the component or null.
protected void mouseClick(GuiTestObject gto,
java.awt.Point clickPoint)
gto - - GuiTestObjectclickPoint - - Point as location, default center
protected java.lang.Object getObjectPropertyFromProperties(TestObject o,
java.lang.String prop)
o - - TestObject to get property fromprop - - property to seek
protected java.lang.Object getObjectProperty(TestObject o,
java.lang.String prop)
throws PropertyNotFoundException
o - - TestObject to get property fromprop - - property to seek, can be an indexed property like rowLabel(0)
PropertyNotFoundException
protected java.lang.String convertObjectValueToString(java.lang.Object value)
throws SAFSException
value - String or TestObject to get the text from
SAFSExceptionRGuiObjectRecognition.getText(TestObject)
protected java.util.List captureObjectData(TestObject table)
throws java.lang.IllegalArgumentException,
SAFSException
table - TestObject to snapshot data from.
SAFSException
java.lang.IllegalArgumentException - if table is not an acceptable TestObject.
protected java.lang.String formatObjectData(java.util.List list)
throws java.lang.IllegalArgumentException
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.
list - List returned from captureObjectData
java.lang.IllegalArgumentException - if the List or the Object extracted from the List are null.captureObjectData(TestObject)
protected void captureObjectDataToFile()
throws SAFSException
SAFSExceptioncaptureObjectData(TestObject),
formatObjectData(java.util.List)protected java.awt.Rectangle getComponentRectangle()
getComponentRectangle in class ComponentFunction
protected void action_GetSaveTextFromGUI()
throws SAFSException
SAFSExceptionprotected void locateScreenImage()
protected void listAllProperties(TestObject obj)
obj, - TestObject
protected void listAllProperties(TestObject obj,
java.lang.String str)
obj, - TestObjectstr, - String, used in the header of the listprotected void listProperties(TestObject obj)
obj, - TestObjectprotected void listNonValueProperties(TestObject obj)
obj, - TestObjectprotected void listMethods(TestObject obj)
obj, - TestObject
protected Tree extractTreeItemsSub(java.lang.Object nitem)
throws SAFSException
nitem, - TestObject, the next item
SAFSException
protected Tree tobj(TestObject nitem)
throws java.lang.Exception
obj, - Object (actually of type GuiSubitemTestObject)
java.lang.Exception
protected java.lang.Object getUserObject(java.lang.Object obj,
java.lang.Integer level)
obj, - Object objlevel, - Integer
protected boolean isSWTWidget(TestObject theobj)
theobj, - TestObject reference to GUI component
protected java.awt.Point checkForCoord(java.util.Iterator iterator)
iterator, - Iterator
protected java.awt.Point checkForCoord(java.lang.String coord)
coord, - String. is either an appmap ref, or x;y notation
protected TopLevelTestObject getAppletsBrowser(GuiTestObject guiObj)
GuiTestObject - component assumed to be inside a browser applet.
protected static boolean isJavaDomain(TestObject tobj)
protected static boolean isDotnetDomain(TestObject tobj)
protected static boolean isHtmlDomain(TestObject tobj)
protected static boolean isWinDomain(TestObject tobj)
protected static boolean isSwtDomain(TestObject tobj)
protected static boolean isFlexDomain(TestObject tobj)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||