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 theFormEventManager
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 theregisterListener
method only once for a combination of component handler and event listener type. This means that theFormEventManager
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 currentComponentManager
. 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 theComponentHandler
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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
registerListener(String name, ComponentHandler<?> handler, FormEventManager eventManager, FormListenerType type)
Registers an event listener of the given type at the specified component.void
unregisterListener(String name, ComponentHandler<?> handler, FormEventManager eventManager, FormListenerType type)
Removes an event listener of the given type from the specified component.
-
-
-
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. TheFormEventManager
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 theFormEvent
objects generated by this implementation)handler
- the component handler of the affected componenteventManager
- the event manager that must be invoked when an event occurstype
- 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 theFormEventManager
when the last event listener of the affected type deregisters from this component.- Parameters:
name
- the name of the affected componenthandler
- the component handler of this componenteventManager
- the event managertype
- the event listener type
-
-