Class HandlerManager

  • Direct Known Subclasses:
    AbstractChart

    public abstract class HandlerManager
    extends Object
    Manager to add, remove event handlers and firing events to registered handlers.
    This is currently implemented by all charts.
    Author:
    Andrea "Stock" Stocchero
    • Constructor Detail

      • HandlerManager

        protected HandlerManager()
        Creates an empty handler manager
    • Method Detail

      • getSource

        protected abstract IsChart getSource()
        Returns a chart instance as source for all events.
        Returns:
        a chart instance as source for all events
      • addHandler

        public HandlerRegistration addHandler​(EventHandler handler,
                                              EventType type)
        Adds a event handler.
        Parameters:
        handler - handler instance to add
        type - the event type associated with handler
        Returns:
        the handler registration in order to remove the handler later
      • fireEvent

        public void fireEvent​(Event event)
        Fires the event to the handlers.
        Parameters:
        event - the event to fire
      • getHandlerCount

        public final int getHandlerCount​(EventType type)
        Returns the amount of handlers for a specific event type.
        Parameters:
        type - event type to use to get the amount of handlers
        Returns:
        the amount of handlers for a specific event type
      • isEventHandled

        public final boolean isEventHandled​(EventType type)
        Returns true if there is any event handler for event type passed as argument.
        Parameters:
        type - event type to check
        Returns:
        true if there is any event handler for event type passed as argument