Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.icq
Class RootContactGroupIcqImpl

java.lang.Object
  extended by net.java.sip.communicator.impl.protocol.icq.AbstractContactGroupIcqImpl
      extended by net.java.sip.communicator.impl.protocol.icq.RootContactGroupIcqImpl
All Implemented Interfaces:
ContactGroup

public class RootContactGroupIcqImpl
extends AbstractContactGroupIcqImpl

A dummy ContactGroup implementation representing the ContactList root for ICQ contact lists.

Author:
Emil Ivov

Constructor Summary
RootContactGroupIcqImpl(ProtocolProviderServiceIcqImpl protocolProvider)
          Creates a ContactGroup instance.
 
Method Summary
(package private)  void addSubGroup(ContactGroupIcqImpl group)
          Adds the specified group to the end of the list of sub groups.
(package private)  void addSubGroup(int index, ContactGroupIcqImpl group)
          Adds the specified group at the specified position in the list of sub groups.
 boolean canContainSubgroups()
          The ContactListRoot in ICQ is the only group that can contain subgroups.
 Iterator<Contact> contacts()
          Returns an Iterator over all contacts, member of this ContactGroup.
 int countContacts()
          Returns the number, which is always 0, of Contact members of this ContactGroup
 int countSubgroups()
          Returns the number of subgroups contained by this RootContactGroupIcqImpl.
 Contact getContact(String id)
          Returns the Contact with the specified address or identifier.
 ContactGroup getGroup(int index)
          Returns the subgroup with the specified index.
 ContactGroup getGroup(String groupName)
          Returns the subgroup with the specified name.
 String getGroupName()
          Returns the name of this group which is always ROOT_CONTACT_GROUP_NAME.
 ContactGroup getParentContactGroup()
          Returns null as this is the root contact group.
 String getPersistentData()
          Returns null as no persistent data is required and the group name is sufficient for restoring the contact.
 ProtocolProviderService getProtocolProvider()
          Returns the protocol provider that this group belongs to.
 String getUID()
          Returns a String that uniquely represnets the group.
 boolean isPersistent()
          Determines whether or not this contact group is being stored by the server.
 boolean isResolved()
          Determines whether or not this group has been resolved against the server.
(package private)  void removeSubGroup(ContactGroupIcqImpl group)
          Removes the specified from the list of sub groups
(package private)  void removeSubGroup(int index)
          Removes the sub group with the specified index.
(package private)  void reorderSubGroups(List<ContactGroupIcqImpl> newOrder)
          Removes all contact sub groups and reinsterts them as specified by the newOrder param.
 Iterator<ContactGroup> subgroups()
          Returns an iterator over the sub groups that this ContactGroup contains.
 String toString()
          Returns a string representation of the root contact group that contains all subgroups and subcontacts of this group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RootContactGroupIcqImpl

RootContactGroupIcqImpl(ProtocolProviderServiceIcqImpl protocolProvider)
Creates a ContactGroup instance.

Method Detail

canContainSubgroups

public boolean canContainSubgroups()
The ContactListRoot in ICQ is the only group that can contain subgroups.

Returns:
true (always)

getGroupName

public String getGroupName()
Returns the name of this group which is always ROOT_CONTACT_GROUP_NAME.

Returns:
a String containing the name of this group.

addSubGroup

void addSubGroup(int index,
                 ContactGroupIcqImpl group)
Adds the specified group at the specified position in the list of sub groups.

Parameters:
index - the position at which the specified group should be added.
group - the ContactGroup to add

addSubGroup

void addSubGroup(ContactGroupIcqImpl group)
Adds the specified group to the end of the list of sub groups.

Parameters:
group - the group to add.

removeSubGroup

void removeSubGroup(ContactGroupIcqImpl group)
Removes the specified from the list of sub groups

Parameters:
group - the group to remove.

removeSubGroup

void removeSubGroup(int index)
Removes the sub group with the specified index.

Parameters:
index - the index of the group to remove

reorderSubGroups

void reorderSubGroups(List<ContactGroupIcqImpl> newOrder)
Removes all contact sub groups and reinsterts them as specified by the newOrder param. Contact groups not contained in the newOrder list are left at the end of this group.

Parameters:
newOrder - a list containing all contact groups in the order that is to be applied.

countSubgroups

public int countSubgroups()
Returns the number of subgroups contained by this RootContactGroupIcqImpl.

Returns:
an int indicating the number of subgroups that this ContactGroup contains.

getParentContactGroup

public ContactGroup getParentContactGroup()
Returns null as this is the root contact group.

Returns:
null as this is the root contact group.

getGroup

public ContactGroup getGroup(int index)
Returns the subgroup with the specified index.

Parameters:
index - the index of the ContactGroup to retrieve.
Returns:
the ContactGroup with the specified index.

getGroup

public ContactGroup getGroup(String groupName)
Returns the subgroup with the specified name.

Parameters:
groupName - the name of the ContactGroup to retrieve.
Returns:
the ContactGroup with the specified index.

getContact

public Contact getContact(String id)
Returns the Contact with the specified address or identifier.

Parameters:
id - the addres or identifier of the Contact we are looking for.
Returns:
the Contact with the specified id or address.

subgroups

public Iterator<ContactGroup> subgroups()
Returns an iterator over the sub groups that this ContactGroup contains.

Returns:
a java.util.Iterator over the ContactGroup children of this group (i.e. subgroups).

countContacts

public int countContacts()
Returns the number, which is always 0, of Contact members of this ContactGroup

Returns:
an int indicating the number of Contacts, members of this ContactGroup.

contacts

public Iterator<Contact> contacts()
Returns an Iterator over all contacts, member of this ContactGroup.

Returns:
a java.util.Iterator over all contacts inside this ContactGroup

toString

public String toString()
Returns a string representation of the root contact group that contains all subgroups and subcontacts of this group.

Overrides:
toString in class Object
Returns:
a string representation of this root contact group.

getProtocolProvider

public ProtocolProviderService getProtocolProvider()
Returns the protocol provider that this group belongs to.

Returns:
a regerence to the ProtocolProviderService instance that this ContactGroup belongs to.

isPersistent

public boolean isPersistent()
Determines whether or not this contact group is being stored by the server. Non persistent contact groups exist for the sole purpose of containing non persistent contacts.

Returns:
true if the contact group is persistent and false otherwise.

getPersistentData

public String getPersistentData()
Returns null as no persistent data is required and the group name is sufficient for restoring the contact.

Returns:
null as no such data is needed.

isResolved

public boolean isResolved()
Determines whether or not this group has been resolved against the server. Unresolved groups are used when initially loading a contact list that has been stored in a local file until the presence operation set has managed to retrieve all the contact list from the server and has properly mapped groups to their on-line buddies.

Returns:
true if the group has been resolved (mapped against a buddy) and false otherwise.

getUID

public String getUID()
Returns a String that uniquely represnets the group. In this we use the name of the group as an identifier. This may cause problems though, in clase the name is changed by some other application between consecutive runs of the sip-communicator.

Returns:
a String representing this group in a unique and persistent way.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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