com.appperfect.devcommon.script.javaelement
Interface JavaComponent

All Superinterfaces:
IScript
All Known Subinterfaces:
AwtButton, AwtCanvas, AwtCheckbox, AwtCheckboxMenuItem, AwtComboBox, AwtComponent, AwtContainer, AwtDialog, AwtFileDialog, AwtFrame, AwtLabel, AwtList, AwtMenuItem, AwtPanel, AwtScrollbar, AwtScrollPane, AwtTextArea, AwtTextComponent, AwtTextField, AwtWindow, SwingButton, SwingCheckbox, SwingCheckBoxMenuItem, SwingComboBox, SwingComponent, SwingDialog, SwingFileChooser, SwingFrame, SwingLabel, SwingList, SwingMenu, SwingMenuItem, SwingPanel, SwingPasswordField, SwingProgressBar, SwingRadioButtonMenuItem, SwingScrollBar, SwingSlider, SwingSpinner, SwingSplitPane, SwingTabbedPane, SwingTable, SwingTextArea, SwingTextComponent, SwingTextField, SwingToggleButton, SwingTree, SwingWindow

public interface JavaComponent
extends IScript

JavaComponent is created to represent any java component This is the base element for any Java element. Should be used for creating an element whose class name is known and corresponding element for same is not present in the standard elements list supported by default.

The following code fragment illustrates how to create an JavaComponent element for a java class component SampleTree.

 var element = engine.createJavaComponent(1, "SampleTree", 5);
 
where engine is object of IScriptEngine


Method Summary
 boolean activate()
 To activate or bring window to focus
 void addAttribute(java.lang.String sAttributeName, java.lang.String sAttributeValue, boolean bIgnore, boolean bValidate, java.lang.String testParameterName)
 Each Window or Java Element has a set of attributes, which are used to find the desired element during execution This method is used to add a attribute to the event
 void captureImage(java.lang.String imageFilePath, boolean overrideExisting)
 To capture the component's image
 boolean click(int x, int y)
 To simulate click on JavaComponent
 boolean close()
 To close window
 boolean dblClick(int x, int y)
 To simulate double click on JavaComponent
 boolean drag(int x, int y)
 To simulate drag on JavaComponent
 boolean drop(int x, int y)
 To simulate drop on JavaComponent
 java.lang.String getName()
 To get name of the component
 java.lang.String getText()
 To get text associated with this component, like title, label, button text etc.
 java.lang.String getToolTipText()
 To get tool tip text associated with this component
 boolean maximize()
 To maximise window
 boolean minimize()
 To minimise window to an icon
 boolean mouseMove(int x, int y)
 To simulate mouse move on JavaComponent
 boolean restore()
 To restore window to previous size
 boolean rightClick(int x, int y)
 To simulate right click on JavaComponent
 boolean set(java.lang.String text)
 To set text for this component, like title, label, button text etc.
 void setBreakPoint(boolean bBreakPoint)
 This method should be called to set a breakpoint before executing task.
 void setIgnored(boolean bIgnore)
 This method should be called to ignore a task during execution.
 void setImagePath(java.lang.String sImagePath)
 This is used to set the event's image path.
 boolean setName(java.lang.String name)
 To set name of the component
 void setThinkTime(int iThinkTime)
 Delay in seconds before the task is actually executed.
 void setTitle(java.lang.String sTitle)
 This method is used to set the element's title
 boolean type(java.lang.String keyBoardInput, boolean isAlphaNumeric)
 Types the specified string in the object
 
Methods inherited from interface com.appperfect.devcommon.script.IScript
getReasonForFailure, isIgnored, isTaskSuccessful, isTaskTimedOut, setReasonForFailure, setTaskSuccessful, setTaskTimedout, setTimeout
 

Method Detail

activate

boolean activate()
To activate or bring window to focus

Returns:
true if success, false otherwise

addAttribute

void addAttribute(java.lang.String sAttributeName,
                  java.lang.String sAttributeValue,
                  boolean bIgnore,
                  boolean bValidate,
                  java.lang.String testParameterName)
Each Window or Java Element has a set of attributes, which are used to find the desired element during execution This method is used to add a attribute to the event

Parameters:
sAttributeName - name of the attribute
sAttributeValue - value of the attribute
bIgnore - true if this attribute should be ignored; false otherwise.
bValidate - true if this attribute should be validated; false otherwise.
testParameterName - name of the TestParameter if the attribute value is parameterized

captureImage

void captureImage(java.lang.String imageFilePath,
                  boolean overrideExisting)
To capture the component's image

Parameters:
imageFilePath - file path where the image should be saved.
overrideExisting - to decide whether image should be overridden if it already exists.

click

boolean click(int x,
              int y)
To simulate click on JavaComponent

Parameters:
x - x coordinate relative to component's client rect
y - y coordinate relative to component's client rect
Returns:
true if success, false otherwise

close

boolean close()
To close window

Returns:
true if success, false otherwise

dblClick

boolean dblClick(int x,
                 int y)
To simulate double click on JavaComponent

Parameters:
x - x coordinate relative to component's client rect
y - y coordinate relative to component's client rect
Returns:
true if success, false otherwise

drag

boolean drag(int x,
             int y)
To simulate drag on JavaComponent

Parameters:
x - x coordinate relative to component's client rect
y - y coordinate relative to component's client rect
Returns:
true if success, false otherwise

drop

boolean drop(int x,
             int y)
To simulate drop on JavaComponent

Parameters:
x - x coordinate relative to component's client rect
y - y coordinate relative to component's client rect
Returns:
true if success, false otherwise

getName

java.lang.String getName()
To get name of the component

Returns:
name of the component

getText

java.lang.String getText()
To get text associated with this component, like title, label, button text etc.

Returns:
text associated with the component

getToolTipText

java.lang.String getToolTipText()
To get tool tip text associated with this component

Returns:
tool tip text associated with the component

maximize

boolean maximize()
To maximise window

Returns:
true if success, false otherwise

minimize

boolean minimize()
To minimise window to an icon

Returns:
true if success, false otherwise

mouseMove

boolean mouseMove(int x,
                  int y)
To simulate mouse move on JavaComponent

Parameters:
x - x coordinate relative to component's client rect
y - y coordinate relative to component's client rect
Returns:
true if success, false otherwise

restore

boolean restore()
To restore window to previous size

Returns:
true if success, false otherwise

rightClick

boolean rightClick(int x,
                   int y)
To simulate right click on JavaComponent

Parameters:
x - x coordinate relative to component's client rect
y - y coordinate relative to component's client rect
Returns:
true if success, false otherwise

set

boolean set(java.lang.String text)
To set text for this component, like title, label, button text etc.

Returns:
true if success, false otherwise

setBreakPoint

void setBreakPoint(boolean bBreakPoint)
This method should be called to set a breakpoint before executing task. In case breakpoint is set, test will wait for user's interruption before moving forward.

Parameters:
bBreakPoint - true if breakpoint should be set; false otherwise.

setIgnored

void setIgnored(boolean bIgnore)
This method should be called to ignore a task during execution.

Specified by:
setIgnored in interface IScript
Parameters:
bIgnore - true if this task should be executed; false otherwise.

setImagePath

void setImagePath(java.lang.String sImagePath)
This is used to set the event's image path.

Parameters:
sImagePath - file path of the event's image saved on disk.

setName

boolean setName(java.lang.String name)
To set name of the component

Returns:
true if success, false otherwise

setThinkTime

void setThinkTime(int iThinkTime)
Delay in seconds before the task is actually executed.

Specified by:
setThinkTime in interface IScript
Parameters:
iThinkTime - no of seconds the engine waits before the task is actually executed.

setTitle

void setTitle(java.lang.String sTitle)
This method is used to set the element's title

Parameters:
sTitle - title of the element

type

boolean type(java.lang.String keyBoardInput,
             boolean isAlphaNumeric)
Types the specified string in the object

Parameters:
keyBoardInput - A String value. The text string to type.
isAlphaNumeric - is true if text string represents a alphanumeric key, false otherwise
Returns:
true if success, false otherwise


Copyright © 2003-2011 AppPerfect Corporation. All Rights Reserved.