Package org.millstone.base.event

Provides classes and interfaces for the MillStone inheritable event model.

See:
          Description

Interface Summary
Action.Container Interface implemented by all components where actions can be registered.
Action.Handler Interface implemented by classes who wish to handle actions.
MethodEventSource Interface for classes supporting registeration of methods as event receivers.
 

Class Summary
Action Implements the MillStone action framework.
EventRouter Event router class implementing the MillStone inheritable event listening model.
ListenerMethod One registered event listener.
 

Exception Summary
 

Package org.millstone.base.event Description

Provides classes and interfaces for the MillStone inheritable event model. The model supports inheritable events and a flexible way of registering and unregistering event listeners. It's a fundamental building block of the MillStone framework, and as it is included in AbstractComponent, all UI components automatically support it.

Package Specification

The core of the MillStone event model is the inheritable event class hierarchy, and the EventRouter which provide a simple, ubiquitous mechanism to transport events to all interested parties.

The power of the event inheritance arises from the possibility of receiving not only the events of the registered type, but also the ones which are inherited from it. For example, let's assume that there are the events GeneralEvent and SpecializedEvent so that the latter inherits the former. Furthermore we have an object A which registers to receive GeneralEvent type events from the object B. A would of course receive all GeneralEvents generated by B, but in addition to this, A would also receive all SpecializedEvents generated by B. However, if B generates some other events that do not have GeneralEvent as an ancestor, A would not receive them unless it registers to listen for them, too.

The interface to attaching and detaching listeners to and from an object works with methods. One specifies the event that should trigger the listener, the trigger method that should be called when a suitable event occurs and the object owning the method. From these a new listener is constructed and added to the event router of the specified component.

The interface is defined in MethodEventSource, and a straightforward implementation of it is defined in EventRouter which also includes a method to actually fire the events.

All fired events are passed to all registered listeners, which are of type ListenerMethod. The listener then checks if the event type matches with the specified event type and calls the specified trigger method if it does.



Copyright © 2000,2001,2002 IT Mill Ltd. All Rights Reserved.