Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.gui.main.chat.conference
Class ConferenceChatSession

java.lang.Object
  extended by net.java.sip.communicator.impl.gui.main.chat.ChatSession
      extended by net.java.sip.communicator.impl.gui.main.chat.conference.ConferenceChatSession
All Implemented Interfaces:
EventListener, ChatRoomMemberPresenceListener, ChatRoomPropertyChangeListener

public class ConferenceChatSession
extends ChatSession
implements ChatRoomMemberPresenceListener, ChatRoomPropertyChangeListener

An implementation of ChatSession for conference chatting.

Author:
Yana Stamcheva, Lubomir Marinov, Valentin Martinet

Field Summary
 
Fields inherited from class net.java.sip.communicator.impl.gui.main.chat.ChatSession
chatHistoryFilter, chatParticipants, chatTransports
 
Constructor Summary
ConferenceChatSession(ChatSessionRenderer sessionRenderer, ChatRoomWrapper chatRoomWrapper)
          Creates an instance of ConferenceChatSession, by specifying the sessionRenderer to be used for communication with the UI and the chatRoom corresponding to this conference session.
 
Method Summary
 void addChatTransportChangeListener(ChatSessionChangeListener l)
          Adds the given ChatSessionChangeListener to the list of transport listeners.
 void addLocalUserRoleListener(ChatRoomLocalUserRoleListener l)
          Adds the given ChatRoomLocalUserRoleListener to the contained chat room role listeners.
 void addMemberRoleListener(ChatRoomMemberRoleListener l)
          Adds the given ChatRoomMemberRoleListener to the contained chat room role listeners.
 void chatRoomPropertyChanged(ChatRoomPropertyChangeEvent evt)
          Updates the chat panel when a property of the chat room has been modified.
 void chatRoomPropertyChangeFailed(ChatRoomPropertyChangeFailedEvent event)
          Called to indicate that a change of a chat room property has failed.
 void dispose()
          Disposes this chat session.
 byte[] getChatAvatar()
          Returns the avatar icon of this chat session.
 ChatRoomConfigurationForm getChatConfigurationForm()
          Returns the configuration form corresponding to the chat room.
 String getChatName()
          Returns the name of the chat room.
 ChatSessionRenderer getChatSessionRenderer()
          Returns the ChatSessionRenderer that provides the connection between this chat session and its UI.
 ImageIcon getChatStatusIcon()
          Implements the ChatPanel.getChatStatusIcon method.
 String getChatSubject()
          Returns the subject of the chat room.
 ChatTransport getCurrentChatTransport()
          Returns the currently used transport for all operation within this chat session.
 String getDefaultSmsNumber()
          Returns the default mobile number used to send sms-es in this session.
 Object getDescriptor()
          Returns the descriptor of this chat session.
 Collection<Object> getHistory(int count)
          Returns a collection of the last N number of messages given by count.
 Collection<Object> getHistoryAfterDate(Date date, int count)
          Returns a collection of the last N number of messages given by count.
 Collection<Object> getHistoryBeforeDate(Date date, int count)
          Returns a collection of the last N number of messages given by count.
 long getHistoryEndDate()
          Returns the end date of the history of this chat session.
 long getHistoryStartDate()
          Returns the start date of the history of this chat session.
 boolean isContactListSupported()
          Indicates if the contact list is supported by this session.
 boolean isDescriptorPersistent()
          Returns true if this contact is persistent, otherwise returns false.
 void loadChatRoom(ChatRoom chatRoom)
          Loads the given chat room in the this chat conference panel.
 void memberPresenceChanged(ChatRoomMemberPresenceChangeEvent evt)
          Invoked when ChatRoomMemberPresenceChangeEvent are received.
 void removeChatTransportChangeListener(ChatSessionChangeListener l)
          Removes the given ChatSessionChangeListener from contained transport listeners.
 void setCurrentChatTransport(ChatTransport chatTransport)
          Sets the transport that will be used for all operations within this chat session.
 void setDefaultSmsNumber(String smsPhoneNumber)
          Sets the default mobile number used to send sms-es in this session.
 
Methods inherited from class net.java.sip.communicator.impl.gui.main.chat.ChatSession
findChatTransportForDescriptor, getChatTransports, getParticipants, getTransportsForOperationSet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConferenceChatSession

public ConferenceChatSession(ChatSessionRenderer sessionRenderer,
                             ChatRoomWrapper chatRoomWrapper)
Creates an instance of ConferenceChatSession, by specifying the sessionRenderer to be used for communication with the UI and the chatRoom corresponding to this conference session.

Parameters:
sessionRenderer - the renderer to be used for communication with the UI.
chatRoomWrapper - the chat room corresponding to this conference session.
Method Detail

getDescriptor

public Object getDescriptor()
Returns the descriptor of this chat session.

Specified by:
getDescriptor in class ChatSession
Returns:
the descriptor of this chat session.

dispose

public void dispose()
Disposes this chat session.

Specified by:
dispose in class ChatSession

getChatName

public String getChatName()
Returns the name of the chat room.

Specified by:
getChatName in class ChatSession
Returns:
the name of the chat room.

getChatSubject

public String getChatSubject()
Returns the subject of the chat room.

Returns:
the subject of the chat room.

getChatConfigurationForm

public ChatRoomConfigurationForm getChatConfigurationForm()
                                                   throws OperationFailedException
Returns the configuration form corresponding to the chat room.

Returns:
the configuration form corresponding to the chat room.
Throws:
OperationFailedException - if no configuration form is available for the chat room.

getCurrentChatTransport

public ChatTransport getCurrentChatTransport()
Returns the currently used transport for all operation within this chat session.

Specified by:
getCurrentChatTransport in class ChatSession
Returns:
the currently used transport for all operation within this chat session.

getDefaultSmsNumber

public String getDefaultSmsNumber()
Returns the default mobile number used to send sms-es in this session. In the case of conference this is for now null.

Specified by:
getDefaultSmsNumber in class ChatSession
Returns:
the default mobile number used to send sms-es in this session.

getHistory

public Collection<Object> getHistory(int count)
Returns a collection of the last N number of messages given by count.

Specified by:
getHistory in class ChatSession
Parameters:
count - The number of messages from history to return.
Returns:
a collection of the last N number of messages given by count.

getHistoryBeforeDate

public Collection<Object> getHistoryBeforeDate(Date date,
                                               int count)
Returns a collection of the last N number of messages given by count.

Specified by:
getHistoryBeforeDate in class ChatSession
Parameters:
date - The date up to which we're looking for messages.
count - The number of messages from history to return.
Returns:
a collection of the last N number of messages given by count.

getHistoryAfterDate

public Collection<Object> getHistoryAfterDate(Date date,
                                              int count)
Returns a collection of the last N number of messages given by count.

Specified by:
getHistoryAfterDate in class ChatSession
Parameters:
date - The date from which we're looking for messages.
count - The number of messages from history to return.
Returns:
a collection of the last N number of messages given by count.

getHistoryStartDate

public long getHistoryStartDate()
Returns the start date of the history of this chat session.

Specified by:
getHistoryStartDate in class ChatSession
Returns:
the start date of the history of this chat session.

getHistoryEndDate

public long getHistoryEndDate()
Returns the end date of the history of this chat session.

Specified by:
getHistoryEndDate in class ChatSession
Returns:
the end date of the history of this chat session.

setCurrentChatTransport

public void setCurrentChatTransport(ChatTransport chatTransport)
Sets the transport that will be used for all operations within this chat session.

Specified by:
setCurrentChatTransport in class ChatSession
Parameters:
chatTransport - The transport to set as a default transport for this session.

setDefaultSmsNumber

public void setDefaultSmsNumber(String smsPhoneNumber)
Sets the default mobile number used to send sms-es in this session.

Specified by:
setDefaultSmsNumber in class ChatSession
Parameters:
smsPhoneNumber - The default mobile number used to send sms-es in this session.

getChatSessionRenderer

public ChatSessionRenderer getChatSessionRenderer()
Returns the ChatSessionRenderer that provides the connection between this chat session and its UI.

Specified by:
getChatSessionRenderer in class ChatSession
Returns:
The ChatSessionRenderer.

memberPresenceChanged

public void memberPresenceChanged(ChatRoomMemberPresenceChangeEvent evt)
Invoked when ChatRoomMemberPresenceChangeEvent are received. When a new ChatRoomMember has joined the chat adds it to the list of chat participants on the right of the chat window. When a ChatRoomMember has left or quit, or has being kicked it's removed from the chat window.

Specified by:
memberPresenceChanged in interface ChatRoomMemberPresenceListener
Parameters:
evt - the ChatRoomMemberPresenceChangeEvent that notified us

chatRoomPropertyChangeFailed

public void chatRoomPropertyChangeFailed(ChatRoomPropertyChangeFailedEvent event)
Description copied from interface: ChatRoomPropertyChangeListener
Called to indicate that a change of a chat room property has failed. The modification of a property could fail, because the implementation doesn't support such a property.

Specified by:
chatRoomPropertyChangeFailed in interface ChatRoomPropertyChangeListener
Parameters:
event - the ChatRoomPropertyChangeFailedEvent containing the name of the property that has failed, as well as its old and new values.

chatRoomPropertyChanged

public void chatRoomPropertyChanged(ChatRoomPropertyChangeEvent evt)
Updates the chat panel when a property of the chat room has been modified.

Specified by:
chatRoomPropertyChanged in interface ChatRoomPropertyChangeListener
Parameters:
evt - the event containing information about the property change

isDescriptorPersistent

public boolean isDescriptorPersistent()
Returns true if this contact is persistent, otherwise returns false.

Specified by:
isDescriptorPersistent in class ChatSession
Returns:
true if this contact is persistent, otherwise returns false.

loadChatRoom

public void loadChatRoom(ChatRoom chatRoom)
Loads the given chat room in the this chat conference panel. Loads all members and adds all corresponding listeners.

Parameters:
chatRoom - the ChatRoom to load

getChatStatusIcon

public ImageIcon getChatStatusIcon()
Implements the ChatPanel.getChatStatusIcon method.

Specified by:
getChatStatusIcon in class ChatSession
Returns:
the status icon corresponding to this chat room

getChatAvatar

public byte[] getChatAvatar()
Returns the avatar icon of this chat session.

Specified by:
getChatAvatar in class ChatSession
Returns:
the avatar icon of this chat session.

isContactListSupported

public boolean isContactListSupported()
Indicates if the contact list is supported by this session. The contact list would be supported for all non system and non private sessions.

Specified by:
isContactListSupported in class ChatSession
Returns:
true to indicate that the contact list is supported, false otherwise.

addChatTransportChangeListener

public void addChatTransportChangeListener(ChatSessionChangeListener l)
Adds the given ChatSessionChangeListener to the list of transport listeners.

Specified by:
addChatTransportChangeListener in class ChatSession
Parameters:
l - the listener to add

removeChatTransportChangeListener

public void removeChatTransportChangeListener(ChatSessionChangeListener l)
Removes the given ChatSessionChangeListener from contained transport listeners.

Specified by:
removeChatTransportChangeListener in class ChatSession
Parameters:
l - the listener to remove

addMemberRoleListener

public void addMemberRoleListener(ChatRoomMemberRoleListener l)
Adds the given ChatRoomMemberRoleListener to the contained chat room role listeners.

Parameters:
l - the listener to add

addLocalUserRoleListener

public void addLocalUserRoleListener(ChatRoomLocalUserRoleListener l)
Adds the given ChatRoomLocalUserRoleListener to the contained chat room role listeners.

Parameters:
l - the listener to add

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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