Package org.netbeans.jemmy.drivers

Examples of org.netbeans.jemmy.drivers.KeyDriver


  DriverManager.getKeyDriver(oper).releaseKey(oper, KeyEvent.VK_SHIFT, 0);
    }
    public void clearText(ComponentOperator oper) {
  DriverManager.getFocusDriver(oper).giveFocus(oper);
  checkSupported(oper);
  KeyDriver kdriver = DriverManager.getKeyDriver(oper);
  Timeout pushTime = oper.getTimeouts().create("ComponentOperator.PushKeyTimeout");
  Timeout betweenTime = getBetweenTimeout(oper);
  while(getCaretPosition(oper) > 0) {
      kdriver.typeKey(oper, KeyEvent.VK_BACK_SPACE, (char)KeyEvent.VK_BACK_SPACE, 0, pushTime);
      betweenTime.sleep();
  }
  while(getText(oper).length() > 0) {
      kdriver.pushKey(oper, KeyEvent.VK_DELETE, 0, pushTime);
      betweenTime.sleep();
  }
    }
View Full Code Here


      betweenTime.sleep();
  }
    }
    public void typeText(ComponentOperator oper, String text, int caretPosition) {
  changeCaretPosition(oper, caretPosition);
  KeyDriver kDriver = DriverManager.getKeyDriver(oper);
  CharBindingMap map = oper.getCharBindingMap();
  Timeout pushTime = oper.getTimeouts().create("ComponentOperator.PushKeyTimeout");
  Timeout betweenTime = getBetweenTimeout(oper);
  char[] crs = text.toCharArray();
  for(int i = 0; i < crs.length; i++) {
      kDriver.typeKey(oper, map.getCharKey(crs[i]), crs[i], map.getCharModifiers(crs[i]), pushTime);
      betweenTime.sleep();
  }
    }
View Full Code Here

    }
    public void clearText(ComponentOperator oper) {
  if(oper instanceof JTextAreaOperator ||
     oper instanceof JEditorPaneOperator) {
      DriverManager.getFocusDriver(oper).giveFocus(oper);
      KeyDriver kdriver = DriverManager.getKeyDriver(oper);
      selectText(oper, 0, getText(oper).length());
      kdriver.pushKey(oper, KeyEvent.VK_DELETE, 0,
          oper.getTimeouts().create("ComponentOperator.PushKeyTimeout"));
  } else {
      super.clearText(oper);
  }
    }
View Full Code Here

        Point pointToClick = getClickPoint(oper);
  DriverManager.getMouseDriver(oper).
      clickMouse(oper, pointToClick.x, pointToClick.y,
           1, oper.getDefaultMouseButton(), 0,
           oper.getTimeouts().create("ComponentOperator.MouseClickTimeout"));
  KeyDriver kdriver = DriverManager.getKeyDriver(oper);
  Timeout pushTimeout = oper.getTimeouts().create("ComponentOperator.PushKeyTimeout");
        if(System.getProperty("java.specification.version").compareTo("1.3") > 0) {
            while(coper.getSelectedIndex() != index) {
                kdriver.pushKey(oper, (index > coper.getSelectedIndex()) ? KeyEvent.VK_DOWN : KeyEvent.VK_UP, 0, pushTimeout);
            }
        } else {
            int current = ((ChoiceOperator)oper).getSelectedIndex();
            int diff = 0;
            int key = 0;
            if(index > current) {
                diff = index - current;
                key = KeyEvent.VK_DOWN;
            } else {
                diff = current - index;
                key = KeyEvent.VK_UP;
            }
            for(int i = 0; i < diff; i++) {
                kdriver.pushKey(oper, key, 0, pushTimeout);
            }
        }
        kdriver.pushKey(oper, KeyEvent.VK_ENTER, 0, pushTimeout);
    }
View Full Code Here

  ListOperator loper = (ListOperator)oper;
  if(loper.isMultipleMode()) {
      super.selectItem(loper, index);
  }
  DriverManager.getFocusDriver(oper).giveFocus(oper);
  KeyDriver   kDriver = DriverManager.getKeyDriver(oper);
  int current = loper.getSelectedIndex();
  int diff = 0;
  int key = 0;
  if(index > current) {
      diff = index - current;
      key = KeyEvent.VK_DOWN;
  } else {
      diff = current - index;
      key = KeyEvent.VK_UP;
  }
  Timeout pushTime = oper.getTimeouts().create("ComponentOperator.PushKeyTimeout");
  for(int i = 0; i < diff; i++) {
      kDriver.pushKey(oper, key, 0, pushTime);
  }
  kDriver.pushKey(oper, KeyEvent.VK_ENTER, 0, pushTime);
    }
View Full Code Here

  DriverManager.getKeyDriver(oper).releaseKey(oper, KeyEvent.VK_SHIFT, 0);
    }
    public void clearText(ComponentOperator oper) {
  DriverManager.getFocusDriver(oper).giveFocus(oper);
  checkSupported(oper);
  KeyDriver kdriver = DriverManager.getKeyDriver(oper);
  Timeout pushTime = oper.getTimeouts().create("ComponentOperator.PushKeyTimeout");
  Timeout betweenTime = getBetweenTimeout(oper);
  while(getCaretPosition(oper) > 0) {
      kdriver.typeKey(oper, KeyEvent.VK_BACK_SPACE, (char)KeyEvent.VK_BACK_SPACE, 0, pushTime);
      betweenTime.sleep();
  }
  while(getText(oper).length() > 0) {
      kdriver.pushKey(oper, KeyEvent.VK_DELETE, 0, pushTime);
      betweenTime.sleep();
  }
    }
View Full Code Here

      betweenTime.sleep();
  }
    }
    public void typeText(ComponentOperator oper, String text, int caretPosition) {
  changeCaretPosition(oper, caretPosition);
  KeyDriver kDriver = DriverManager.getKeyDriver(oper);
  CharBindingMap map = oper.getCharBindingMap();
  Timeout pushTime = oper.getTimeouts().create("ComponentOperator.PushKeyTimeout");
  Timeout betweenTime = getBetweenTimeout(oper);
  char[] crs = text.toCharArray();
  for(int i = 0; i < crs.length; i++) {
      kDriver.typeKey(oper, map.getCharKey(crs[i]), crs[i], map.getCharModifiers(crs[i]), pushTime);
      betweenTime.sleep();
  }
    }
View Full Code Here

        Point pointToClick = getClickPoint(oper);
  DriverManager.getMouseDriver(oper).
      clickMouse(oper, pointToClick.x, pointToClick.y,
           1, oper.getDefaultMouseButton(), 0,
           oper.getTimeouts().create("ComponentOperator.MouseClickTimeout"));
  KeyDriver kdriver = DriverManager.getKeyDriver(oper);
  Timeout pushTimeout = oper.getTimeouts().create("ComponentOperator.PushKeyTimeout");
        if(System.getProperty("java.specification.version").compareTo("1.3") > 0) {
            while(coper.getSelectedIndex() != index) {
                kdriver.pushKey(oper, (index > coper.getSelectedIndex()) ? KeyEvent.VK_DOWN : KeyEvent.VK_UP, 0, pushTimeout);
            }
        } else {
            int current = ((ChoiceOperator)oper).getSelectedIndex();
            int diff = 0;
            int key = 0;
            if(index > current) {
                diff = index - current;
                key = KeyEvent.VK_DOWN;
            } else {
                diff = current - index;
                key = KeyEvent.VK_UP;
            }
            for(int i = 0; i < diff; i++) {
                kdriver.pushKey(oper, key, 0, pushTimeout);
            }
        }
        kdriver.pushKey(oper, KeyEvent.VK_ENTER, 0, pushTimeout);
    }
View Full Code Here

  ListOperator loper = (ListOperator)oper;
  if(loper.isMultipleMode()) {
      super.selectItem(loper, index);
  }
  DriverManager.getFocusDriver(oper).giveFocus(oper);
  KeyDriver   kDriver = DriverManager.getKeyDriver(oper);
  int current = loper.getSelectedIndex();
  int diff = 0;
  int key = 0;
  if(index > current) {
      diff = index - current;
      key = KeyEvent.VK_DOWN;
  } else {
      diff = current - index;
      key = KeyEvent.VK_UP;
  }
  Timeout pushTime = oper.getTimeouts().create("ComponentOperator.PushKeyTimeout");
  for(int i = 0; i < diff; i++) {
      kDriver.pushKey(oper, key, 0, pushTime);
  }
  kDriver.pushKey(oper, KeyEvent.VK_ENTER, 0, pushTime);
    }
View Full Code Here

    }
    public void clearText(ComponentOperator oper) {
  if(oper instanceof JTextAreaOperator ||
     oper instanceof JEditorPaneOperator) {
      DriverManager.getFocusDriver(oper).giveFocus(oper);
      KeyDriver kdriver = DriverManager.getKeyDriver(oper);
      selectText(oper, 0, getText(oper).length());
      kdriver.pushKey(oper, KeyEvent.VK_DELETE, 0,
          oper.getTimeouts().create("ComponentOperator.PushKeyTimeout"));
  } else {
      super.clearText(oper);
  }
    }
View Full Code Here

TOP

Related Classes of org.netbeans.jemmy.drivers.KeyDriver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.