JIDE 3.5.15

com.jidesoft.chart.event
Class MouseWheelZoomer

java.lang.Object
  extended by com.jidesoft.chart.event.MouseWheelZoomer
All Implemented Interfaces:
MouseHandler, MouseListener, MouseMotionListener, MouseWheelListener, EventListener

public class MouseWheelZoomer
extends Object
implements MouseHandler, MouseWheelListener

Used for controlling zooming on a Chart component using the mouse wheel.


Field Summary
static String PROPERTY_HORIZONTAL_ZOOM
           
static String PROPERTY_MAX_X_RANGE_SIZE
           
static String PROPERTY_MAX_Y_RANGE_SIZE
           
static String PROPERTY_MIN_X_RANGE_SIZE
           
static String PROPERTY_MIN_Y_RANGE_SIZE
           
static String PROPERTY_VERTICAL_ZOOM
           
static String PROPERTY_X_LIMITS
           
static String PROPERTY_Y_LIMITS
           
static String PROPERTY_ZOOM_LOCATION
           
 
Constructor Summary
MouseWheelZoomer(Chart chart)
          Create a zooming facility and apply it to both the X and Y axes of the supplied Chart component.
MouseWheelZoomer(Chart chart, boolean zoomHorizontally, boolean zoomVertically)
          Use of this constructor allows you to specify a zoom that is on just one of the two axes.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Registers an object that is interested in property changes on this instance
 void addZoomListener(ZoomListener listener)
          Register an object that is interested in zoom events
protected  void fireZoom(ChartSelectionEvent zoomEvent)
           
protected  void fireZoom(Point zoomPoint, ZoomDirection direction)
          Fire a zoom event to inform listeners of a zoom
protected  void fireZoom(Point zoomPoint, ZoomDirection direction, double zoomFactor)
          Fire a zoom event to inform listeners of a zoom
 Double getMaxXRangeSize()
          Returns the maximum range size for user coordinates in the x direction
 Double getMaxYRangeSize()
          Returns the maximum range size for user coordinates in the y direction
 Double getMinXRangeSize()
          Returns the minimum range size for user coordinates in the x direction
 Double getMinYRangeSize()
          Returns the minimum range size for user coordinates in the y direction
 Range<?> getXLimits()
          Returns the current outer limits for the x axis under zooming
 Range<?> getYLimits()
          Returns the current outer limits of the y axis under zooming
 Point2D getZoomFrom()
           
 ZoomLocation getZoomLocation()
          Returns the location used as the origin of a zoom
 boolean isHandled()
          Indicates whether an event that was received by this listener was handled
 boolean isHorizontalZoom()
          Returns a boolean to indicate whether zoom is being supported in the horizontal direction
 boolean isVerticalZoom()
          Returns a boolean to indicate whether zoom is being supported in the vertical direction
 void mouseClicked(MouseEvent e)
          One of the methods of the MouseHandler interface
 void mouseDragged(MouseEvent event)
          One of the methods of the MouseHandler interface
 void mouseEntered(MouseEvent e)
          One of the methods of the MouseHandler interface
 void mouseExited(MouseEvent e)
          One of the methods of the MouseHandler interface
 void mouseMoved(MouseEvent event)
          One of the methods of the MouseHandler interface
 void mousePressed(MouseEvent e)
          One of the methods of the MouseHandler interface
 void mouseReleased(MouseEvent e)
          One of the methods of the MouseHandler interface
 void mouseWheelMoved(MouseWheelEvent event)
          An important method that handles the behaviour when the mouse wheel moved.
 void removePropertyChangeListener(PropertyChangeListener listener)
          De-registers an object that is no longer interested in property changes on this instance
 void removeZoomListener(ZoomListener listener)
          Remove an object that is registered to receive zoom events
 void setHandled(boolean handled)
          Specify whether an event that was received by this listener was handled
 void setHorizontalZoom(boolean horizontalZoom)
          Specify whether the horizontal zoom is active
 void setMaxXRangeSize(Double maxXRangeSize)
          Specifies the maximum range size for user coordinates in the x direction Used to prevent zooming out too far on a chart
 void setMaxYRangeSize(Double maxYRangeSize)
          Specifies the maximum range size for user coordinates in the y direction.
 void setMinXRangeSize(Double minXRangeSize)
          Specifies the minimum range size for user coordinates in the x direction.
 void setMinYRangeSize(Double minYRangeSize)
          Specifies the minimum range size for user coordinates in the y direction.
 void setVerticalZoom(boolean verticalZoom)
          Specify whether the vertical zoom is active
 void setXLimits(Range<?> xOuterLimits)
          Specify the outer limits of the x axis under zooming
 void setYLimits(Range<?> yOuterLimits)
          Specifies the outer limits of the y axis under zooming
 void setZoomFrom(Point2D zoomFrom)
           
 void setZoomLocation(ZoomLocation zoomLocation)
          Specify the location that will be the origin of a zoom.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_HORIZONTAL_ZOOM

public static final String PROPERTY_HORIZONTAL_ZOOM
See Also:
Constant Field Values

PROPERTY_VERTICAL_ZOOM

public static final String PROPERTY_VERTICAL_ZOOM
See Also:
Constant Field Values

PROPERTY_ZOOM_LOCATION

public static final String PROPERTY_ZOOM_LOCATION
See Also:
Constant Field Values

PROPERTY_X_LIMITS

public static final String PROPERTY_X_LIMITS
See Also:
Constant Field Values

PROPERTY_MIN_X_RANGE_SIZE

public static final String PROPERTY_MIN_X_RANGE_SIZE
See Also:
Constant Field Values

PROPERTY_MAX_X_RANGE_SIZE

public static final String PROPERTY_MAX_X_RANGE_SIZE
See Also:
Constant Field Values

PROPERTY_Y_LIMITS

public static final String PROPERTY_Y_LIMITS
See Also:
Constant Field Values

PROPERTY_MIN_Y_RANGE_SIZE

public static final String PROPERTY_MIN_Y_RANGE_SIZE
See Also:
Constant Field Values

PROPERTY_MAX_Y_RANGE_SIZE

public static final String PROPERTY_MAX_Y_RANGE_SIZE
See Also:
Constant Field Values
Constructor Detail

MouseWheelZoomer

public MouseWheelZoomer(Chart chart)
Create a zooming facility and apply it to both the X and Y axes of the supplied Chart component.

Parameters:
chart - the chart to which the zoomer corresponds

MouseWheelZoomer

public MouseWheelZoomer(Chart chart,
                        boolean zoomHorizontally,
                        boolean zoomVertically)
Use of this constructor allows you to specify a zoom that is on just one of the two axes. (You could have a zoom on neither, but what is the point of that?)

Parameters:
chart - the Chart instance to which the zoomer should be added
zoomHorizontally - whether horizontal zooming should be allowed
zoomVertically - whether vertical zooming should be allowed
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Registers an object that is interested in property changes on this instance

Parameters:
listener - the object to be notified of changes

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
De-registers an object that is no longer interested in property changes on this instance

Parameters:
listener - the object that is no longer interested in property changes

isHorizontalZoom

public boolean isHorizontalZoom()
Returns a boolean to indicate whether zoom is being supported in the horizontal direction

Returns:
whether horizontal zoom is active

setHorizontalZoom

public void setHorizontalZoom(boolean horizontalZoom)
Specify whether the horizontal zoom is active

Parameters:
horizontalZoom - a boolean to indicate whether a zoom should occur on the horizontal axis

isVerticalZoom

public boolean isVerticalZoom()
Returns a boolean to indicate whether zoom is being supported in the vertical direction

Returns:
whether vertical zoom is active

setVerticalZoom

public void setVerticalZoom(boolean verticalZoom)
Specify whether the vertical zoom is active

Parameters:
verticalZoom - a boolean to indicate whether a zoom should occur on the vertical axis

getZoomLocation

public ZoomLocation getZoomLocation()
Returns the location used as the origin of a zoom

Returns:
the location of the origin of a zoom event

setZoomLocation

public void setZoomLocation(ZoomLocation zoomLocation)
Specify the location that will be the origin of a zoom. By default this is the center of the chart.

Parameters:
zoomLocation - the origin of a zoom

getZoomFrom

public Point2D getZoomFrom()

setZoomFrom

public void setZoomFrom(Point2D zoomFrom)

getXLimits

public Range<?> getXLimits()
Returns the current outer limits for the x axis under zooming

Returns:
the current outer limits for the x axis under zooming

setXLimits

public void setXLimits(Range<?> xOuterLimits)
Specify the outer limits of the x axis under zooming

Parameters:
xOuterLimits - the outer limits of the x axis

getMinXRangeSize

public Double getMinXRangeSize()
Returns the minimum range size for user coordinates in the x direction

Returns:
the minimum range size for user coordinates in the x direction

setMinXRangeSize

public void setMinXRangeSize(Double minXRangeSize)
Specifies the minimum range size for user coordinates in the x direction. Used to limit zooming in on a chart to the given level of resolution.


getYLimits

public Range<?> getYLimits()
Returns the current outer limits of the y axis under zooming

Returns:
the current outer limits of the y axis under zooming

setYLimits

public void setYLimits(Range<?> yOuterLimits)
Specifies the outer limits of the y axis under zooming

Parameters:
yOuterLimits - the outer limits of the y axis

getMinYRangeSize

public Double getMinYRangeSize()
Returns the minimum range size for user coordinates in the y direction

Returns:
the minimum range size for user coordinates in the y direction

setMinYRangeSize

public void setMinYRangeSize(Double minYRangeSize)
Specifies the minimum range size for user coordinates in the y direction. Used to limit zooming in on a chart to the given level of resolution.


getMaxXRangeSize

public Double getMaxXRangeSize()
Returns the maximum range size for user coordinates in the x direction

Returns:
the maximum range size for user coordinates in the x direction

setMaxXRangeSize

public void setMaxXRangeSize(Double maxXRangeSize)
Specifies the maximum range size for user coordinates in the x direction Used to prevent zooming out too far on a chart

Parameters:
maxXRangeSize - the maximum size of the x range

getMaxYRangeSize

public Double getMaxYRangeSize()
Returns the maximum range size for user coordinates in the y direction

Returns:
the maximum range size for user coordinates in the y direction

setMaxYRangeSize

public void setMaxYRangeSize(Double maxYRangeSize)
Specifies the maximum range size for user coordinates in the y direction. Used to prevent zooming out too far on a chart

Parameters:
maxYRangeSize - the maximum size of the y range

addZoomListener

public void addZoomListener(ZoomListener listener)
Register an object that is interested in zoom events

Parameters:
listener - the object to be notified of zoom events

removeZoomListener

public void removeZoomListener(ZoomListener listener)
Remove an object that is registered to receive zoom events

Parameters:
listener - the listener to remove

fireZoom

protected void fireZoom(Point zoomPoint,
                        ZoomDirection direction)
Fire a zoom event to inform listeners of a zoom

Parameters:
zoomPoint - the point at which the zoom occurred
direction - the direction of the zoom

fireZoom

protected void fireZoom(Point zoomPoint,
                        ZoomDirection direction,
                        double zoomFactor)
Fire a zoom event to inform listeners of a zoom

Parameters:
zoomPoint - the point at which the zoom occurred
direction - the direction of the zoom
zoomFactor - the multiplication factor applied for the zoom

fireZoom

protected void fireZoom(ChartSelectionEvent zoomEvent)

mouseDragged

public void mouseDragged(MouseEvent event)
One of the methods of the MouseHandler interface

Specified by:
mouseDragged in interface MouseMotionListener

mouseMoved

public void mouseMoved(MouseEvent event)
One of the methods of the MouseHandler interface

Specified by:
mouseMoved in interface MouseMotionListener

mouseWheelMoved

public void mouseWheelMoved(MouseWheelEvent event)
An important method that handles the behaviour when the mouse wheel moved.

Specified by:
mouseWheelMoved in interface MouseWheelListener

isHandled

public boolean isHandled()
Indicates whether an event that was received by this listener was handled

Specified by:
isHandled in interface MouseHandler
Returns:
whether the event was handled

setHandled

public void setHandled(boolean handled)
Specify whether an event that was received by this listener was handled

Specified by:
setHandled in interface MouseHandler
Parameters:
handled - whether the event was handled

mouseClicked

public void mouseClicked(MouseEvent e)
One of the methods of the MouseHandler interface

Specified by:
mouseClicked in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent e)
One of the methods of the MouseHandler interface

Specified by:
mouseEntered in interface MouseListener

mouseExited

public void mouseExited(MouseEvent e)
One of the methods of the MouseHandler interface

Specified by:
mouseExited in interface MouseListener

mousePressed

public void mousePressed(MouseEvent e)
One of the methods of the MouseHandler interface

Specified by:
mousePressed in interface MouseListener

mouseReleased

public void mouseReleased(MouseEvent e)
One of the methods of the MouseHandler interface

Specified by:
mouseReleased in interface MouseListener

JIDE 3.5.15