Skip to end of metadata
Go to start of metadata

As described in the Section on the built-in predicate listen, Prova rulebase can register a listener for action, change, mouse and motion Swing events. Behind the scenes, the class ProvaSwingAdaptor is the class that is the actual listener and all it does is mapping of the detected Swing events to messages that get executed on a specially designated Swing thread.

We reproduce below the messages this listener sends to the Prova rulebase on receiving events from UI. The messages are always sent on conversation-id fixed to the String ?s?.

All the rulebase has to do then is initialize reactions for message patterns matching the above messages. This is an example of a global reaction.

This is a detection of an event pattern corresponding to a mouse gesture using the Prova reaction groups.

We recommend that you study the included example swing_rx.prova that follows and extends the following example of the Rx framework that is part of .NET 4.0: http://themechanicalbride.blogspot.com/2009/07/developing-with-rx-part-1-extension.html. In particular, the ?click extension event? is significantly more compact and efficient in Prova and is also extended in swing_rx.prova to a more complex case that involves negation.

Labels: