edu.umd.cs.jazz.event
Class ZEventHandler

java.lang.Object
  |
  +--edu.umd.cs.jazz.event.ZEventHandler
Direct Known Subclasses:
ZLinkEventHandler, ZNavEventHandlerKeyBoard, ZoomEventHandlerRightButton, ZPanEventHandler, ZSelectionEventHandler

public abstract class ZEventHandler
extends java.lang.Object

ZEventHandler is an abstract class for defining behaviors in Jazz. It is really just a utility class to make it easier to group sets of event handlers that work together to define a behavior. This defines event listeners for mouse and keyboard events so that a sub-class can over-ride the ones it wants to define. Then, the entire set of handles can be temporarily turned on or off with calls to activate or deactivate. This functionality is specifically designed for mode-driven applications so that one mode might draw while another follows hyperlinks. One event handler can be defined for each mode, and then they just need to be activated and deactivated as needed.

See Also:
ZSurface

Field Summary
protected  boolean activated
           
protected  java.awt.Component component
           
protected  java.awt.event.KeyAdapter keyAdapter
           
protected  java.awt.event.MouseAdapter mouseAdapter
           
protected  java.awt.event.MouseMotionAdapter mouseMotionAdapter
           
protected  ZSurface surface
           
 
Constructor Summary
ZEventHandler(java.awt.Component c, ZSurface v)
          Constructs a new ZEventHandler.
 
Method Summary
 void activate()
          Activates this event handler.
 void deactivate()
          Deactivates this event handler.
 ZCamera getCamera()
          Returns the camera that this event handler is associated with.
 java.awt.Component getComponent()
          Returns the component that this event handler is associated with.
 ZSurface getSurface()
          Returns the surface that this event handler is associated with.
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

activated

protected boolean activated

component

protected java.awt.Component component

surface

protected ZSurface surface

keyAdapter

protected java.awt.event.KeyAdapter keyAdapter

mouseAdapter

protected java.awt.event.MouseAdapter mouseAdapter

mouseMotionAdapter

protected java.awt.event.MouseMotionAdapter mouseMotionAdapter
Constructor Detail

ZEventHandler

public ZEventHandler(java.awt.Component c,
                     ZSurface v)
Constructs a new ZEventHandler.
Parameters:
c - The component that this event handler listens to events on
v - The surface that is panned
Method Detail

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)

activate

public void activate()
Activates this event handler.
See Also:
deactivate()

deactivate

public void deactivate()
Deactivates this event handler.
See Also:
activate()

getCamera

public ZCamera getCamera()
Returns the camera that this event handler is associated with.
Returns:
The camera.

getSurface

public ZSurface getSurface()
Returns the surface that this event handler is associated with.
Returns:
The surface.

getComponent

public java.awt.Component getComponent()
Returns the component that this event handler is associated with.
Returns:
The component.