Class AbstractComponent

java.lang.Object
com.brightcove.player.event.AbstractComponent
All Implemented Interfaces:
Component
Direct Known Subclasses:
AbstractButtonController, AdCuePointComponent, AdOverlayHandler, Analytics, BrightcoveAudioTracksController, BrightcoveCastMediaManager, BrightcoveClosedCaptioningController, BrightcoveMediaController, BrightcovePluginManager, BrightcoveSeekBarController, BrightcoveShowHideController, Catalog, CompanionAdHandler, ConcurrencyClient, DefaultSourceSelectionController, ExoAdPlayer, ExoMediaPlayback, FreeWheelAnalytics, FreeWheelController, GoogleCastComponent, GoogleIMAComponent, IMAAnalytics, LifecycleUtil, LiveVideoOrchestrator, LoadCaptionsService, MediaPlayerPlayback, OmnitureComponent, PulseComponent, SeekManager, ShutterViewController, SSAIAnalytics, SSAIComponent, ThumbnailComponent, TimelineManager, UIManager, UiTimedTracker, VideoDisplayComponent, VideoPlaybackController, VideoStillDisplayComponent

public abstract class AbstractComponent extends Object implements Component
Provides some common implementation that useful to all that interact with RegisteringEventEmitters components, including:
  • Maintaining a reference to an EventEmitter
  • Wraps incoming EventEmitter in a RegisteringEventEmitter
  • Ensures incoming EventEmitter is not null
  • Maintains a collection of EventListener tokens for use with EventEmitter.off()
  • Provides standard required method for initializing Event listeners
  • Field Details

  • Constructor Details

    • AbstractComponent

      public AbstractComponent(EventEmitter eventEmitter, 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 Details

    • addListener

      public void addListener(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(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(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