Class EventHandlerManager

java.lang.Object
com.sun.javafx.event.BasicEventDispatcher
com.sun.javafx.event.EventHandlerManager
All Implemented Interfaces:
EventDispatcher

public class EventHandlerManager extends BasicEventDispatcher
An EventDispatcher which allows user event handler / filter registration and when used in an event dispatch chain it forwards received events to the appropriate registered handlers / filters.
  • Constructor Details

    • EventHandlerManager

      public EventHandlerManager(Object eventSource)
  • Method Details

    • addEventHandler

      public final <T extends Event> void addEventHandler(EventType<T> eventType, EventHandler<? super T> eventHandler)
      Registers an event handler in EventHandlerManager.
      Type Parameters:
      T - the specific event class of the handler
      Parameters:
      eventType - the type of the events to receive by the handler
      eventHandler - the handler to register
      Throws:
      NullPointerException - if the event type or handler is null
    • removeEventHandler

      public final <T extends Event> void removeEventHandler(EventType<T> eventType, EventHandler<? super T> eventHandler)
      Unregisters a previously registered event handler.
      Type Parameters:
      T - the specific event class of the handler
      Parameters:
      eventType - the event type from which to unregister
      eventHandler - the handler to unregister
      Throws:
      NullPointerException - if the event type or handler is null
    • addEventFilter

      public final <T extends Event> void addEventFilter(EventType<T> eventType, EventHandler<? super T> eventFilter)
      Registers an event filter in EventHandlerManager.
      Type Parameters:
      T - the specific event class of the filter
      Parameters:
      eventType - the type of the events to receive by the filter
      eventFilter - the filter to register
      Throws:
      NullPointerException - if the event type or filter is null
    • removeEventFilter

      public final <T extends Event> void removeEventFilter(EventType<T> eventType, EventHandler<? super T> eventFilter)
      Unregisters a previously registered event filter.
      Type Parameters:
      T - the specific event class of the filter
      Parameters:
      eventType - the event type from which to unregister
      eventFilter - the filter to unregister
      Throws:
      NullPointerException - if the event type or filter is null
    • setEventHandler

      public final <T extends Event> void setEventHandler(EventType<T> eventType, EventHandler<? super T> eventHandler)
      Sets the specified singleton handler. There can only be one such handler specified at a time.
      Type Parameters:
      T - the specific event class of the handler
      Parameters:
      eventType - the event type to associate with the given eventHandler
      eventHandler - the handler to register, or null to unregister
      Throws:
      NullPointerException - if the event type is null
    • getEventHandler

      public final <T extends Event> EventHandler<? super T> getEventHandler(EventType<T> eventType)
    • dispatchCapturingEvent

      public final Event dispatchCapturingEvent(Event event)
      Overrides:
      dispatchCapturingEvent in class BasicEventDispatcher
    • dispatchBubblingEvent

      public final Event dispatchBubblingEvent(Event event)
      Overrides:
      dispatchBubblingEvent in class BasicEventDispatcher
    • getEventSource

      protected Object getEventSource()
    • setEventSourcesListener

      public static void setEventSourcesListener(EventHandlerManager.EventSourcesListener eventSourcesListener)