Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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

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.AdHocConferenceChatSession
All Implemented Interfaces:
EventListener, AdHocChatRoomParticipantPresenceListener

public class AdHocConferenceChatSession
extends ChatSession
implements AdHocChatRoomParticipantPresenceListener

An implementation of ChatSession for ad-hoc conference chatting.

Author:
Valentin Martinet

Field Summary
 
Fields inherited from class net.java.sip.communicator.impl.gui.main.chat.ChatSession
chatHistoryFilter, chatParticipants, chatTransports
 
Constructor Summary
AdHocConferenceChatSession(ChatSessionRenderer sessionRenderer, AdHocChatRoomWrapper chatRoomWrapper)
          Creates an instance of AdHocConferenceChatSession, by specifying the sessionRenderer to be used for communication with the UI and the ad-hoc chat room corresponding to this conference session.
 
Method Summary
 void addChatTransportChangeListener(ChatSessionChangeListener l)
          Adds the given ChatSessionChangeListener to this ChatSession.
 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 ad-hoc 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.
 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()
          Gets the indicator which determines whether a contact list of (multiple) participants is supported by this ChatSession.
 boolean isDescriptorPersistent()
          Returns true if this contact is persistent, otherwise returns false.
 void loadChatRoom(AdHocChatRoom chatRoom)
          Loads the given chat room in the this chat conference panel.
 void participantPresenceChanged(AdHocChatRoomParticipantPresenceChangeEvent evt)
          Invoked when AdHocChatRoomParticipantPresenceChangeEvent are received.
 void removeChatTransportChangeListener(ChatSessionChangeListener l)
          Removes the given ChatSessionChangeListener to this ChatSession.
 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

AdHocConferenceChatSession

public AdHocConferenceChatSession(ChatSessionRenderer sessionRenderer,
                                  AdHocChatRoomWrapper chatRoomWrapper)
Creates an instance of AdHocConferenceChatSession, by specifying the sessionRenderer to be used for communication with the UI and the ad-hoc chat room corresponding to this conference session.

Parameters:
sessionRenderer - the renderer to be used for communication with the UI.
chatRoomWrapper - the ad-hoc 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 ad-hoc chat room.

Specified by:
getChatName in class ChatSession
Returns:
the name of the ad-hoc 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.

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(AdHocChatRoom 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 ad-hoc 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()
Description copied from class: ChatSession
Gets the indicator which determines whether a contact list of (multiple) participants is supported by this ChatSession. For example, UI implementations may use the indicator to determine whether UI elements should be created for the user to represent the contact list of the participants in this ChatSession.

Specified by:
isContactListSupported in class ChatSession
Returns:
true if this ChatSession supports a contact list of (multiple) participants; otherwise, false

participantPresenceChanged

public void participantPresenceChanged(AdHocChatRoomParticipantPresenceChangeEvent evt)
Invoked when AdHocChatRoomParticipantPresenceChangeEvent are received. When a new participant (Contact) has joined the chat adds it to the list of chat participants on the right of the chat window. When a participant has left or quit it's removed from the chat window.

Specified by:
participantPresenceChanged in interface AdHocChatRoomParticipantPresenceListener
Parameters:
evt - the AdHocChatRoomParticipantPresenceChangeEvent instance containing the source chat room and type, and reason of the presence change

addChatTransportChangeListener

public void addChatTransportChangeListener(ChatSessionChangeListener l)
Description copied from class: ChatSession
Adds the given ChatSessionChangeListener to this ChatSession.

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

removeChatTransportChangeListener

public void removeChatTransportChangeListener(ChatSessionChangeListener l)
Description copied from class: ChatSession
Removes the given ChatSessionChangeListener to this ChatSession.

Specified by:
removeChatTransportChangeListener in class ChatSession
Parameters:
l - the ChatSessionChangeListener to add

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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