1 /* 2 * Copyright (c) 2007, 2017 Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 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 29 import org.jemmy.Point; 30 import org.jemmy.action.Action; 31 import org.jemmy.dock.Shortcut; 32 import org.jemmy.env.Environment; 33 import org.jemmy.env.Timeout; 34 35 /** 36 * @author shura 37 */ 38 public interface Mouse extends ControlInterface { 39 public static final Timeout CLICK = new Timeout("mouse.click", 100); 40 41 @Shortcut 42 public void press(); 43 44 @Shortcut 45 public void press(MouseButton button); 46 47 @Shortcut 48 public void press(MouseButton button, Modifier... modifiers); 49 50 @Shortcut 51 public void release(); 52 53 @Shortcut 54 public void release(MouseButton button); 55 56 @Shortcut 57 public void release(MouseButton button, Modifier... modifiers); 58 59 @Shortcut 60 public void move(); 61 62 @Shortcut 63 public void move(Point p); 64 65 @Shortcut 66 public void click(); 67 68 @Shortcut 69 public void click(int count); 70 71 @Shortcut 72 public void click(int count, Point p); 73 74 @Shortcut 75 public void click(int count, Point p, MouseButton button); 76 77 @Shortcut 78 public void click(int count, Point p, MouseButton button, Modifier... modifiers); 79 80 /* 81 * This method turns mouse wheel. 82 * @param amount Positive or negative 83 */ 84 @Shortcut 85 public void turnWheel(int amount); 86 87 /* 88 * This method turns mouse wheel. 89 * @param amount Positive or negative 90 */ 91 @Shortcut 92 public void turnWheel(Point point, int amount); 93 94 /* 95 * This method turns mouse wheel. 96 * @param point todo document 97 * @param amount Positive or negative 98 * @param modifiers todo document 99 */ 100 @Shortcut 101 public void turnWheel(Point point, int amount, Modifier... modifiers); 102 103 /** 104 * Detaches the implementation so that all actions of it will be ran detached. 105 * @see org.jemmy.action.ActionExecutor#executeDetached(Environment, boolean, Action, Object...) 106 * @return todo document 107 */ 108 public Mouse detached(); 109 110 /** 111 * Mouse button interface (i. e. BUTTON1, BUTTON2, etc.) 112 * created to left the possibility for extention as enums can't be extended 113 */ 114 public static interface MouseButton extends Button { 115 116 } 117 118 /** 119 * Mouse modifier interface (i. e. BUTTON1_DOWN_MASK) 120 * created to left the possibility for extention as enums can't be extended 121 */ 122 public static interface MouseModifier extends Modifier { 123 124 } 125 126 /** 127 * Mouse modifiers enum (i. e. BUTTON1_DOWN_MASK) 128 * to be used in Keyboard interface methods 129 */ 130 public static enum MouseModifiers implements MouseModifier { 131 BUTTON1_DOWN_MASK, 132 BUTTON2_DOWN_MASK, 133 BUTTON3_DOWN_MASK 134 } 135 136 /** 137 * Mouse Buttons 138 */ 139 public static enum MouseButtons implements MouseButton { 140 BUTTON1, 141 BUTTON2, 142 BUTTON3 143 } 144 145 }