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.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 package org.jemmy.interfaces;
  25 
  26 
  27 import org.jemmy.Point;
  28 import org.jemmy.dock.Shortcut;
  29 import org.jemmy.env.Timeout;
  30 
  31 /**
  32  *
  33  * @author shura
  34  */
  35 public interface Mouse extends ControlInterface {
  36     /**
  37      *
  38      */
  39     public static final Timeout CLICK = new Timeout("mouse.click", 100);
  40     /**
  41      *
  42      */
  43     @Shortcut
  44     public void press();
  45     /**
  46      *
  47      * @param button
  48      */
  49     @Shortcut
  50     public void press(MouseButton button);
  51     /**
  52      *
  53      * @param button 
  54      * @param modifiers
  55      */
  56     @Shortcut
  57     public void press(MouseButton button, Modifier... modifiers);
  58     /**
  59      *
  60      */
  61     @Shortcut
  62     public void release();
  63     /**
  64      *
  65      * @param button
  66      */
  67     @Shortcut
  68     public void release(MouseButton button);
  69     /**
  70      *
  71      * @param button
  72      * @param modifiers
  73      */
  74     @Shortcut
  75     public void release(MouseButton button, Modifier... modifiers);
  76     /**
  77      *
  78      */
  79     @Shortcut
  80     public void move();
  81     /**
  82      *
  83      * @param p
  84      */
  85     @Shortcut
  86     public void move(Point p);
  87     /**
  88      *
  89      */
  90     @Shortcut
  91     public void click();
  92     /**
  93      *
  94      * @param count
  95      */
  96     @Shortcut
  97     public void click(int count);
  98     /**
  99      *
 100      * @param count
 101      * @param p
 102      */
 103     @Shortcut
 104     public void click(int count, Point p);
 105     /**
 106      *
 107      * @param count
 108      * @param p
 109      * @param button
 110      */
 111     @Shortcut
 112     public void click(int count, Point p, MouseButton button);
 113     /**
 114      *
 115      * @param count
 116      * @param p
 117      * @param button
 118      * @param modifiers
 119      */
 120     @Shortcut
 121     public void click(int count, Point p, MouseButton button, Modifier... modifiers);
 122 
 123     /*
 124      * This method turns mouse wheel.
 125      * @parem amount Positive or negative
 126      */
 127     @Shortcut
 128     public void turnWheel(int amount);
 129 
 130     /*
 131      * This method turns mouse wheel.
 132      * @parem amount Positive or negative
 133      */
 134     @Shortcut
 135     public void turnWheel(Point point, int amount);
 136 
 137     /*
 138      * This method turns mouse wheel.
 139      * @parem amount Positive or negative
 140      */
 141     @Shortcut
 142     public void turnWheel(Point point, int amount, Modifier... modifiers);
 143 
 144     /**
 145      * Detaches the implementation so that all actions of it will be ran detached.
 146      * @see org.jemmy.action.ActionExecutor#executeDetached(org.jemmy.env.Environment, org.jemmy.action.Action, java.lang.Object[])
 147      * @return
 148      */
 149     public Mouse detached();
 150 
 151     /**
 152      * Mouse button interface (i. e. BUTTON1, BUTTON2, etc.)
 153      * created to left the possibility for extention as enums can't be extended
 154      */
 155     public static interface MouseButton extends Button {
 156 
 157     }
 158 
 159     /**
 160      * Mouse modifier interface (i. e. BUTTON1_DOWN_MASK)
 161      * created to left the possibility for extention as enums can't be extended
 162      */
 163     public static interface MouseModifier extends Modifier {
 164 
 165     }
 166 
 167     /**
 168      * Mouse modifiers enum (i. e. BUTTON1_DOWN_MASK)
 169      * to be used in Keyboard interface methods
 170      */
 171     public static enum MouseModifiers implements MouseModifier {
 172 
 173         /**
 174          *
 175          */
 176         BUTTON1_DOWN_MASK,
 177         /**
 178          * 
 179          */
 180         BUTTON2_DOWN_MASK,
 181         /**
 182          *
 183          */
 184         BUTTON3_DOWN_MASK
 185     }
 186 
 187     /**
 188      * Mouse Buttons
 189      */
 190     public static enum MouseButtons implements MouseButton {
 191         /**
 192          *
 193          */
 194         BUTTON1,
 195         /**
 196          *
 197          */
 198         BUTTON2,
 199         /**
 200          *
 201          */
 202         BUTTON3
 203     }
 204 
 205 }