Interface PlatformEventManager


  • public interface PlatformEventManager

    Definition of an interface for dealing with platform (i.e. a specific GUI library) specific events.

    This interface defines the link between the generic event handling mechanism provided by the form framework and the library specific event handling support. A concrete implementation has to intercept native component events and transform them into the generic event types. Then the transformed events are passed to the FormEventManager.

    This interface defines only methods for registering and deregistering event listeners of a certain type at a component defined by a ComponentHandler object. These methods will be called by the FormEventManager class, which will already perform some synchronization and pre-processing. So it is guaranteed that synchronization is performed on the form listener type, i.e. no listeners of the same type will be added or removed concurrently. FormEventManager will further invoke the registerListener method only once for a combination of component handler and event listener type. This means that the FormEventManager instance is the only event listener for the available components; is is itself responsible for multiplexing of event notifications. These facts can be used by a concrete implementation for doing some optimization.

    Note: It cannot be guaranteed that all ComponentHandler objects passed to the methods defined by this interface have been created by the current ComponentManager. For instance, there can be other custom handler implementations created by special tag handler classes. This may be an issue for platform-specific implementations that expect the ComponentHandler objects to be derived from a specific base class.

    Version:
    $Id: PlatformEventManager.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Method Detail

      • registerListener

        void registerListener​(String name,
                              ComponentHandler<?> handler,
                              FormEventManager eventManager,
                              FormListenerType type)
        Registers an event listener of the given type at the specified component. This method is called when the first event listener of the affected type is registered at this component. The FormEventManager then registers itself as event listener so that it can multiplex incoming events to all registered listeners.
        Parameters:
        name - the component's name (must be contained in the FormEvent objects generated by this implementation)
        handler - the component handler of the affected component
        eventManager - the event manager that must be invoked when an event occurs
        type - the event listener type
      • unregisterListener

        void unregisterListener​(String name,
                                ComponentHandler<?> handler,
                                FormEventManager eventManager,
                                FormListenerType type)
        Removes an event listener of the given type from the specified component. This method is called by the FormEventManager when the last event listener of the affected type deregisters from this component.
        Parameters:
        name - the name of the affected component
        handler - the component handler of this component
        eventManager - the event manager
        type - the event listener type