コード例 #1
0
 /** Closes the drop down by pressing esc. */
 public void close() {
   rootMenuElement.type(Keys.ESCAPE.toString());
 }
 /// <summary>
 /// Converts the keyboard keys to a readable string name
 /// </summary>
 /// <param name="key">Key to convert to string name</param>
 /// <returns></returns>
 private String KeyInputName(String key) {
   if (key.equals(Keys.ADD.toString())) {
     return "Add";
   } else if (key.equals(Keys.ALT.toString())) {
     return "Alt";
   } else if (key.equals(Keys.ARROW_DOWN.toString())) {
     return "ArrowDown";
   } else if (key.equals(Keys.ARROW_LEFT.toString())) {
     return "ArrowLeft";
   } else if (key.equals(Keys.ARROW_RIGHT.toString())) {
     return "ArrowRight";
   } else if (key.equals(Keys.ARROW_UP.toString())) {
     return "ArrowUp";
   } else if (key.equals(Keys.BACK_SPACE.toString())) {
     return "Backspace";
   } else if (key.equals(Keys.CANCEL.toString())) {
     return "Cancel";
   } else if (key.equals(Keys.CLEAR.toString())) {
     return "Clear";
   } else if (key.equals(Keys.COMMAND.toString())) {
     return "Command";
   } else if (key.equals(Keys.CONTROL.toString())) {
     return "Control";
   } else if (key.equals(Keys.DECIMAL.toString())) {
     return "Decimal";
   } else if (key.equals(Keys.DELETE.toString())) {
     return "Delete";
   } else if (key.equals(Keys.DIVIDE.toString())) {
     return "Divide";
   } else if (key.equals(Keys.DOWN.toString())) {
     return "Down";
   } else if (key.equals(Keys.END.toString())) {
     return "End";
   } else if (key.equals(Keys.ENTER.toString())) {
     return "Enter";
   } else if (key.equals(Keys.EQUALS.toString())) {
     return "Equal";
   } else if (key.equals(Keys.ESCAPE.toString())) {
     return "Escape";
   } else if (key.equals(Keys.F1.toString())) {
     return "F1";
   } else if (key.equals(Keys.F10.toString())) {
     return "F10";
   } else if (key.equals(Keys.F11.toString())) {
     return "F11";
   } else if (key.equals(Keys.F12.toString())) {
     return "F12";
   } else if (key.equals(Keys.F2.toString())) {
     return "F2";
   } else if (key.equals(Keys.F3.toString())) {
     return "F3";
   } else if (key.equals(Keys.F4.toString())) {
     return "F4";
   } else if (key.equals(Keys.F5.toString())) {
     return "F5";
   } else if (key.equals(Keys.F6.toString())) {
     return "F6";
   } else if (key.equals(Keys.F7.toString())) {
     return "F7";
   } else if (key.equals(Keys.F8.toString())) {
     return "F8";
   } else if (key.equals(Keys.F9.toString())) {
     return "F9";
   } else if (key.equals(Keys.HELP.toString())) {
     return "Help";
   } else if (key.equals(Keys.HOME.toString())) {
     return "Home";
   } else if (key.equals(Keys.INSERT.toString())) {
     return "Insert";
   } else if (key.equals(Keys.LEFT.toString())) {
     return "Left";
   } else if (key.equals(Keys.LEFT_ALT.toString())) {
     return "LeftAlt";
   } else if (key.equals(Keys.LEFT_CONTROL.toString())) {
     return "LeftControl";
   } else if (key.equals(Keys.LEFT_SHIFT.toString())) {
     return "LeftShift";
   } else if (key.equals(Keys.META.toString())) {
     return "Meta";
   } else if (key.equals(Keys.MULTIPLY.toString())) {
     return "Multiply";
   } else if (key.equals(Keys.NULL.toString())) {
     return "Null";
   } else if (key.equals(Keys.NUMPAD0.toString())) {
     return "NumberPad0";
   } else if (key.equals(Keys.NUMPAD1.toString())) {
     return "NumberPad1";
   } else if (key.equals(Keys.NUMPAD2.toString())) {
     return "NumberPad2";
   } else if (key.equals(Keys.NUMPAD3.toString())) {
     return "NumberPad3";
   } else if (key.equals(Keys.NUMPAD4.toString())) {
     return "NumberPad4";
   } else if (key.equals(Keys.NUMPAD5.toString())) {
     return "NumberPad5";
   } else if (key.equals(Keys.NUMPAD6.toString())) {
     return "NumberPad6";
   } else if (key.equals(Keys.NUMPAD7.toString())) {
     return "NumberPad7";
   } else if (key.equals(Keys.NUMPAD8.toString())) {
     return "NumberPad8";
   } else if (key.equals(Keys.NUMPAD9.toString())) {
     return "NumberPad9";
   } else if (key.equals(Keys.PAGE_DOWN.toString())) {
     return "PageDown";
   } else if (key.equals(Keys.PAGE_UP.toString())) {
     return "PageUp";
   } else if (key.equals(Keys.PAUSE.toString())) {
     return "Pause";
   } else if (key.equals(Keys.RETURN.toString())) {
     return "Return";
   } else if (key.equals(Keys.RIGHT.toString())) {
     return "Right";
   } else if (key.equals(Keys.SEMICOLON.toString())) {
     return "Semicolon";
   } else if (key.equals(Keys.SEPARATOR.toString())) {
     return "Separator";
   } else if (key.equals(Keys.SHIFT.toString())) {
     return "Shift";
   } else if (key.equals(Keys.SPACE.toString())) {
     return "Space";
   } else if (key.equals(Keys.SUBTRACT.toString())) {
     return "Subtract";
   } else if (key.equals(Keys.TAB.toString())) {
     return "Tab";
   } else if (key.equals(Keys.UP.toString())) {
     return "Up";
   } else {
     return key;
   }
 }