de.cbse.jeasy
Class JEAutomation

java.lang.Object
  extended by java.awt.Robot
      extended by de.cbse.jeasy.JEAutomation
All Implemented Interfaces:
java.lang.Runnable

public class JEAutomation
extends java.awt.Robot
implements java.lang.Runnable

The JEAutomation offers a script interface for the java robot class in XML format.

For more informations see the Robot class of the jdk. Example:

<?xml version='1.0' ?> 
 <jeasy> 
 <automationScript id="test1">
 <automation method="setDelayFactor" param1="1"/>
 <automation method="smoothMouse" param1="true"/>
 <automation method="mouseMove" param1="RB_Radio1"/> 
 <automation method="mouseClickLeft"/> 
 <automation method="mouseMove" param1="BT_Button"/> 
 <automation method="mouseClickLeft"/> 
 <automation method="mouseMove" param1="DF_Datafield"/> 
 <automation method="mouseClickLeft"/> 
 <automation method="typeString" param1="azAZ1234567890"/> 
 <automation method="setValue" param1="DF_Datafield" param2="azAZ1234567890"/> 
 <automation method="mouseMove" param1="CB_Combobox"/> 
 <automation method="mouseClickLeft"/> 
 <methodinvocation> 
 <id>MC_DB_Country1</id> 
 <JEObject>CB_Combobox</JEObject> 
 <method>setSelectedIndex(int)</method>
 <param1Class>int</param1Class> 
 <param1Value>5</param1Value>
 </methodinvocation>
 </automationScript> 
 </jeasy>
The following methods are defined in JEasy script language: The script understands the XML tag methodinvocation. This syntax enables to invoke each object method defined in jeasy classes.

Version:
%I%, %G%
Author:
Harry Pfohl

Field Summary
(package private)  JENode automate
           
(package private)  java.io.BufferedReader br
           
(package private)  java.lang.Object caller
           
(package private)  java.awt.Component co
           
(package private)  int delayFactor
           
(package private)  int mousex
           
(package private)  int mousey
           
(package private)  java.awt.Point p
           
(package private)  java.awt.Robot robot
           
(package private)  javax.swing.JRootPane rootPane
           
(package private)  boolean smoothMouse
           
 
Constructor Summary
JEAutomation()
           
JEAutomation(java.lang.Object caller)
           
 
Method Summary
 void automate(java.lang.String xmlAutomate)
          Call this method directly to perform the automation not using a thread.
 void automateAsThread(JENode xmlAutomate)
          Performs one XML automation tag as a thread Example: <automation method="mouseMove" param1="RB_Radio1"/>
 void doXMLScript(java.io.BufferedReader din)
          Reads the automation tags out of the BufferedReader and performs them.
 void mouseClickLeft()
          Presses and releases the left mouse button with an delay of 300 ms.
 void mouseClickRight()
          Presses and releases the righ mouse button with an delay of 300 ms.
 void mouseMove(int fromx, int fromy, int tox, int toy)
          Moves the mouse smoothly.
 void mouseMove(java.lang.String JEObjectId)
          Move the mouse to the middle of the JEasy object.
 void mouseMove(java.lang.String JEObjectId, int row, int col)
          Move the mouse to the table to row and column.
 void mouseMove(java.lang.String JEObjectId, int colLookUp, java.lang.String search, int column)
          Move the mouse to the table to row (where saerch is found in col colLookUp) and column.
 void run()
          Call this method directly to perform the automation not as a thread.
 void setDelayFactor(int delayFact)
          A value between 1 and 10 which is a multiplier of 10 ms for the autoDelay()
 void setValue(java.lang.String JEObjectId, java.lang.String text)
          Sets the text of a jeasy input component.
 void typeString(java.lang.String s)
          Generates keyPress and KeyRelease events related to the given string.
 
Methods inherited from class java.awt.Robot
createScreenCapture, delay, getAutoDelay, getPixelColor, isAutoWaitForIdle, keyPress, keyRelease, mouseMove, mousePress, mouseRelease, mouseWheel, setAutoDelay, setAutoWaitForIdle, toString, waitForIdle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

robot

java.awt.Robot robot

p

java.awt.Point p

automate

JENode automate

br

java.io.BufferedReader br

delayFactor

int delayFactor

mousex

int mousex

mousey

int mousey

smoothMouse

boolean smoothMouse

caller

java.lang.Object caller

rootPane

javax.swing.JRootPane rootPane

co

java.awt.Component co
Constructor Detail

JEAutomation

public JEAutomation()
             throws java.awt.AWTException
Throws:
java.awt.AWTException

JEAutomation

public JEAutomation(java.lang.Object caller)
             throws java.awt.AWTException
Throws:
java.awt.AWTException
Method Detail

automateAsThread

public void automateAsThread(JENode xmlAutomate)
Performs one XML automation tag as a thread Example: <automation method="mouseMove" param1="RB_Radio1"/>

Parameters:
s - XML String
See Also:
JE#PropertyString

run

public void run()
Call this method directly to perform the automation not as a thread. The method will return after finishing the automation methods. You have to set the XML String or the Buffered Reader first

Specified by:
run in interface java.lang.Runnable

automate

public void automate(java.lang.String xmlAutomate)
              throws java.io.IOException
Call this method directly to perform the automation not using a thread. The method will return after finishing the automation methods The XMLString should be in the form <automation method="methodname" param1="param"/>

Throws:
java.io.IOException

mouseClickLeft

public void mouseClickLeft()
Presses and releases the left mouse button with an delay of 300 ms.


mouseClickRight

public void mouseClickRight()
Presses and releases the righ mouse button with an delay of 300 ms.


setDelayFactor

public void setDelayFactor(int delayFact)
A value between 1 and 10 which is a multiplier of 10 ms for the autoDelay()


doXMLScript

public void doXMLScript(java.io.BufferedReader din)
                 throws java.io.IOException
Reads the automation tags out of the BufferedReader and performs them. The method returns after finishing the script.

Throws:
java.io.IOException

mouseMove

public void mouseMove(java.lang.String JEObjectId)
Move the mouse to the middle of the JEasy object. The method returns at once.


mouseMove

public void mouseMove(java.lang.String JEObjectId,
                      int row,
                      int col)
Move the mouse to the table to row and column. The method returns at once.


mouseMove

public void mouseMove(java.lang.String JEObjectId,
                      int colLookUp,
                      java.lang.String search,
                      int column)
Move the mouse to the table to row (where saerch is found in col colLookUp) and column. The method returns at once.

Parameters:
JEObjectId -
colLookUp -
search -
col -

mouseMove

public void mouseMove(int fromx,
                      int fromy,
                      int tox,
                      int toy)
Moves the mouse smoothly.


setValue

public void setValue(java.lang.String JEObjectId,
                     java.lang.String text)
Sets the text of a jeasy input component.


typeString

public void typeString(java.lang.String s)
Generates keyPress and KeyRelease events related to the given string.