String action = returnMap.get("action").toString();
if (action.equals("onmouseup")) {
Robot robot = new Robot();
//VirtualScreenBean
// Integer x = Math.round ( ( ( Float.valueOf(returnMap.get("x").toString()).floatValue() *VirtualScreenBean.vScreenResizeX )/VirtualScreenBean.vScreenSpinnerWidth) / Ampl_factor) ;
// Integer y = Math.round ( ( ( Float.valueOf(returnMap.get("y").toString()).floatValue() *VirtualScreenBean.vScreenResizeY )/VirtualScreenBean.vScreenSpinnerHeight)/ Ampl_factor) ;
//
//logger.debug("x 1 "+returnMap.get("x"));
Float scaleFactor = Float.valueOf(VirtualScreenBean.vScreenSpinnerWidth) / Float.valueOf(VirtualScreenBean.vScreenResizeX);
//logger.debug("x 1 scaleFactor "+scaleFactor);
Float part_x1 = ( ( Float.valueOf(returnMap.get("x").toString()).floatValue() * scaleFactor ) / Float.valueOf(Ampl_factor) );
//logger.debug("x 1 part_x1 "+part_x1);
Integer x = Math.round ( part_x1 + VirtualScreenBean.vScreenSpinnerX );
Integer y = Math.round ( ( ( Float.valueOf(returnMap.get("y").toString()).floatValue() * VirtualScreenBean.vScreenSpinnerHeight / VirtualScreenBean.vScreenResizeY) / Ampl_factor) + VirtualScreenBean.vScreenSpinnerY) ;
//logger.debug("x|y "+x+" || "+y);
robot.mouseMove(x, y);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
} else if (action.equals("onmousedown")) {
Robot robot = new Robot();
Float scaleFactor = Float.valueOf(VirtualScreenBean.vScreenSpinnerWidth) / Float.valueOf(VirtualScreenBean.vScreenResizeX);
Float part_x1 = ( ( Float.valueOf(returnMap.get("x").toString()).floatValue() * scaleFactor ) / Float.valueOf(Ampl_factor) );
Integer x = Math.round ( part_x1 + VirtualScreenBean.vScreenSpinnerX );
Integer y = Math.round ( ( ( Float.valueOf(returnMap.get("y").toString()).floatValue() * VirtualScreenBean.vScreenSpinnerHeight / VirtualScreenBean.vScreenResizeY) / Ampl_factor) + VirtualScreenBean.vScreenSpinnerY) ;
robot.mouseMove(x, y);
robot.mousePress(InputEvent.BUTTON1_MASK);
} else if (action.equals("mousePos")) {
Robot robot = new Robot();
Float scaleFactor = Float.valueOf(VirtualScreenBean.vScreenSpinnerWidth) / Float.valueOf(VirtualScreenBean.vScreenResizeX);
Float part_x1 = ( ( Float.valueOf(returnMap.get("x").toString()).floatValue() * scaleFactor ) / Float.valueOf(Ampl_factor) );
Integer x = Math.round ( part_x1 + VirtualScreenBean.vScreenSpinnerX );
Integer y = Math.round ( ( ( Float.valueOf(returnMap.get("y").toString()).floatValue() * VirtualScreenBean.vScreenSpinnerHeight / VirtualScreenBean.vScreenResizeY) / Ampl_factor) + VirtualScreenBean.vScreenSpinnerY) ;
robot.mouseMove(x, y);
} else if (action.equals("onkeydown")) {
Robot robot = new Robot();
Integer key = Integer.valueOf(returnMap.get("k").toString()).intValue();
//logger.debug("key onkeydown -1 "+key);
boolean doAction = true;
if (key == 221) {
key = 61;
} else if (key == -1) {
String charValue = returnMap.get("c").toString();
//key = KeyEvent.VK_ADD;
doAction = false;
for (Iterator<Integer> iter = this.currentPressedKeys.keySet().iterator();iter.hasNext();) {
Integer storedKey = iter.next();
robot.keyRelease(storedKey);
}
this.currentPressedKeys = new HashMap<Integer,Boolean>();
this.pressSpecialSign(charValue, robot);
} else if (key == 188) {
key = 44;
} else if (key == 189) {
key = 109;
} else if (key == 190) {
key = 46;
} else if (key == 191) {
key = 47;
}
//logger.debug("key onkeydown -2 "+key);
if (doAction) {
this.currentPressedKeys.put(key, true);
robot.keyPress(key);
}
} else if (action.equals("onkeyup")) {
Robot robot = new Robot();
Integer key = Integer.valueOf(returnMap.get("k").toString()).intValue();
//logger.debug("key onkeyup 1- "+key);
boolean doAction = true;
if (key == 221) {
key = 61;
} else if (key == -1) {
doAction = false;
} else if (key == 188) {
key = 44;
} else if (key == 189) {
key = 109;
} else if (key == 190) {
key = 46;
} else if (key == 191) {
key = 47;
}
//logger.debug("key onkeyup 2- "+key);
if (doAction) {
if (this.currentPressedKeys.containsKey(key)) {
this.currentPressedKeys.remove(key);
robot.keyRelease(key);
}
}
} else if (action.equals("paste")) {
Robot robot = new Robot();
String paste = returnMap.get("paste").toString();
this.pressSpecialSign(paste, robot);
} else if (action.equals("copy")) {
Robot robot = new Robot();
String paste = this.getHighlightedText(robot);
HashMap<Integer,String> map = new HashMap<Integer,String>();
map.put(0,"copiedText");
map.put(1,paste);
String clientId = returnMap.get("clientId").toString();
//public synchronized int sendMessageWithClientById(Object newMessage, String clientId)
invoke("sendMessageWithClientById",new Object[] { map, clientId }, this);
} else if (action.equals("show")) {
Robot robot = new Robot();
String paste = this.getClipboardText();
HashMap<Integer,String> map = new HashMap<Integer,String>();
map.put(0,"copiedText");