Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.gui.main.chat
Class MetaContactChatSession

java.lang.Object
  extended by net.java.sip.communicator.impl.gui.main.chat.ChatSession
      extended by net.java.sip.communicator.impl.gui.main.chat.MetaContactChatSession
All Implemented Interfaces:
EventListener, MetaContactListListener

public class MetaContactChatSession
extends ChatSession
implements MetaContactListListener

An implementation of the ChatSession interface that represents a user-to-user chat session.

Author:
Yana Stamcheva, Lubomir Marinov

Field Summary
 
Fields inherited from class net.java.sip.communicator.impl.gui.main.chat.ChatSession
chatHistoryFilter, chatParticipants, chatTransports
 
Constructor Summary
MetaContactChatSession(ChatSessionRenderer sessionRenderer, MetaContact metaContact, Contact protocolContact)
          Creates an instance of MetaContactChatSession by specifying the renderer, which gives the connection with the UI, the meta contact corresponding to the session and the protocol contact to be used as transport.
 
Method Summary
 void addChatTransportChangeListener(ChatSessionChangeListener l)
          Adds the given ChatSessionChangeListener to this ChatSession.
 void childContactsReordered(MetaContactGroupEvent evt)
          Indicates that the order under which the child contacts were ordered inside the source group has changed.
 void dispose()
          Disposes this chat session.
 byte[] getChatAvatar()
          Returns the avatar icon of this chat session.
 String getChatName()
          Returns the name of this chat.
 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()
          Implements ChatSession#isContactListSupported().
 boolean isDescriptorPersistent()
          Returns true if this contact is persistent, otherwise returns false.
 void metaContactAdded(MetaContactEvent evt)
          Indicates that a MetaContact has been successfully added to the MetaContact list.
 void metaContactAvatarUpdated(MetaContactAvatarUpdateEvent evt)
          Indicates that a new avatar is available for a MetaContact.
 void metaContactGroupAdded(MetaContactGroupEvent evt)
          Indicates that a MetaContactGroup has been successfully added to the MetaContact list.
 void metaContactGroupModified(MetaContactGroupEvent evt)
          Indicates that a MetaContactGroup has been modified (e.g.
 void metaContactGroupRemoved(MetaContactGroupEvent evt)
          Indicates that a MetaContactGroup has been removed from the MetaContact list.
 void metaContactModified(MetaContactModifiedEvent evt)
          Indicates that a MetaContact has been modified.
 void metaContactMoved(MetaContactMovedEvent evt)
          Indicates that a MetaContact has been moved inside the MetaContact list.
 void metaContactRemoved(MetaContactEvent evt)
          Indicates that a MetaContact has been removed from the MetaContact list.
 void metaContactRenamed(MetaContactRenamedEvent evt)
          Implements MetaContactListListener.metaContactRenamed method.
 void protoContactAdded(ProtoContactEvent evt)
          Implements MetaContactListListener.protoContactAdded method.
 void protoContactModified(ProtoContactEvent evt)
          Indicates that one of the protocol specific Contact instances encapsulated by this MetaContact has been modified in some way.
 void protoContactMoved(ProtoContactEvent evt)
          Implements MetaContactListListener.protoContactMoved method.
 void protoContactRemoved(ProtoContactEvent evt)
          Implements MetaContactListListener.protoContactRemoved method.
 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

MetaContactChatSession

public MetaContactChatSession(ChatSessionRenderer sessionRenderer,
                              MetaContact metaContact,
                              Contact protocolContact)
Creates an instance of MetaContactChatSession by specifying the renderer, which gives the connection with the UI, the meta contact corresponding to the session and the protocol contact to be used as transport.

Parameters:
sessionRenderer - the renderer, which gives the connection with the UI.
metaContact - the meta contact corresponding to the session and the protocol contact.
protocolContact - the protocol contact to be used as transport.
Method Detail

getChatName

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

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

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.

getDefaultSmsNumber

public String getDefaultSmsNumber()
Returns the default mobile number used to send sms-es in this session.

Specified by:
getDefaultSmsNumber in class ChatSession
Returns:
the default mobile number used to send sms-es in 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.

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.

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.

childContactsReordered

public void childContactsReordered(MetaContactGroupEvent evt)
Description copied from interface: MetaContactListListener
Indicates that the order under which the child contacts were ordered inside the source group has changed.

Specified by:
childContactsReordered in interface MetaContactListListener
Parameters:
evt - the MetaContactGroupEvent containing details of this event.

metaContactAdded

public void metaContactAdded(MetaContactEvent evt)
Description copied from interface: MetaContactListListener
Indicates that a MetaContact has been successfully added to the MetaContact list.

Specified by:
metaContactAdded in interface MetaContactListListener
Parameters:
evt - the MetaContactListEvent containing the corresponding contact

metaContactGroupAdded

public void metaContactGroupAdded(MetaContactGroupEvent evt)
Description copied from interface: MetaContactListListener
Indicates that a MetaContactGroup has been successfully added to the MetaContact list.

Specified by:
metaContactGroupAdded in interface MetaContactListListener
Parameters:
evt - the MetaContactListEvent containing the corresponding contact

metaContactGroupModified

public void metaContactGroupModified(MetaContactGroupEvent evt)
Description copied from interface: MetaContactListListener
Indicates that a MetaContactGroup has been modified (e.g. a proto contact group was removed).

Specified by:
metaContactGroupModified in interface MetaContactListListener
Parameters:
evt - the MetaContactListEvent containing the corresponding contact

metaContactGroupRemoved

public void metaContactGroupRemoved(MetaContactGroupEvent evt)
Description copied from interface: MetaContactListListener
Indicates that a MetaContactGroup has been removed from the MetaContact list.

Specified by:
metaContactGroupRemoved in interface MetaContactListListener
Parameters:
evt - the MetaContactListEvent containing the corresponding contact

metaContactModified

public void metaContactModified(MetaContactModifiedEvent evt)
Description copied from interface: MetaContactListListener
Indicates that a MetaContact has been modified.

Specified by:
metaContactModified in interface MetaContactListListener
Parameters:
evt - the MetaContactModifiedEvent containing the corresponding contact

metaContactMoved

public void metaContactMoved(MetaContactMovedEvent evt)
Description copied from interface: MetaContactListListener
Indicates that a MetaContact has been moved inside the MetaContact list.

Specified by:
metaContactMoved in interface MetaContactListListener
Parameters:
evt - the MetaContactListEvent containing the corresponding contact

metaContactRemoved

public void metaContactRemoved(MetaContactEvent evt)
Description copied from interface: MetaContactListListener
Indicates that a MetaContact has been removed from the MetaContact list.

Specified by:
metaContactRemoved in interface MetaContactListListener
Parameters:
evt - the MetaContactListEvent containing the corresponding contact

metaContactAvatarUpdated

public void metaContactAvatarUpdated(MetaContactAvatarUpdateEvent evt)
Description copied from interface: MetaContactListListener
Indicates that a new avatar is available for a MetaContact.

Specified by:
metaContactAvatarUpdated in interface MetaContactListListener
Parameters:
evt - the MetaContactAvatarUpdateEvent containing details of this event

metaContactRenamed

public void metaContactRenamed(MetaContactRenamedEvent evt)
Implements MetaContactListListener.metaContactRenamed method. When a meta contact is renamed, updates all related labels in this chat panel.

Specified by:
metaContactRenamed in interface MetaContactListListener
Parameters:
evt - the MetaContactRenamedEvent that notified us

protoContactAdded

public void protoContactAdded(ProtoContactEvent evt)
Implements MetaContactListListener.protoContactAdded method. When a proto contact is added, updates the "send via" selector box.

Specified by:
protoContactAdded in interface MetaContactListListener
Parameters:
evt - a reference to the corresponding ProtoContactEvent

protoContactMoved

public void protoContactMoved(ProtoContactEvent evt)
Implements MetaContactListListener.protoContactMoved method. When a proto contact is moved, updates the "send via" selector box.

Specified by:
protoContactMoved in interface MetaContactListListener
Parameters:
evt - a reference to the ProtoContactMovedEvent instance.

protoContactRemoved

public void protoContactRemoved(ProtoContactEvent evt)
Implements MetaContactListListener.protoContactRemoved method. When a proto contact is removed, updates the "send via" selector box.

Specified by:
protoContactRemoved in interface MetaContactListListener
Parameters:
evt - a reference to the corresponding ProtoContactEvent

dispose

public void dispose()
Disposes this chat session.

Specified by:
dispose in class ChatSession

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.

getDescriptor

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

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

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.

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.

protoContactModified

public void protoContactModified(ProtoContactEvent evt)
Description copied from interface: MetaContactListListener
Indicates that one of the protocol specific Contact instances encapsulated by this MetaContact has been modified in some way. The event added to the list of protocol specific buddies in this MetaContact

Specified by:
protoContactModified in interface MetaContactListListener
Parameters:
evt - a reference to the corresponding ProtoContactEvent

isContactListSupported

public boolean isContactListSupported()
Implements ChatSession#isContactListSupported().

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

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.