Class EventRouter

Event router class implementing the inheritable event listening model. For more information on the event model see the package documentation .

Synopsis

Since

3.0

Inheritance Path.  java.lang.Object-> com.itmill.toolkit.event.EventRouter

addListener(Class, Object, Method)

Parameters

eventType

type of the listened event. Events of this type or its subclasses activate the listener.

object

the object instance who owns the activation method

method

the activation method

Exceptions

java.lang.IllegalArgumentException

unless method has exactly one match in object

Description copied from interface: addListener

Registers a new event listener with the specified activation method to listen events generated by this component. If the activation method does not have any arguments the event object will not be passed to it when it's called.

For more information on the inheritable event mechanism see the com.itmill.toolkit.event package documentation .

addListener(Class, Object, String)

Parameters

eventType

type of the listened event. Events of this type or its subclasses activate the listener.

object

the object instance who owns the activation method

methodName

the name of the activation method

Exceptions

java.lang.IllegalArgumentException

unless method has exactly one match in object

Description copied from interface: addListener

Registers a new listener with the specified activation method to listen events generated by this component. If the activation method does not have any arguments the event object will not be passed to it when it's called.

This version of addListener gets the name of the activation method as a parameter. The actual method is reflected from object , and unless exactly one match is found, java.lang.IllegalArgumentException is thrown.

For more information on the inheritable event mechanism see the com.itmill.toolkit.event package documentation .

fireEvent(EventObject)

Parameters

event

Event to be sent to all listeners

Send an event to all registered listeners. The listeners will decide if the activation method should be called or not.

removeAllListeners()

Remove all listeners from event router

removeListener(Class, Object)

Parameters

eventType

exact event type the object listens to

target

target object that has registered to listen to events of type eventType with one or more methods

Description copied from interface: removeListener

Removes all registered listeners matching the given parameters. Since this method receives the event type and the listener object as parameters, it will unregister all object 's methods that are registered to listen to events of type eventType generated by this component.

For more information on the inheritable event mechanism see the com.itmill.toolkit.event package documentation .

removeListener(Class, Object, Method)

Parameters

eventType

exact event type the object listens to

target

target object that has registered to listen to events of type eventType with one or more methods

method

the method owned by target that's registered to listen to events of type eventType

Description copied from interface: removeListener

Removes one registered listener method. The given method owned by the given object will no longer be called when the specified events are generated by this component.

For more information on the inheritable event mechanism see the com.itmill.toolkit.event package documentation .

removeListener(Class, Object, String)

Parameters

eventType

exact event type the object listens to

target

target object that has registered to listen to events of type eventType with one or more methods

methodName

name of the method owned by target that's registered to listen to events of type eventType

Description copied from interface: removeListener

Removes one registered listener method. The given method owned by the given object will no longer be called when the specified events are generated by this component.

This version of removeListener gets the name of the activation method as a parameter. The actual method is reflected from target , and unless exactly one match is found, java.lang.IllegalArgumentException is thrown.

For more information on the inheritable event mechanism see the com.itmill.toolkit.event package documentation .