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.dock.Shortcut; 31 import org.jemmy.env.Timeout; 32 33 /** 34 * 35 * @author shura 36 */ 37 public interface Mouse extends ControlInterface { 38 /** 39 * 40 */ 41 public static final Timeout CLICK = new Timeout("mouse.click", 100); 42 /** 43 * 44 */ 45 @Shortcut 46 public void press(); 47 /** 48 * 49 * @param button 50 */ 51 @Shortcut 52 public void press(MouseButton button); 53 /** 54 * 55 * @param button 56 * @param modifiers 57 */ 58 @Shortcut 59 public void press(MouseButton button, Modifier... modifiers); 60 /** 61 * 62 */ 63 @Shortcut 64 public void release(); 65 /** 66 * 67 * @param button 68 */ 69 @Shortcut 70 public void release(MouseButton button); 71 /** 72 * 73 * @param button 74 * @param modifiers 75 */ 76 @Shortcut 77 public void release(MouseButton button, Modifier... modifiers); 78 /** 79 * 80 */ 81 @Shortcut 82 public void move(); 83 /** 84 * 85 * @param p 86 */ 87 @Shortcut 88 public void move(Point p); 89 /** 90 * 91 */ 92 @Shortcut 93 public void click(); 94 /** 95 * 96 * @param count 97 */ 98 @Shortcut 99 public void click(int count); 100 /** 101 * 102 * @param count 103 * @param p 104 */ 105 @Shortcut 106 public void click(int count, Point p); 107 /** 108 * 109 * @param count 110 * @param p 111 * @param button 112 */ 113 @Shortcut 114 public void click(int count, Point p, MouseButton button); 115 /** 116 * 117 * @param count 118 * @param p 119 * @param button 120 * @param modifiers 121 */ 122 @Shortcut 123 public void click(int count, Point p, MouseButton button, Modifier... modifiers); 124 125 /* 126 * This method turns mouse wheel. 127 * @parem amount Positive or negative 128 */ 129 @Shortcut 130 public void turnWheel(int amount); 131 132 /* 133 * This method turns mouse wheel. 134 * @parem amount Positive or negative 135 */ 136 @Shortcut 137 public void turnWheel(Point point, int amount); 138 139 /* 140 * This method turns mouse wheel. 141 * @parem amount Positive or negative 142 */ 143 @Shortcut 144 public void turnWheel(Point point, int amount, Modifier... modifiers); 145 146 /** 147 * Detaches the implementation so that all actions of it will be ran detached. 148 * @see org.jemmy.action.ActionExecutor#executeDetached(org.jemmy.env.Environment, org.jemmy.action.Action, java.lang.Object[]) 149 * @return 150 */ 151 public Mouse detached(); 152 153 /** 154 * Mouse button interface (i. e. BUTTON1, BUTTON2, etc.) 155 * created to left the possibility for extention as enums can't be extended 156 */ 157 public static interface MouseButton extends Button { 158 159 } 160 161 /** 162 * Mouse modifier interface (i. e. BUTTON1_DOWN_MASK) 163 * created to left the possibility for extention as enums can't be extended 164 */ 165 public static interface MouseModifier extends Modifier { 166 167 } 168 169 /** 170 * Mouse modifiers enum (i. e. BUTTON1_DOWN_MASK) 171 * to be used in Keyboard interface methods 172 */ 173 public static enum MouseModifiers implements MouseModifier { 174 175 /** 176 * 177 */ 178 BUTTON1_DOWN_MASK, 179 /** 180 * 181 */ 182 BUTTON2_DOWN_MASK, 183 /** 184 * 185 */ 186 BUTTON3_DOWN_MASK 187 } 188 189 /** 190 * Mouse Buttons 191 */ 192 public static enum MouseButtons implements MouseButton { 193 /** 194 * 195 */ 196 BUTTON1, 197 /** 198 * 199 */ 200 BUTTON2, 201 /** 202 * 203 */ 204 BUTTON3 205 } 206 207 }