001/* ===========================================================
002 * JFreeChart : a free chart library for the Java(tm) platform
003 * ===========================================================
004 *
005 * (C) Copyright 2000-2014, by Object Refinery Limited and Contributors.
006 *
007 * Project Info:  http://www.jfree.org/jfreechart/index.html
008 *
009 * This library is free software; you can redistribute it and/or modify it
010 * under the terms of the GNU Lesser General Public License as published by
011 * the Free Software Foundation; either version 2.1 of the License, or
012 * (at your option) any later version.
013 *
014 * This library is distributed in the hope that it will be useful, but
015 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
016 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
017 * License for more details.
018 *
019 * You should have received a copy of the GNU Lesser General Public
020 * License along with this library; if not, write to the Free Software
021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
022 * USA.
023 *
024 * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. 
025 * Other names may be trademarks of their respective owners.]
026 *
027 * -------------------
028 * MouseHandlerFX.java
029 * -------------------
030 * (C) Copyright 2014, by Object Refinery Limited and Contributors.
031 *
032 * Original Author:  David Gilbert (for Object Refinery Limited);
033 * Contributor(s):   -;
034 *
035 * Changes:
036 * --------
037 * 25-Jun-2014 : Version 1 (DG);
038 *
039 */package org.jfree.chart.fx.interaction;
040
041import javafx.scene.input.MouseEvent;
042import javafx.scene.input.ScrollEvent;
043import org.jfree.chart.fx.ChartCanvas;
044
045/**
046 * The interface for a mouse handler, which is an object that listens for
047 * mouse events on a {@link ChartCanvas} and performs a function in response
048 * to those events (typical functions include tooltip display, drag zooming,
049 * mouse wheel zooming and panning).  A handler can be registered with the
050 * {@link ChartCanvas} as a regular handler or as an auxiliary handler.  Upon a 
051 * mouse pressed event, the canvas will select *one* regular handler to be the
052 * current "live" handler - this selection normally takes into account the
053 * modifier keys that are specified for the handler.  The live handler is
054 * responsible for unregistering itself once it has finished handling mouse
055 * events (it can be reselected again on subsequent mouse pressed events).
056 * The auxiliary handlers are always called to respond to mouse events, but
057 * after the live handler has dealt with the event first.  Auxiliary handlers
058 * should not perform tasks that could interfere with the live handler.
059 * 
060 * <p>THE API FOR THIS CLASS IS SUBJECT TO CHANGE IN FUTURE RELEASES.  This is
061 * so that we can incorporate feedback on the (new) JavaFX support in 
062 * JFreeChart.</p>
063 * 
064 * @since 1.0.18
065 */
066public interface MouseHandlerFX {
067
068    /**
069     * Returns the ID for the handler.
070     * 
071     * @return The ID (never {@code null}). 
072     */
073    String getID();
074    
075    /**
076     * Returns {@code true} if the mouse handler is enabled, and 
077     * {@code false} if it is disabled.
078     * 
079     * @return A boolean. 
080     */
081    boolean isEnabled();
082    
083    /**
084     * Returns {@code true} if the specified mouse event has modifier
085     * keys that match this handler.
086     * 
087     * @param e  the mouse event ({@code null} not permitted).
088     * 
089     * @return A boolean. 
090     */
091    boolean hasMatchingModifiers(MouseEvent e);
092    
093    /**
094     * Handles a mouse moved event.
095     * 
096     * @param canvas  the canvas ({@code null} not permitted).
097     * @param e  the event ({@code null} not permitted).
098     */
099    void handleMouseMoved(ChartCanvas canvas, MouseEvent e);
100    
101    /**
102     * Handles a mouse clicked event.
103     * 
104     * @param canvas  the canvas ({@code null} not permitted).
105     * @param e  the event ({@code null} not permitted).
106     */
107    void handleMouseClicked(ChartCanvas canvas, MouseEvent e);
108    
109    /**
110     * Handles a mouse pressed event.
111     * 
112     * @param canvas  the canvas ({@code null} not permitted).
113     * @param e  the event ({@code null} not permitted).
114     */
115    void handleMousePressed(ChartCanvas canvas, MouseEvent e);
116    
117    /**
118     * Handles a mouse dragged event.
119     * 
120     * @param canvas  the canvas ({@code null} not permitted).
121     * @param e  the event ({@code null} not permitted).
122     */
123    void handleMouseDragged(ChartCanvas canvas, MouseEvent e);
124    
125    /**
126     * Handles a mouse released event.
127     * 
128     * @param canvas  the canvas ({@code null} not permitted).
129     * @param e  the event ({@code null} not permitted).
130     */
131    void handleMouseReleased(ChartCanvas canvas, MouseEvent e);
132
133    /**
134     * Handles a scroll event.
135     * 
136     * @param canvas  the canvas ({@code null} not permitted).
137     * @param e  the event ({@code null} not permitted).
138     */
139    void handleScroll(ChartCanvas canvas, ScrollEvent e);
140    
141}