Jazz API Documentation

edu.umd.cs.jazz.event
Class ZoomEventHandler

java.lang.Object
  |
  +--edu.umd.cs.jazz.event.ZoomEventHandler
All Implemented Interfaces:
java.util.EventListener, ZEventHandler, ZMouseListener, ZMouseMotionListener

public class ZoomEventHandler
extends java.lang.Object
implements ZEventHandler, ZMouseListener, ZMouseMotionListener

ZoomEventhandler provides event handlers for basic zooming of a Jazz camera with the right button. The interaction is that the initial mouse press defines the zoom anchor point, and then moving the mouse to the right zooms with a speed proportional to the amount the mouse is moved to the right of the anchor point. Similarly, if the mouse is moved to the left, the the camera is zoomed out.


Constructor Summary
ZoomEventHandler(ZNode node)
          Constructs a new ZoomEventHandler.
 
Method Summary
 void mouseClicked(ZMouseEvent e)
          Invoked when the mouse has been clicked on a component.
 void mouseDragged(ZMouseEvent e)
          Mouse drag event handler
 void mouseEntered(ZMouseEvent e)
          Invoked when the mouse enters a component.
 void mouseExited(ZMouseEvent e)
          Invoked when the mouse exits a component.
 void mouseMoved(ZMouseEvent e)
          Invoked when the mouse button has been moved on a node (with no buttons no down).
 void mousePressed(ZMouseEvent e)
          Mouse press event handler
 void mouseReleased(ZMouseEvent e)
          Mouse release event handler
 void setActive(boolean active)
          Specifies whether this event handler is active or not.
 void setMaxMagnification(float newMaxMag)
          Set the maximum magnification that the camera can be set to with this event handler.
 void setMinMagnification(float newMinMag)
          Set the minimum magnification that the camera can be set to with this event handler.
 void startZooming()
          Start animated zooming.
 void stopZooming()
          Stop animated zooming.
 void zoomOneStep()
          Do one zooming step, sleep a short amount, and schedule the next zooming step.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZoomEventHandler

public ZoomEventHandler(ZNode node)
Constructs a new ZoomEventHandler.
Parameters:
node - The node this event handler attaches to.
Method Detail

setActive

public void setActive(boolean active)
Specifies whether this event handler is active or not.
Specified by:
setActive in interface ZEventHandler
Parameters:
active - True to make this event handler active

mousePressed

public void mousePressed(ZMouseEvent e)
Mouse press event handler
Specified by:
mousePressed in interface ZMouseListener
Parameters:
e - The event.

mouseDragged

public void mouseDragged(ZMouseEvent e)
Mouse drag event handler
Specified by:
mouseDragged in interface ZMouseMotionListener
Parameters:
e - The event.

mouseReleased

public void mouseReleased(ZMouseEvent e)
Mouse release event handler
Specified by:
mouseReleased in interface ZMouseListener
Parameters:
e - The event.

mouseEntered

public void mouseEntered(ZMouseEvent e)
Invoked when the mouse enters a component.
Specified by:
mouseEntered in interface ZMouseListener

mouseExited

public void mouseExited(ZMouseEvent e)
Invoked when the mouse exits a component.
Specified by:
mouseExited in interface ZMouseListener

mouseClicked

public void mouseClicked(ZMouseEvent e)
Invoked when the mouse has been clicked on a component.
Specified by:
mouseClicked in interface ZMouseListener

mouseMoved

public void mouseMoved(ZMouseEvent e)
Invoked when the mouse button has been moved on a node (with no buttons no down).
Specified by:
mouseMoved in interface ZMouseMotionListener

startZooming

public void startZooming()
Start animated zooming.

setMinMagnification

public void setMinMagnification(float newMinMag)
Set the minimum magnification that the camera can be set to with this event handler. Setting the min mag to <= 0 disables this feature. If the min mag if set to a value which is greater than the current camera magnification, then the camera is left at its current magnification.
Parameters:
newMinMag - the new minimum magnification

setMaxMagnification

public void setMaxMagnification(float newMaxMag)
Set the maximum magnification that the camera can be set to with this event handler. Setting the max mag to <= 0 disables this feature. If the max mag if set to a value which is less than the current camera magnification, then the camera is left at its current magnification.
Parameters:
newMaxMag - the new maximum magnification

stopZooming

public void stopZooming()
Stop animated zooming.

zoomOneStep

public void zoomOneStep()
Do one zooming step, sleep a short amount, and schedule the next zooming step. This effectively continuously zooms while still accepting input events so that the zoom center point can be changed, and zooming can be stopped.

Jazz API Documentation