Saturday, March 25, 2006

adding event magic to the framework

Events are part of the magic of Rolonics--stream/structure/stream.

Events are simplified XML elements. Each event object has a name (element name), attributes (name/value pairs) and a content (a list of events). Indeed, event.toString() expresses an XML fragment, so its ideal for use in transporting information across the internet.

I've added an events package which defines Event and has a Composer class as well. The Composer converts a series of calls (i.e. a call stream) into an event tree.

Then I wrote the TextClientIteration class, which accepts a page event and returns the user response. Currently the Page event only contains Text, Break and Prompt events.

Finally I converted the UIs to generate these events. This completes the event framework.

Now I need to replace all the calls to print and println into calls on the composer to construct a variety of non-text events and add the appropriate event processing logic to TextClientIteration. By this means I can move all text-specific logic into the text client.

And then I can define other types of clients! Hey, it feels a bit like magic. This is the key to supporting a range of client types, as well as the generation of TeX documents. Cool stuff!

Bill

0 Comments:

Post a Comment

<< Home