Event model
Appearance
The event model is a programming paradigm commonly used in building graphical user interfaces. A very common and very programmer-friendly variant is the delegate event model, which is provided by the most popular graphic frameworks.
Delegate event model
This model is based on three entities:
- a control, which is the event source
- some consumers, also called listeners, that receives the events from the source.
- some interfaces (in the broader meaning of the term), that describe the protocol by which every event as to be communicated.
Furtermore the model requires that:
- every listener must implement the interface for the event it wants to listen to (done at programming time)
- every listener must register to the source, to declare is will to listent some particular events (done at runtime)
- every time that the source generates an event, it communicates it to the registered lsteners, following the protocol of the interface