Package com.brightcove.player.event
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
,FreeWheelController
,GoogleCastComponent
,GoogleIMAComponent
,LifecycleUtil
,LiveVideoOrchestrator
,LoadCaptionsService
,MediaPlayerPlayback
,OmnitureComponent
,PulseComponent
,SeekManager
,ShutterViewController
,SSAIComponent
,ThumbnailComponent
,TimelineManager
,UIManager
,UiTimedTracker
,VideoDisplayComponent
,VideoPlaybackController
,VideoStillDisplayComponent
public abstract class AbstractComponent extends java.lang.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 Summary
Fields Modifier and Type Field Description protected EventEmitter
eventEmitter
protected java.util.Map<java.lang.String,java.lang.Integer>
listenerTokens
-
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 initializedvoid
removeListener(java.lang.String eventType)
Removes the specified listener from the EventEmitter.void
removeListeners()
Removes all set listeners from the EventEmitter.
-
-
-
Field Detail
-
eventEmitter
protected EventEmitter eventEmitter
-
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 calledlistener
- 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 calledlistener
- 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
-
-