Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.service.neomedia.event
Class VideoNotifierSupport

java.lang.Object
  extended by net.java.sip.communicator.service.neomedia.event.VideoNotifierSupport

public class VideoNotifierSupport
extends Object

Represents a mechanism to easily add to a specific Object by means of composition support for firing VideoEvents to VideoListeners.

Author:
Lyubomir Marinov

Constructor Summary
VideoNotifierSupport(Object source)
          Initializes a new VideoNotifierSupport instance which is to facilitate the management of VideoListeners and firing VideoEvents to them for a specific Object.
VideoNotifierSupport(Object source, boolean synchronous)
          Initializes a new VideoNotifierSupport instance which is to facilitate the management of VideoListeners and firing VideoEvents to them for a specific Object.
 
Method Summary
 void addVideoListener(VideoListener listener)
          Adds a specific VideoListener to this VideoNotifierSupport in order to receive notifications when visual/video Components are being added and removed.
protected  void doFireVideoEvent(VideoEvent event)
           
 boolean fireVideoEvent(int type, Component visualComponent, int origin, boolean wait)
          Notifies the VideoListeners registered with this VideoMediaStream about a specific type of change in the availability of a specific visual Component depicting video.
 void fireVideoEvent(VideoEvent event, boolean wait)
          Notifies the VideoListeners registered with this instance about a specific VideoEvent.
 void removeVideoListener(VideoListener listener)
          Removes a specific VideoListener from this VideoNotifierSupport in order to have to no longer receive notifications when visual/video Components are being added and removed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VideoNotifierSupport

public VideoNotifierSupport(Object source)
Initializes a new VideoNotifierSupport instance which is to facilitate the management of VideoListeners and firing VideoEvents to them for a specific Object.

Parameters:
source - the Object which is to be reported as the source of the VideoEvents fired by the new instance

VideoNotifierSupport

public VideoNotifierSupport(Object source,
                            boolean synchronous)
Initializes a new VideoNotifierSupport instance which is to facilitate the management of VideoListeners and firing VideoEvents to them for a specific Object.

Parameters:
source - the Object which is to be reported as the source of the VideoEvents fired by the new instance
synchronous - true if the new instance is to deliver the VideoEvents synchronously; otherwise, false
Method Detail

addVideoListener

public void addVideoListener(VideoListener listener)
Adds a specific VideoListener to this VideoNotifierSupport in order to receive notifications when visual/video Components are being added and removed.

Adding a listener which has already been added does nothing i.e. it is not added more than once and thus does not receive one and the same VideoEvent multiple times.

Parameters:
listener - the VideoListener to be notified when visual/video Components are being added or removed in this VideoNotifierSupport

doFireVideoEvent

protected void doFireVideoEvent(VideoEvent event)

fireVideoEvent

public boolean fireVideoEvent(int type,
                              Component visualComponent,
                              int origin,
                              boolean wait)
Notifies the VideoListeners registered with this VideoMediaStream about a specific type of change in the availability of a specific visual Component depicting video.

Parameters:
type - the type of change as defined by VideoEvent in the availability of the specified visual Component depicting video
visualComponent - the visual Component depicting video which has been added or removed
origin - VideoEvent.LOCAL if the origin of the video is local (e.g. it is being locally captured); VideoEvent.REMOTE if the origin of the video is remote (e.g. a remote peer is streaming it)
wait - true if the call is to wait till the specified VideoEvent has been delivered to the VideoListeners; otherwise, false
Returns:
true if this event and, more specifically, the visual Component it describes have been consumed and should be considered owned, referenced (which is important because Components belong to a single Container at a time); otherwise, false

fireVideoEvent

public void fireVideoEvent(VideoEvent event,
                           boolean wait)
Notifies the VideoListeners registered with this instance about a specific VideoEvent.

Parameters:
event - the VideoEvent to be fired to the VideoListeners registered with this instance
wait - true if the call is to wait till the specified VideoEvent has been delivered to the VideoListeners; otherwise, false

removeVideoListener

public void removeVideoListener(VideoListener listener)
Removes a specific VideoListener from this VideoNotifierSupport in order to have to no longer receive notifications when visual/video Components are being added and removed.

Parameters:
listener - the VideoListener to no longer be notified when visual/video Components are being added or removed

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.