EventEngine Class Reference

List of all members.

Public Member Functions

 EventEngine ()
 This object handles event dispatch by hooking up pen listeners to local and remote pen servers.
void addEventHandlerForUnmappedEvents (EventHandler handler)
 This can detect and process events when it's outside of any other region.
EventReplayManager getEventReplayManager ()
void handlePenEvent (PenEvent penEvent)
 All pen events go through here.
void handlePenUpEvent (PenEvent event)
 Send the penUp to the event handlers.
void register (PenInput pen)
 If you register a pen multiple times, a different pen listener will be attached to the pen.
void registerPatternMapForEventHandling (PatternLocationToSheetLocationMapping mapping)
 Really, this is the only method we need to do runtime binding.
void registerPatternMapsForEventHandling (Collection< PatternLocationToSheetLocationMapping > patternMaps)
 Keep track of the pattern on sheets, so we can dispatch events appropriately.
void removeEventHandlerForUnmappedEvents (EventHandler handler)
void unregisterAllPatternMaps ()
 To reset the event engine at runtime.
void unregisterPatternMapForEventHandling (PatternLocationToSheetLocationMapping patternMap)
void unregisterPatternMapsForEventHandling (Collection< PatternLocationToSheetLocationMapping > patternMaps)
 Remove these maps from our runtime list.
void unregisterPen (PenInput pen)
 Stop watching this pen input device.

Detailed Description

When you ask the PaperToolkit to run a paper Application, there will be exactly one EventEngine handling all pen events for that Application. This EventEngine will process batched pen data, and also handle streaming data. We will tackle streaming first.

This class is responsible for sending data to the event handlers, which will create clicks, drags, etc.

This software is distributed under the BSD License.

Author:
Ron B Yeh (ronyeh(AT)cs.stanford.edu)

Definition at line 38 of file EventEngine.java.


Constructor & Destructor Documentation

EventEngine (  ) 

This object handles event dispatch by hooking up pen listeners to local and remote pen servers.

It will figure out where to dispatch incoming pen samples... and will activate the correct event handlers.

Definition at line 94 of file EventEngine.java.


Member Function Documentation

void addEventHandlerForUnmappedEvents ( EventHandler  handler  ) 

This can detect and process events when it's outside of any other region.

..

Parameters:
handler 

Definition at line 103 of file EventEngine.java.

EventReplayManager getEventReplayManager (  ) 

Returns:
the replay manager, allowing access to saved event streams.

Definition at line 151 of file EventEngine.java.

void handlePenEvent ( PenEvent  penEvent  ) 

All pen events go through here.

We dispatch it to the right handlers in this method. Will this have a ConcurrentModification problem, because we are iterating through the actual patternToSheetMaps list that can be updated at runtime?

TODO: Should this be multithreaded, for performance reasons?

TODO: Should this have synchronized access to patternToSheetMaps, for race conditions?

Parameters:
penEvent 

Definition at line 222 of file EventEngine.java.

References Region.getEventHandlers(), PenEvent.getOriginalSample(), Sheet.getRegion(), PatternCoordinateConverter.getRegionName(), PatternCoordinateConverter.getRelativeLocation(), PenEvent.getStreamedPatternCoordinate(), and PenEvent.setPercentageLocation().

Referenced by EventReplayManager.replay().

void handlePenUpEvent ( PenEvent  event  ) 

Send the penUp to the event handlers.

..

Parameters:
event 

Definition at line 315 of file EventEngine.java.

References PenEvent.setPercentageLocation().

Referenced by EventReplayManager.replay().

void register ( PenInput  pen  ) 

If you register a pen multiple times, a different pen listener will be attached to the pen.

Only ONE EventEngine listener will be attached to a pen at one time. Otherwise, multiple events would get fired by the same pen.

Why would you want to register a single pen multiple times? I dunnno. For some reason I added support for it... but perhaps I'll remove it in the future. :)

Parameters:
pen 

Definition at line 347 of file EventEngine.java.

Referenced by PaperToolkit.startApplication().

void registerPatternMapForEventHandling ( PatternLocationToSheetLocationMapping  mapping  ) 

Really, this is the only method we need to do runtime binding.

Who cares if the sheet doesn't have the right mapping, anyways?

Parameters:
mapping 

Definition at line 368 of file EventEngine.java.

void registerPatternMapsForEventHandling ( Collection< PatternLocationToSheetLocationMapping patternMaps  ) 

Keep track of the pattern on sheets, so we can dispatch events appropriately.

Parameters:
patternMaps 

Definition at line 381 of file EventEngine.java.

Referenced by PaperToolkit.startApplication().

void removeEventHandlerForUnmappedEvents ( EventHandler  handler  ) 

Parameters:
strokeHandler 

Definition at line 392 of file EventEngine.java.

void unregisterPatternMapForEventHandling ( PatternLocationToSheetLocationMapping  patternMap  ) 

Parameters:
patternMap 

Definition at line 417 of file EventEngine.java.

Referenced by Application.removeSheet().

void unregisterPatternMapsForEventHandling ( Collection< PatternLocationToSheetLocationMapping patternMaps  ) 

Remove these maps from our runtime list.

Parameters:
patternMaps 

Definition at line 426 of file EventEngine.java.

Referenced by PaperToolkit.stopApplication().

void unregisterPen ( PenInput  pen  ) 

Stop watching this pen input device.

Parameters:
pen 

Definition at line 436 of file EventEngine.java.

Referenced by PaperToolkit.stopApplication().


The documentation for this class was generated from the following file:
Generated on Sat Apr 14 18:21:41 2007 for R3 Paper Toolkit by  doxygen 1.4.7