Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.jabber
Class WhiteboardParticipantJabberImpl

java.lang.Object
  extended by net.java.sip.communicator.impl.protocol.jabber.WhiteboardParticipantJabberImpl
All Implemented Interfaces:
WhiteboardParticipant

public class WhiteboardParticipantJabberImpl
extends Object
implements WhiteboardParticipant

The WhiteboardParticipantJabberImpl is a class that represents participants in a whiteboard.

Author:
Julien Waechter

Field Summary
protected  Date currentStateStartDate
          Indicates the date when is whiteboard participant passed into its current state.
protected  List<WhiteboardParticipantListener> whiteboardParticipantListeners
          All the WhiteboardParticipant listeners registered with this WhiteboardParticipant.
protected  WhiteboardParticipantState whiteboardParticipantState
          The state of the whiteboard participant.
 
Constructor Summary
WhiteboardParticipantJabberImpl(ContactJabberImpl participant, WhiteboardSessionJabberImpl owningWhiteboard)
          Creates a new whiteboard participant with address participantAddress.
 
Method Summary
 void addWhiteboardParticipantListener(WhiteboardParticipantListener listener)
          Allows the user interface to register a listener interested in changes
protected  void fireWhiteboardParticipantChangeEvent(String eventType, Object oldValue, Object newValue)
          Constructs a WhiteboardParticipantChangeEvent using this whiteboard participant as source, setting it to be of type eventType and the corresponding oldValue and newValue,
protected  void fireWhiteboardParticipantChangeEvent(String eventType, Object oldValue, Object newValue, String reason)
          Constructs a WhiteboardParticipantChangeEvent using this whiteboard participant as source, setting it to be of type eventType and the corresponding oldValue and newValue,
 Contact getContact()
          Returns the contact corresponding to this participant or null if no particular contact has been associated.
 String getContactAddress()
          Returns the contact identifier representing this contact.
 Date getCurrentStateStartDate()
          Returns the date (time) when this whiteboard participant acquired its current status.
 String getDisplayName()
          Returns a human readable name representing this participant.
 byte[] getImage()
          The method returns an image representation of the whiteboard participant (e.g.
 String getName()
          Returns the name of this member
 String getParticipantID()
          Returns a unique identifier representing this participant.
 ProtocolProviderService getProtocolProvider()
          Returns the protocol provider instance that this member has originated in.
 WhiteboardParticipantState getState()
          Returns an object representing the current state of that participant.
 WhiteboardSession getWhiteboardSession()
          Returns the chat room that this member is participating in.
 void removeWhiteboardParticipantListener(WhiteboardParticipantListener listener)
          Unregisters the specified listener.
protected  void setDisplayName(String displayName)
          Sets a human readable name representing this participant.
protected  void setImage(byte[] image)
          Sets the byte array containing an image representation (photo or picture) of the whiteboard participant.
protected  void setParticipantID(String participantID)
          Sets the String that serves as a unique identifier of this WhiteboardParticipant.
protected  void setState(WhiteboardParticipantState newState)
          Causes this WhiteboardParticipant to enter the specified state.
protected  void setState(WhiteboardParticipantState newState, String reason)
          Causes this WhiteboardParticipant to enter the specified state.
protected  void setWhiteboard(WhiteboardSessionJabberImpl whiteboard)
          Sets the whiteboard containing this participant.
 void setWhiteboardSession(WhiteboardSessionJabberImpl session)
          Sets the chat room that this member is participating in.
 String toString()
          Returns a string representation of the participant in the form of
Display Name
;status=WhiteboardParticipantStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

whiteboardParticipantState

protected WhiteboardParticipantState whiteboardParticipantState
The state of the whiteboard participant.


currentStateStartDate

protected Date currentStateStartDate
Indicates the date when is whiteboard participant passed into its current state.


whiteboardParticipantListeners

protected final List<WhiteboardParticipantListener> whiteboardParticipantListeners
All the WhiteboardParticipant listeners registered with this WhiteboardParticipant.

Constructor Detail

WhiteboardParticipantJabberImpl

public WhiteboardParticipantJabberImpl(ContactJabberImpl participant,
                                       WhiteboardSessionJabberImpl owningWhiteboard)
Creates a new whiteboard participant with address participantAddress.

Parameters:
participant - the JAIN SIP Address of the new whiteboard participant.
owningWhiteboard - the whiteboard that contains this whiteboard participant.
Method Detail

getContactAddress

public String getContactAddress()
Returns the contact identifier representing this contact.

Specified by:
getContactAddress in interface WhiteboardParticipant
Returns:
a String contact address

getState

public WhiteboardParticipantState getState()
Returns an object representing the current state of that participant. WhiteboardParticipantState may vary among CONNECTING, BUSY, CONNECTED...

Specified by:
getState in interface WhiteboardParticipant
Returns:
a WhiteboardParticipantState instance representin the participant's state.

setState

protected void setState(WhiteboardParticipantState newState,
                        String reason)
Causes this WhiteboardParticipant to enter the specified state. The method also sets the currentStateStartDate field and fires a WhiteboardParticipantChangeEvent.

Parameters:
newState - the state this whiteboard participant should enter.
reason - a string that could be set to contain a human readable explanation for the transition (particularly handy when moving into a FAILED state).

setState

protected void setState(WhiteboardParticipantState newState)
Causes this WhiteboardParticipant to enter the specified state. The method also sets the currentStateStartDate field and fires a WhiteboardParticipantChangeEvent.

Parameters:
newState - the state this whiteboard participant should enter.

getCurrentStateStartDate

public Date getCurrentStateStartDate()
Returns the date (time) when this whiteboard participant acquired its current status.

Returns:
a java.util.Date object containing the date when this whiteboard participant entered its current state.

getDisplayName

public String getDisplayName()
Returns a human readable name representing this participant.

Returns:
a String containing a name for that participant.

setDisplayName

protected void setDisplayName(String displayName)
Sets a human readable name representing this participant.

Parameters:
displayName - the participant's display name

getImage

public byte[] getImage()
The method returns an image representation of the whiteboard participant (e.g.

Returns:
byte[] a byte array containing the image or null if no image is available.

setImage

protected void setImage(byte[] image)
Sets the byte array containing an image representation (photo or picture) of the whiteboard participant.

Parameters:
image - a byte array containing the image

getParticipantID

public String getParticipantID()
Returns a unique identifier representing this participant.

Returns:
an identifier representing this whiteboard participant.

setParticipantID

protected void setParticipantID(String participantID)
Sets the String that serves as a unique identifier of this WhiteboardParticipant.

Parameters:
participantID - the ID of this whiteboard participant.

getWhiteboardSession

public WhiteboardSession getWhiteboardSession()
Returns the chat room that this member is participating in.

Specified by:
getWhiteboardSession in interface WhiteboardParticipant
Returns:
the WhiteboardSession instance that this member belongs to.

setWhiteboard

protected void setWhiteboard(WhiteboardSessionJabberImpl whiteboard)
Sets the whiteboard containing this participant.

Parameters:
whiteboard - the whiteboard that this whiteboard participant is partdicipating in.

getProtocolProvider

public ProtocolProviderService getProtocolProvider()
Returns the protocol provider instance that this member has originated in.

Specified by:
getProtocolProvider in interface WhiteboardParticipant
Returns:
the ProtocolProviderService instance that created this member and its containing cht room

getContact

public Contact getContact()
Returns the contact corresponding to this participant or null if no particular contact has been associated.

Returns:
the Contact corresponding to this participant or null if no particular contact has been associated.

addWhiteboardParticipantListener

public void addWhiteboardParticipantListener(WhiteboardParticipantListener listener)
Allows the user interface to register a listener interested in changes

Specified by:
addWhiteboardParticipantListener in interface WhiteboardParticipant
Parameters:
listener - a listener instance to register with this participant.

removeWhiteboardParticipantListener

public void removeWhiteboardParticipantListener(WhiteboardParticipantListener listener)
Unregisters the specified listener.

Specified by:
removeWhiteboardParticipantListener in interface WhiteboardParticipant
Parameters:
listener - the listener to unregister.

fireWhiteboardParticipantChangeEvent

protected void fireWhiteboardParticipantChangeEvent(String eventType,
                                                    Object oldValue,
                                                    Object newValue)
Constructs a WhiteboardParticipantChangeEvent using this whiteboard participant as source, setting it to be of type eventType and the corresponding oldValue and newValue,

Parameters:
eventType - the type of the event to create and dispatch.
oldValue - the value of the source property before it changed.
newValue - the current value of the source property.

fireWhiteboardParticipantChangeEvent

protected void fireWhiteboardParticipantChangeEvent(String eventType,
                                                    Object oldValue,
                                                    Object newValue,
                                                    String reason)
Constructs a WhiteboardParticipantChangeEvent using this whiteboard participant as source, setting it to be of type eventType and the corresponding oldValue and newValue,

Parameters:
eventType - the type of the event to create and dispatch.
oldValue - the value of the source property before it changed.
newValue - the current value of the source property.
reason - a string that could be set to contain a human readable explanation for the transition (particularly handy when moving into a FAILED state).

toString

public String toString()
Returns a string representation of the participant in the form of
Display Name
;status=WhiteboardParticipantStatus

Overrides:
toString in class Object
Returns:
a string representation of the participant and its state.

getName

public String getName()
Returns the name of this member

Specified by:
getName in interface WhiteboardParticipant
Returns:
the name of this member in the room (nickname).

setWhiteboardSession

public void setWhiteboardSession(WhiteboardSessionJabberImpl session)
Sets the chat room that this member is participating in.

Parameters:
session -

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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