Class EventDispatcher

java.lang.Object
com.itextpdf.kernel.events.EventDispatcher
All Implemented Interfaces:
IEventDispatcher

public class EventDispatcher extends Object implements IEventDispatcher
IEventDispatcher implementation that forwards Events to registered IEventHandler implementations.
  • Field Details

  • Constructor Details

    • EventDispatcher

      public EventDispatcher()
  • Method Details

    • addEventHandler

      public void addEventHandler (String type, IEventHandler handler)
      Description copied from interface: IEventDispatcher
      Adds new event handler.
      Specified by:
      addEventHandler in interface IEventDispatcher
      Parameters:
      type - a type of event to be handled
      handler - event handler
    • dispatchEvent

      public void dispatchEvent (Event event)
      Description copied from interface: IEventDispatcher
      Dispatches an event.
      Specified by:
      dispatchEvent in interface IEventDispatcher
      Parameters:
      event - the Event to be dispatched
    • dispatchEvent

      public void dispatchEvent (Event event, boolean delayed)
      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 interface IEventDispatcher
      Parameters:
      event - the Event to be dispatched
      delayed - flag whether Event delayed or not
    • hasEventHandler

      public boolean hasEventHandler (String type)
      Description copied from interface: IEventDispatcher
      Checks if event dispatcher as an event handler assigned for a certain event type.
      Specified by:
      hasEventHandler in interface IEventDispatcher
      Parameters:
      type - a type of the Event
      Returns:
      true if event dispatcher as an event handler assigned for a certain event type
    • removeEventHandler

      public void removeEventHandler (String type, IEventHandler handler)
      Description copied from interface: IEventDispatcher
      Removes event handler.
      Specified by:
      removeEventHandler in interface IEventDispatcher
      Parameters:
      type - a type of the Event
      handler - event handler IEventHandler
    • removeAllHandlers

      public void removeAllHandlers()
      Description copied from interface: IEventDispatcher
      Remove all event handlers.
      Specified by:
      removeAllHandlers in interface IEventDispatcher