|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.java.sip.communicator.impl.protocol.zeroconf.ContactGroupZeroconfImpl
public class ContactGroupZeroconfImpl
A simple, straightforward implementation of a zeroconf ContactGroup. Since the Zeroconf protocol, we simply store all group details in class fields. You should know that when implementing a real protocol, the contact group implementation would rather encapsulate group objects from the protocol stack and group property values should be returned by consulting the encapsulated object.
| Constructor Summary | |
|---|---|
ContactGroupZeroconfImpl(String groupName,
ProtocolProviderServiceZeroconfImpl parentProvider)
Creates a ContactGroupZeroconfImpl with the specified name. |
|
| Method Summary | |
|---|---|
void |
addContact(ContactZeroconfImpl contactToAdd)
Adds the specified contact to this group. |
void |
addSubgroup(ContactGroupZeroconfImpl subgroup)
Adds the specified contact group to the contained by this group. |
boolean |
canContainSubgroups()
Determines whether the group may contain subgroups or not. |
Iterator<Contact> |
contacts()
Returns an Iterator over all contacts, member of this ContactGroup. |
int |
countContacts()
Returns the number of Contact members of this ContactGroup |
int |
countSubgroups()
Returns the number of subgroups contained by this ContactGroup. |
(package private) static String |
createNameFromUID(String uid)
Ugly but tricky conversion method. |
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this one which in terms of contact groups translates to having the equal names and matching subgroups and child contacts. |
ContactZeroconfImpl |
findContactByID(String id)
Returns the contact with the specified id or null if no such contact exists. |
ContactGroupZeroconfImpl |
findContactParent(ContactZeroconfImpl zeroconfContact)
Returns the group that is parent of the specified zeroconfContact or null if no parent was found. |
ContactGroupZeroconfImpl |
findGroupParent(ContactGroupZeroconfImpl zeroconfGroup)
Returns the group that is parent of the specified zeroconfGroup or null if no parent was found. |
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. |
ContactGroup |
getParentContactGroup()
Returns the contact group that currently contains this group or null if this is the root contact group. |
String |
getPersistentData()
Returns null as no persistent data is required and the contact address 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 inside the current protocol. |
boolean |
isPersistent()
Determines whether or not this contact group is being stored by the server. |
boolean |
isResolved()
Determines whether or not this contact has been resolved against the server. |
void |
removeContact(ContactZeroconfImpl contact)
Removes the specified contact from this group. |
void |
removeSubGroup(ContactGroupZeroconfImpl subgroup)
Removes the specified contact group from the this group's subgroups. |
void |
setGroupName(String newGrpName)
Sets this group a new name. |
(package private) void |
setParentGroup(ContactGroupZeroconfImpl parent)
Sets the group that is the new parent of this group |
void |
setPersistent(boolean isPersistent)
Specifies whether or not this contact group is being stored by the server. |
void |
setResolved(boolean resolved)
Makes the group resolved or unresolved. |
Iterator<ContactGroup> |
subgroups()
Returns an iterator over the sub groups that this ContactGroup contains. |
String |
toString()
Returns a String representation of this group and the contacts it contains (may turn out to be a relatively long string). |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ContactGroupZeroconfImpl(String groupName,
ProtocolProviderServiceZeroconfImpl parentProvider)
groupName - the name of the group.parentProvider - the protocol provider that created this group.| Method Detail |
|---|
public boolean canContainSubgroups()
canContainSubgroups in interface ContactGrouppublic ProtocolProviderService getProtocolProvider()
getProtocolProvider in interface ContactGrouppublic Iterator<Contact> contacts()
contacts in interface ContactGrouppublic void addContact(ContactZeroconfImpl contactToAdd)
contactToAdd - the ContactZeroconfImpl to add to this group.public int countContacts()
countContacts in interface ContactGrouppublic int countSubgroups()
countSubgroups in interface ContactGrouppublic void addSubgroup(ContactGroupZeroconfImpl subgroup)
subgroup - the ContactGroupZeroconfImpl to add as a
subgroup to this group.void setParentGroup(ContactGroupZeroconfImpl parent)
parent - ContactGroupZeroconfImplpublic ContactGroup getParentContactGroup()
getParentContactGroup in interface ContactGrouppublic void removeSubGroup(ContactGroupZeroconfImpl subgroup)
subgroup - the ContactGroupZeroconfImpl subgroup to remove.public ContactGroupZeroconfImpl findGroupParent(ContactGroupZeroconfImpl zeroconfGroup)
zeroconfGroup - the group whose parent we're looking for.
public ContactGroupZeroconfImpl findContactParent(ContactZeroconfImpl zeroconfContact)
zeroconfContact - the contact whose parent we're looking for.
public Contact getContact(String id)
getContact in interface ContactGroupid - the addres or identifier of the Contact we are
looking for.
public ContactGroup getGroup(int index)
getGroup in interface ContactGroupindex - the index of the ContactGroup to retrieve.
public ContactGroup getGroup(String groupName)
getGroup in interface ContactGroupgroupName - the name of the ContactGroup to retrieve.
public String getGroupName()
getGroupName in interface ContactGrouppublic void setGroupName(String newGrpName)
newGrpName - a String containing the new name of this group.public Iterator<ContactGroup> subgroups()
subgroups in interface ContactGrouppublic void removeContact(ContactZeroconfImpl contact)
contact - the ContactZeroconfImpl to remove from this grouppublic ContactZeroconfImpl findContactByID(String id)
id - the id of the contact we're looking for.
public String toString()
toString in class Objectpublic void setPersistent(boolean isPersistent)
isPersistent - true if the contact group is to be persistent and
false otherwise.public boolean isPersistent()
isPersistent in interface ContactGrouppublic String getPersistentData()
getPersistentData in interface ContactGrouppublic boolean isResolved()
isResolved in interface ContactGrouppublic void setResolved(boolean resolved)
resolved - true to make the group resolved; false to
make it unresolvedpublic String getUID()
getUID in interface ContactGroupstatic String createNameFromUID(String uid)
uid - the uid we'd like to get a name from
public boolean equals(Object obj)
equals in class Objectobj - the reference object with which to compare.
true if this contact group has the equal child
contacts and subgroups to those of the obj argument.
|
Jitsi: the OpenSource Java VoIP and Instant Messaging client. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||