Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.gui.main.contactlist.notifsource
Class NotificationContact

java.lang.Object
  extended by net.java.sip.communicator.impl.gui.main.contactlist.notifsource.NotificationContact
All Implemented Interfaces:
EventListener, UIContact, ProviderPresenceStatusListener, RegistrationStateChangeListener

public class NotificationContact
extends Object
implements UIContact, RegistrationStateChangeListener, ProviderPresenceStatusListener

The NotificationContact represents a notification entry shown in the contact list history view. It could represent a voice message entry, email notification or something else.

Author:
Yana Stamcheva

Field Summary
 
Fields inherited from interface net.java.sip.communicator.service.protocol.event.ProviderPresenceStatusListener
STATUS_MESSAGE
 
Constructor Summary
NotificationContact(NotificationGroup group, ProtocolProviderService protocolProvider)
          Creates an instance of NotificationContact by specifying the parent group and the corresponding ProtocolProviderService.
 
Method Summary
 ImageIcon getAvatar(boolean isSelected, int width, int height)
          Returns the icon indicating that this is a notification contact.
 List<UIContactDetail> getContactDetailsForOperationSet(Class<? extends OperationSet> opSetClass)
          Returns a list of UIContactDetails supporting the given OperationSet class.
 ContactNode getContactNode()
          Returns the corresponding ContactNode.
 UIContactDetail getDefaultContactDetail(Class<? extends OperationSet> opSetClass)
          Returns the default ContactDetail to use for any operations depending to the given OperationSet class.
 Object getDescriptor()
          Returns the descriptor of this contact.
 String getDisplayDetails()
          Returns the display details of this contact.
 String getDisplayName()
          Returns the display name of this contact.
 UIGroup getParentGroup()
          Returns the parent group.
 JPopupMenu getRightButtonMenu()
          Returns null to indicate that no right button menu is provided for this contact.
 Iterator<String> getSearchStrings()
          No search strings are provided for this contact.
 int getSourceIndex()
          Returns the index of this contact in its source.
 ImageIcon getStatusIcon()
          Returns the status icon of this contact or null if no status is available.
 ExtendedTooltip getToolTip()
          Returns the tool tip opened on mouse over.
 int getUnreadMessageCount()
          Returns the number of unread messages, this notification is about.
 void providerStatusChanged(ProviderPresenceStatusChangeEvent evt)
          Refresh the notification contact corresponding the the attached provider in order to better reflect its status.
 void providerStatusMessageChanged(PropertyChangeEvent evt)
          The method is called by a ProtocolProvider implementation whenever a change in the status message of the corresponding provider has occurred and has been confirmed by the server.
 void registrationStateChanged(RegistrationStateChangeEvent evt)
          Refresh the notification contact corresponding the the attached provider in order to better reflect its state.
 void setContactNode(ContactNode contactNode)
          Sets the given contactNode.
 void setMessageAccount(String messageAccount)
          Sets the corresponding message account.
 void setParentGroup(UIGroup parentGroup)
          Sets the given UIGroup to be the parent group of this UIContact.
 void setReadMessageCount(int count)
          Sets the number of read messages, this notification is about.
 void setUnreadMessageCount(int count)
          Sets the number of unread messages, this notification is about.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NotificationContact

public NotificationContact(NotificationGroup group,
                           ProtocolProviderService protocolProvider)
Creates an instance of NotificationContact by specifying the parent group and the corresponding ProtocolProviderService.

Parameters:
group - the parent group
protocolProvider - the corresponding protocol provider
Method Detail

getDescriptor

public Object getDescriptor()
Returns the descriptor of this contact.

Specified by:
getDescriptor in interface UIContact
Returns:
the descriptor of this contact

getDisplayName

public String getDisplayName()
Returns the display name of this contact.

Specified by:
getDisplayName in interface UIContact
Returns:
the display name of this contact

getDisplayDetails

public String getDisplayDetails()
Returns the display details of this contact. These would be shown whenever the contact is selected. In the NotificationContact these contain information about unread and read messages.

Specified by:
getDisplayDetails in interface UIContact
Returns:
the display details of this contact

getSourceIndex

public int getSourceIndex()
Returns the index of this contact in its source.

Specified by:
getSourceIndex in interface UIContact
Returns:
the source index

getAvatar

public ImageIcon getAvatar(boolean isSelected,
                           int width,
                           int height)
Returns the icon indicating that this is a notification contact.

Specified by:
getAvatar in interface UIContact
Parameters:
isSelected - indicates if the contact is selected
width - the width of the avatar
height - the height of the avatar
Returns:
the avatar of this contact

getStatusIcon

public ImageIcon getStatusIcon()
Returns the status icon of this contact or null if no status is available.

Specified by:
getStatusIcon in interface UIContact
Returns:
the status icon of this contact or null if no status is available

getToolTip

public ExtendedTooltip getToolTip()
Returns the tool tip opened on mouse over.

Specified by:
getToolTip in interface UIContact
Returns:
the tool tip opened on mouse over

getRightButtonMenu

public JPopupMenu getRightButtonMenu()
Returns null to indicate that no right button menu is provided for this contact.

Specified by:
getRightButtonMenu in interface UIContact
Returns:
null

getParentGroup

public UIGroup getParentGroup()
Returns the parent group.

Specified by:
getParentGroup in interface UIContact
Returns:
the parent group

setParentGroup

public void setParentGroup(UIGroup parentGroup)
Sets the given UIGroup to be the parent group of this UIContact.

Specified by:
setParentGroup in interface UIContact
Parameters:
parentGroup - the parent UIGroup of this contact

getSearchStrings

public Iterator<String> getSearchStrings()
No search strings are provided for this contact.

Specified by:
getSearchStrings in interface UIContact
Returns:
null

getContactNode

public ContactNode getContactNode()
Returns the corresponding ContactNode. The ContactNode is the real node that is stored in the contact list component data model.

Specified by:
getContactNode in interface UIContact
Returns:
the corresponding ContactNode

setContactNode

public void setContactNode(ContactNode contactNode)
Sets the given contactNode. The ContactNode is the real node that is stored in the contact list component data model.

Specified by:
setContactNode in interface UIContact
Parameters:
contactNode - the ContactNode that corresponds to this UIGroup

getDefaultContactDetail

public UIContactDetail getDefaultContactDetail(Class<? extends OperationSet> opSetClass)
Returns the default ContactDetail to use for any operations depending to the given OperationSet class.

Specified by:
getDefaultContactDetail in interface UIContact
Parameters:
opSetClass - the OperationSet class we're interested in
Returns:
the default ContactDetail to use for any operations depending to the given OperationSet class

getContactDetailsForOperationSet

public List<UIContactDetail> getContactDetailsForOperationSet(Class<? extends OperationSet> opSetClass)
Returns a list of UIContactDetails supporting the given OperationSet class.

Specified by:
getContactDetailsForOperationSet in interface UIContact
Parameters:
opSetClass - the OperationSet class we're interested in
Returns:
a list of UIContactDetails supporting the given OperationSet class

setMessageAccount

public void setMessageAccount(String messageAccount)
Sets the corresponding message account.

Parameters:
messageAccount - the message account corresponding to the contained notification

setUnreadMessageCount

public void setUnreadMessageCount(int count)
Sets the number of unread messages, this notification is about.

Parameters:
count - the number of unread messages, this notification is about

getUnreadMessageCount

public int getUnreadMessageCount()
Returns the number of unread messages, this notification is about.

Returns:
the number of unread messages, this notification is about

setReadMessageCount

public void setReadMessageCount(int count)
Sets the number of read messages, this notification is about.

Parameters:
count - the number of read messages, this notification is about

registrationStateChanged

public void registrationStateChanged(RegistrationStateChangeEvent evt)
Refresh the notification contact corresponding the the attached provider in order to better reflect its state.

Specified by:
registrationStateChanged in interface RegistrationStateChangeListener
Parameters:
evt - the ProviderPresenceStatusChangeEvent that has notified us of the state change

providerStatusChanged

public void providerStatusChanged(ProviderPresenceStatusChangeEvent evt)
Refresh the notification contact corresponding the the attached provider in order to better reflect its status.

Specified by:
providerStatusChanged in interface ProviderPresenceStatusListener
Parameters:
evt - the ProviderPresenceStatusChangeEvent that has notified us of the status change

providerStatusMessageChanged

public void providerStatusMessageChanged(PropertyChangeEvent evt)
Description copied from interface: ProviderPresenceStatusListener
The method is called by a ProtocolProvider implementation whenever a change in the status message of the corresponding provider has occurred and has been confirmed by the server.

Specified by:
providerStatusMessageChanged in interface ProviderPresenceStatusListener
Parameters:
evt - a PropertyChangeEvent with a STATUS_MESSAGE property name, containing the old and new status messages.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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