|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
util.PropertyResources
util.PropertyBundles
jview.RobotChoreography
public class RobotChoreography
This class mimicks a user on the mouse.
| Nested Class Summary | |
|---|---|
private class |
RobotChoreography.MouseRobot
Starts the robot in its own thread. |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
private Map<Rectangle,Double> |
allowed
This is the list of allowed regions. |
private boolean |
automatic
If true, we are in automatic control. |
private boolean |
cancel
I spotted mouse movements somewhere within a command and should stop. |
static String |
CLICK
|
static String |
COLON
|
private static int |
DEFCLICKDELAY
|
private static long |
DEFIDLETIMEOUT
|
private static int |
DEFMOVEDELAY
|
static String |
DELAY
|
private List<String> |
exe
The list of commands to execute. |
private Map<Rectangle,Double> |
forbidden
This is the list of forbidden regions. |
static String |
KEY_ALLOWEDAREAS
The mouse may move within these areas only. |
static String |
KEY_CLICKDELAY
The mouse-idle timeout until automatic action occurs. |
static String |
KEY_FORBIDDENAREAS
The mouse may move anywhere, except in these areas. |
static String |
KEY_IDLETIMEOUT
The mouse-idle timeout until automatic action occurs. |
static String |
KEY_MOVEDELAY
The mouse-idle timeout until automatic action occurs. |
static String |
KEY_NIGHTTIME
In these hours, if set, we do not perform mouse movements, we go idle. |
static String |
KEY_WEEKEND
On these days, if set, we do not perform mouse movements, we go idle. |
private Point |
last
Last mouse position during checks if we should grab control. |
private RobotChoreography.MouseRobot |
mimic
The thread the mimic user input. |
static String |
MOVEIN
|
static String |
MOVERND
|
static String |
MOVETO
|
static String |
OFFSET
|
static String |
PIPE
|
static String |
PRESS
|
static String |
RELEASE
|
private Robot |
robot
Robot for mouse movements. |
private Dimension |
screen
The dimension of the screen |
static String |
WHEEL
|
| Fields inherited from class util.PropertyBundles |
|---|
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES |
| Fields inherited from class util.PropertyResources |
|---|
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset |
| Fields inherited from class util.PropertyContainer |
|---|
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR |
| Fields inherited from interface util.ResourceSupplying |
|---|
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME |
| Fields inherited from interface util.PropertySupplying |
|---|
CONFIG, KEY_CLASS |
| Constructor Summary | |
|---|---|
RobotChoreography(Map<String,String> prop)
|
|
| Method Summary | |
|---|---|
boolean |
checkIdle()
We check the current time against weekend and nighttime. |
boolean |
command(String tag)
Executes a single robot command. |
void |
componentHidden(ComponentEvent e)
|
void |
componentMoved(ComponentEvent e)
|
void |
componentResized(ComponentEvent e)
|
void |
componentShown(ComponentEvent e)
|
boolean |
equals(Object o)
We are equal to another robot if we serve the same sequence in the same region. |
private boolean |
executeSequence(List<String> sequence)
|
private int |
getButtonMask(String par)
|
Point |
getRandomOffset(int distance)
Generates a random offset from the current mouse position. |
Point |
getRandomPosition()
Generates a random position that is allowed. |
Point |
getRandomPositionInAllowed(Rectangle r)
Generates a random position within the specified allowed region. |
long |
getRefreshInterval()
Returns the period in milliseconds of the refresh intervall. |
int |
hashCode()
Returns a hash code. |
void |
init()
We initialize the areas that are allowed. |
boolean |
isAllowed(Point p)
Tests, if the specified point is allowed. |
boolean |
isFixedRate()
Returns true if fixed rate scheduling is desired, otherwise fixed delay is assumed. |
boolean |
isWithin(Map<Rectangle,Double> recs,
Point p)
Test, if the point is in any of the rectangle list. |
static void |
main(String[] arg)
We install a robot. |
private boolean |
mouseMove(Point xy)
Moves the mouse from the current location to the specified one. |
private Map<Rectangle,Double> |
parseRectangle(String pipes)
Parses rectangles, sparated by a pipe. |
void |
refresh()
The method that should be invoked on refresh. |
void |
setSequence(List<String> sequence)
Sets the sequence to be executed. |
void |
setSequence(String elements)
Executes a robot sequence. |
private boolean |
shouldStop(Point was)
We should stop if the current mouse pointer is not at the same position as before. |
| Methods inherited from class util.PropertyBundles |
|---|
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource |
| Methods inherited from class util.PropertyResources |
|---|
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet |
| Methods inherited from class util.PropertyContainer |
|---|
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface util.ResourceSupplying |
|---|
getResource, getResourceAsStream, getResources |
| Methods inherited from interface util.PropertySupplying |
|---|
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties |
| Field Detail |
|---|
public static final String COLON
public static final String PIPE
public static final String MOVETO
public static final String MOVEIN
public static final String OFFSET
public static final String MOVERND
public static final String PRESS
public static final String RELEASE
public static final String DELAY
public static final String CLICK
public static final String WHEEL
public static final String KEY_ALLOWEDAREAS
public static final String KEY_FORBIDDENAREAS
public static final String KEY_CLICKDELAY
public static final String KEY_IDLETIMEOUT
public static final String KEY_MOVEDELAY
public static final String KEY_WEEKEND
public static final String KEY_NIGHTTIME
private static final int DEFCLICKDELAY
private static final int DEFMOVEDELAY
private static final long DEFIDLETIMEOUT
private List<String> exe
private Map<Rectangle,Double> allowed
private Map<Rectangle,Double> forbidden
private Dimension screen
private boolean automatic
private RobotChoreography.MouseRobot mimic
private Robot robot
private Point last
private boolean cancel
| Constructor Detail |
|---|
public RobotChoreography(Map<String,String> prop)
| Method Detail |
|---|
public void init()
init in interface Initializableinit in class PropertyResourcespublic void componentHidden(ComponentEvent e)
componentHidden in interface ComponentListenerpublic void componentMoved(ComponentEvent e)
componentMoved in interface ComponentListenerpublic void componentResized(ComponentEvent e)
componentResized in interface ComponentListenerpublic void componentShown(ComponentEvent e)
componentShown in interface ComponentListenerpublic boolean isFixedRate()
Refreshing
isFixedRate in interface RefreshingTimerpublic long getRefreshInterval()
Refreshing
getRefreshInterval in interface Refreshingpublic void refresh()
Refreshing
refresh in interface Refreshingpublic boolean isAllowed(Point p)
public boolean isWithin(Map<Rectangle,Double> recs,
Point p)
public Point getRandomPosition()
public Point getRandomOffset(int distance)
public Point getRandomPositionInAllowed(Rectangle r)
public void setSequence(String elements)
public void setSequence(List<String> sequence)
public int hashCode()
hashCode in class Objectpublic boolean equals(Object o)
equals in class Objectprivate boolean executeSequence(List<String> sequence)
public boolean command(String tag)
private boolean mouseMove(Point xy)
private Map<Rectangle,Double> parseRectangle(String pipes)
private int getButtonMask(String par)
private boolean shouldStop(Point was)
public boolean checkIdle()
public static void main(String[] arg)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||