< prev index next >

core/JemmyCore/src/org/jemmy/interfaces/Keyboard.java

Print this page




   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package org.jemmy.interfaces;
  27 

  28 import org.jemmy.dock.Shortcut;

  29 import org.jemmy.env.Timeout;
  30 
  31 
  32 /**
  33  * Defines how to simulate keyboard operations.
  34  */
  35 public interface Keyboard extends ControlInterface {
  36 
  37     /**
  38      *
  39      */
  40     public static final Timeout PUSH = new Timeout("keyboard.push", 100);
  41 
  42     /**
  43      *
  44      * @param key
  45      * @param modifiers
  46      */
  47     @Shortcut
  48     public void pressKey(KeyboardButton key, Modifier... modifiers);
  49     /**
  50      *
  51      * @param key
  52      */
  53     @Shortcut
  54     public void pressKey(KeyboardButton key);
  55 
  56     /**
  57      *
  58      * @param key
  59      * @param modifiers
  60      */
  61     @Shortcut
  62     public void releaseKey(KeyboardButton key, Modifier... modifiers);
  63     /**
  64      *
  65      * @param key
  66      */
  67     @Shortcut
  68     public void releaseKey(KeyboardButton key);
  69 
  70     /**
  71      *
  72      * @param key
  73      * @param modifiers
  74      * @param pushTime
  75      */
  76     @Shortcut
  77     public void pushKey(Timeout pushTime, KeyboardButton key, Modifier... modifiers);
  78     /**
  79      *
  80      * @param key
  81      * @param modifiers
  82      */
  83     @Shortcut
  84     public void pushKey(KeyboardButton key, Modifier... modifiers);
  85     /**
  86      *
  87      * @param key
  88      */
  89     @Shortcut
  90     public void pushKey(KeyboardButton key);
  91 
  92     /**
  93      *
  94      * @param keyChar
  95      * @param pushTime
  96      */
  97     @Shortcut
  98     public void typeChar(char keyChar, Timeout pushTime);
  99     /**
 100      *
 101      * @param keyChar
 102      */
 103     @Shortcut
 104     public void typeChar(char keyChar);
 105 
 106     /**
 107      * Detaches the implementation so that all actions of it will be ran detached.
 108      * @see org.jemmy.action.ActionExecutor#executeDetached(org.jemmy.env.Environment, org.jemmy.action.Action, java.lang.Object[])
 109      * @return
 110      */
 111     public Keyboard detached();
 112 
 113     /**
 114      * Keyboard button interface (i. e. Q, W, ENTER, LEFT, F1, etc.)
 115      * created to left the possibility for extention as enums can't be extended
 116      */
 117     public static interface KeyboardButton extends Button {
 118 
 119     }
 120 
 121     /**
 122      * Keyboard modifier interface (i. e. SHIFT_DOWN_MASK)
 123      * created to left the possibility for extention as enums can't be extended
 124      */
 125     public static interface KeyboardModifier extends Modifier {
 126 
 127     }
 128 
 129     /**
 130      * Keyboard modifiers enum (i. e. SHIFT_DOWN_MASK)
 131      * to be used in Keyboard interface methods
 132      */
 133     public static enum KeyboardModifiers implements KeyboardModifier {
 134         SHIFT_DOWN_MASK,
 135         CTRL_DOWN_MASK,
 136         ALT_DOWN_MASK,
 137         META_DOWN_MASK
 138     }
 139 
 140     /**
 141      * Keyboard buttons enum (i. e. Q, W, ENTER, LEFT, F1, etc.)
 142      * to be used in Keyboard interface methods
 143      */
 144     public static enum KeyboardButtons implements KeyboardButton {
 145 
 146         /**
 147          *
 148          */
 149         ESCAPE,
 150         /**
 151          *
 152          */
 153         F1,
 154         /**
 155          *
 156          */
 157         F2,
 158         /**
 159          *
 160          */
 161         F3,
 162         /**
 163          *
 164          */
 165         F4,




   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package org.jemmy.interfaces;
  27 
  28 import org.jemmy.action.Action;
  29 import org.jemmy.dock.Shortcut;
  30 import org.jemmy.env.Environment;
  31 import org.jemmy.env.Timeout;
  32 
  33 
  34 /**
  35  * Defines how to simulate keyboard operations.
  36  */
  37 public interface Keyboard extends ControlInterface {
  38 



  39     public static final Timeout PUSH = new Timeout("keyboard.push", 100);
  40 





  41     @Shortcut
  42     public void pressKey(KeyboardButton key, Modifier... modifiers);
  43 



  44     @Shortcut
  45     public void pressKey(KeyboardButton key);
  46 





  47     @Shortcut
  48     public void releaseKey(KeyboardButton key, Modifier... modifiers);
  49 



  50     @Shortcut
  51     public void releaseKey(KeyboardButton key);
  52 






  53     @Shortcut
  54     public void pushKey(Timeout pushTime, KeyboardButton key, Modifier... modifiers);
  55 




  56     @Shortcut
  57     public void pushKey(KeyboardButton key, Modifier... modifiers);
  58 



  59     @Shortcut
  60     public void pushKey(KeyboardButton key);
  61 





  62     @Shortcut
  63     public void typeChar(char keyChar, Timeout pushTime);
  64 



  65     @Shortcut
  66     public void typeChar(char keyChar);
  67 
  68     /**
  69      * Detaches the implementation so that all actions of it will be ran detached.
  70      * @see org.jemmy.action.ActionExecutor#executeDetached(Environment, boolean, Action, Object...)
  71      * @return todo document
  72      */
  73     public Keyboard detached();
  74 
  75     /**
  76      * Keyboard button interface (i. e. Q, W, ENTER, LEFT, F1, etc.)
  77      * created to left the possibility for extention as enums can't be extended
  78      */
  79     public static interface KeyboardButton extends Button {
  80 
  81     }
  82 
  83     /**
  84      * Keyboard modifier interface (i. e. SHIFT_DOWN_MASK)
  85      * created to left the possibility for extention as enums can't be extended
  86      */
  87     public static interface KeyboardModifier extends Modifier {
  88 
  89     }
  90 
  91     /**
  92      * Keyboard modifiers enum (i. e. SHIFT_DOWN_MASK)
  93      * to be used in Keyboard interface methods
  94      */
  95     public static enum KeyboardModifiers implements KeyboardModifier {
  96         SHIFT_DOWN_MASK,
  97         CTRL_DOWN_MASK,
  98         ALT_DOWN_MASK,
  99         META_DOWN_MASK
 100     }
 101 
 102     /**
 103      * Keyboard buttons enum (i. e. Q, W, ENTER, LEFT, F1, etc.)
 104      * to be used in Keyboard interface methods
 105      */
 106     public static enum KeyboardButtons implements KeyboardButton {

 107         /**
 108          *
 109          */
 110         ESCAPE,
 111         /**
 112          *
 113          */
 114         F1,
 115         /**
 116          *
 117          */
 118         F2,
 119         /**
 120          *
 121          */
 122         F3,
 123         /**
 124          *
 125          */
 126         F4,


< prev index next >