Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.gui.main.chat
Class ChatContact<T>

java.lang.Object
  extended by net.java.sip.communicator.impl.gui.main.chat.ChatContact<T>
Type Parameters:
T - the type of the descriptor
Direct Known Subclasses:
AdHocConferenceChatContact, ConferenceChatContact, MetaContactChatContact

public abstract class ChatContact<T>
extends Object

The ChatContact is a wrapping class for the Contact and ChatRoomMember interface.

Author:
Yana Stamcheva, Lubomir Marinov

Field Summary
static int AVATAR_ICON_HEIGHT
          The height of the avatar icon.
static int AVATAR_ICON_WIDTH
          The width of the avatar icon.
protected  T descriptor
          The descriptor being adapted by this instance.
 
Constructor Summary
protected ChatContact(T descriptor)
          Initializes a new ChatContact instance with a specific descriptor.
 
Method Summary
 boolean equals(Object obj)
          Determines whether a specific Object represents the same value as this ChatContact.
 ImageIcon getAvatar()
          Returns the avatar image corresponding to the source contact.
protected abstract  byte[] getAvatarBytes()
          Gets the avatar image corresponding to the source contact in the form of an array of bytes.
 T getDescriptor()
          Returns the descriptor object corresponding to this chat contact.
abstract  String getName()
          Returns the contact name.
abstract  String getUID()
          Gets the implementation-specific identifier which uniquely specifies this contact.
 int hashCode()
          Gets a hash code value for this object for the benefit of hashtables.
 boolean isSelected()
          Returns true if this is the currently selected contact in the list of contacts for the chat, otherwise returns false.
 void setSelected(boolean selected)
          Sets this isSelected property of this chat contact.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AVATAR_ICON_HEIGHT

public static final int AVATAR_ICON_HEIGHT
The height of the avatar icon.

See Also:
Constant Field Values

AVATAR_ICON_WIDTH

public static final int AVATAR_ICON_WIDTH
The width of the avatar icon.

See Also:
Constant Field Values

descriptor

protected final T descriptor
The descriptor being adapted by this instance.

Constructor Detail

ChatContact

protected ChatContact(T descriptor)
Initializes a new ChatContact instance with a specific descriptor.

Parameters:
descriptor - the descriptor to be adapted by the new instance
Method Detail

equals

public boolean equals(Object obj)
Determines whether a specific Object represents the same value as this ChatContact.

Overrides:
equals in class Object
Parameters:
obj - the Object to be checked for value equality with this ChatContact
Returns:
true if obj represents the same value as this ChatContact; otherwise, false.

getAvatar

public ImageIcon getAvatar()
Returns the avatar image corresponding to the source contact. In the case of multi user chat contact returns null.

Returns:
the avatar image corresponding to the source contact. In the case of multi user chat contact returns null

getAvatarBytes

protected abstract byte[] getAvatarBytes()
Gets the avatar image corresponding to the source contact in the form of an array of bytes.

Returns:
an array of bytes which represents the avatar image corresponding to the source contact

getDescriptor

public T getDescriptor()
Returns the descriptor object corresponding to this chat contact. In the case of single chat this could be the MetaContact and in the case of conference chat this could be the ChatRoomMember.

Returns:
the descriptor object corresponding to this chat contact.

getName

public abstract String getName()
Returns the contact name.

Returns:
the contact name

getUID

public abstract String getUID()
Gets the implementation-specific identifier which uniquely specifies this contact.

Returns:
an identifier which uniquely specifies this contact

hashCode

public int hashCode()
Gets a hash code value for this object for the benefit of hashtables.

Overrides:
hashCode in class Object
Returns:
a hash code value for this object

isSelected

public boolean isSelected()
Returns true if this is the currently selected contact in the list of contacts for the chat, otherwise returns false.

Returns:
true if this is the currently selected contact in the list of contacts for the chat, otherwise returns false.

setSelected

public void setSelected(boolean selected)
Sets this isSelected property of this chat contact.

Parameters:
selected - true to indicate that this contact would be the selected contact in the list of chat window contacts; otherwise, false

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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