Package com.itextpdf.kernel.events
Class EventDispatcher
java.lang.Object
com.itextpdf.kernel.events.EventDispatcher
- All Implemented Interfaces:
-
IEventDispatcher
IEventDispatcher implementation that forwards Events to registered
IEventHandler
implementations.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addEventHandler
(String type, IEventHandler handler) Adds new event handler.void
dispatchEvent
(Event event) Dispatches an event.void
dispatchEvent
(Event event, boolean delayed) Dispatches a delayed event.boolean
hasEventHandler
(String type) Checks if event dispatcher as an event handler assigned for a certain event type.void
Remove all event handlers.void
removeEventHandler
(String type, IEventHandler handler) Removes event handler.
-
Field Details
-
eventHandlers
-
-
Constructor Details
-
EventDispatcher
public EventDispatcher()
-
-
Method Details
-
addEventHandler
Description copied from interface:IEventDispatcher
Adds new event handler.- Specified by:
-
addEventHandler
in interfaceIEventDispatcher
- Parameters:
-
type
- a type of event to be handled -
handler
- event handler
-
dispatchEvent
Description copied from interface:IEventDispatcher
Dispatches an event.- Specified by:
-
dispatchEvent
in interfaceIEventDispatcher
- Parameters:
-
event
- theEvent
to be dispatched
-
dispatchEvent
Description copied from interface:IEventDispatcher
Dispatches a delayed event. Sometimes event cannot be handled immediately because event handler has not been set yet. In this case event is placed into event ques of dispatcher and is waiting until handler is assigned.- Specified by:
-
dispatchEvent
in interfaceIEventDispatcher
- Parameters:
-
event
- theEvent
to be dispatched -
delayed
- flag whetherEvent
delayed or not
-
hasEventHandler
Description copied from interface:IEventDispatcher
Checks if event dispatcher as an event handler assigned for a certain event type.- Specified by:
-
hasEventHandler
in interfaceIEventDispatcher
- Parameters:
-
type
- a type of theEvent
- Returns:
- true if event dispatcher as an event handler assigned for a certain event type
-
removeEventHandler
Description copied from interface:IEventDispatcher
Removes event handler.- Specified by:
-
removeEventHandler
in interfaceIEventDispatcher
- Parameters:
-
type
- a type of theEvent
-
handler
- event handlerIEventHandler
-
removeAllHandlers
public void removeAllHandlers()Description copied from interface:IEventDispatcher
Remove all event handlers.- Specified by:
-
removeAllHandlers
in interfaceIEventDispatcher
-