Class AbstractComponent

    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractComponent​(EventEmitter eventEmitter)
      Build an AbstractComponent that does not use a registering event emitter.
      AbstractComponent​(EventEmitter eventEmitter, java.lang.Class<? extends Component> componentClass)
      Being Components, Controllers inheriting from AbstractController require an EventEmitter on initialization.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addListener​(java.lang.String eventType, EventListener listener)
      Convenience method to add an EventListener for the given type using the EventEmitter.on() method.
      void addOnceListener​(java.lang.String eventType, EventListener listener)
      Convenience method to add an EventListener for the given type using the EventEmitter.once() method.
      EventEmitter getEventEmitter()
      Provides a reference to the EventEmitter with which this component was initialized
      void removeListener​(java.lang.String eventType)
      Removes the specified listener from the EventEmitter.
      void removeListeners()
      Removes all set listeners from the EventEmitter.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • listenerTokens

        protected java.util.Map<java.lang.String,​java.lang.Integer> listenerTokens
    • Constructor Detail

      • AbstractComponent

        public AbstractComponent​(EventEmitter eventEmitter,
                                 java.lang.Class<? extends Component> componentClass)
        Being Components, Controllers inheriting from AbstractController require an EventEmitter on initialization.
        Parameters:
        eventEmitter - the EventEmitter through which this Component will listen for and emit events to interact with other components in the player
      • AbstractComponent

        public AbstractComponent​(EventEmitter eventEmitter)
        Build an AbstractComponent that does not use a registering event emitter.
        Parameters:
        eventEmitter - the EventEmitter through which this Component will listen for and emit events to interact with other components in the player
    • Method Detail

      • addListener

        public void addListener​(java.lang.String eventType,
                                EventListener listener)
        Convenience method to add an EventListener for the given type using the EventEmitter.on() method.
        Parameters:
        eventType - the EventType for which the listener should be called
        listener - the implementation of EventListener for this EventType
      • addOnceListener

        public void addOnceListener​(java.lang.String eventType,
                                    EventListener listener)
        Convenience method to add an EventListener for the given type using the EventEmitter.once() method.
        Parameters:
        eventType - the EventType for which the listener should be called
        listener - the implementation of EventListener for this EventType
      • removeListener

        public void removeListener​(java.lang.String eventType)
        Removes the specified listener from the EventEmitter.
        Parameters:
        eventType - the EventType for which the listener should be called
      • removeListeners

        public void removeListeners()
        Removes all set listeners from the EventEmitter.
      • getEventEmitter

        public EventEmitter getEventEmitter()
        Provides a reference to the EventEmitter with which this component was initialized
        Returns:
        the EventEmitter used by this Component