Package diva.canvas.event

Event-handling support for the Diva canvas. Because the canvas pane and layers in Diva implement an independent, floating-point, coordinate system, this package has to re-implement some of the basic AWT support for mouse events. A new event type, LayerEvent, which subclasses java.awt.event.MouseEvent, represents on layers and on graphical figures. It contains both the original screen coordinates of the mouse event and those coordinates translated unto the coordinate system of the containing canvas pane.

Corresponding to the layer event class are two new listener classes, LayerListener and LayerMotionListener. The former handles mouse press, drag, and release events, and the latter mouse enter, motion, and leave events. This separation avoid needless inefficiency in interactive canvases. Events can be received from Figure objects, and from the special-purpose EventLayer, which dispatches any events it received to its listeners.

An additional class, EventDispatcher is used to dispatch events to attached listeners. This class is used by the top-level package to group figures into common event-handling classes.