Inheritance diagram for EventHandler:
Public Member Functions
|void||addParentRegion (Region r)|
|List< Region >||getParentRegions ()|
|abstract void||handleEvent (PenEvent event)|
|if this event should be consumed (i.e., lower priority event handlers should not see this event), we should set the event.consumed property to true |
|void||showMe (String message)|
|abstract String||toString ()|
|List< Region >||parentRegions = new ArrayList<Region>()|
|This is used in debugging visualizations, for traversing up the list to figure out where the event handler should be positioned. |
We have merged Filters into Event Handlers. Filters are both similar to and different from EventHandlers. They are similar in the sense that they can be added to regions. When ink is written on a region, the data will be sent to a filter that is attached to that region.
Filters are different that event handlers because they transform incoming pen data into something qualitatively different, instead of just telling a piece of code that an event has arrived. For example, one could implement a filter that inverts pen samples' y value on a page (dunno why, but it's a fun example). Then, you can add an event handler to this filter. The event handler would then get PenEvents with upside down pen samples.
A more intricate filter would be an ink container. It can collect all ink that passes through the filter, and tell a handler that new ink has arrived. Whenever the handler needs the ink, it can request it from the ink container. Because of the custom nature of filters, it might be that each filter has a custom event handler. For example, an InkContainer might have an InkContainer listener. We can implement these as inner classes.
Filters can change the incoming event stream. For example, it might only care about events that affect certain parts of the region. Events that are not close to these parts will be ignored.
This software is distributed under the BSD License.
Definition at line 53 of file EventHandler.java.
|abstract String toString||(||)||