Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.gui.main.contactlist
Class GroupNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by net.java.sip.communicator.impl.gui.main.contactlist.GroupNode
All Implemented Interfaces:
Serializable, Cloneable, MutableTreeNode, TreeNode, ContactListNode

public class GroupNode
extends DefaultMutableTreeNode
implements ContactListNode

The GroupNode is a ContactListNode corresponding to a given UIGroup.

Author:
Yana Stamcheva
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
GroupNode(ContactListTreeModel treeModel, UIGroup uiGroup)
          Creates a GroupNode by specifying the parent treeModel and the corresponding uiGroup.
 
Method Summary
 ContactNode addContact(UIContact uiContact)
          Creates a ContactNode for the given uiContact and adds it to this group.
 GroupNode addContactGroup(UIGroup uiGroup)
          Creates a GroupNode for the given uiGroup and adds it to this group.
 void clear()
          Clears all dependencies for all children in the given groupNode (i.e.
 UIGroup getGroupDescriptor()
          Returns the UIGroup corresponding to this GroupNode.
 int getSourceIndex()
          Returns the index of this node in its parent group.
 boolean isCollapsed()
          Returns true if the group is collapsed or false otherwise.
 void removeContact(UIContact uiContact)
          Removes the node corresponding to the given uiContact from this group.
 void removeContactGroup(UIGroup uiGroup)
          Removes the node corresponding to the given uiGroup from this group node.
 void sort(ContactListTreeModel treeModel)
          Sorts the children of this node.
 ContactNode sortedAddContact(UIContact uiContact)
          Creates a ContactNode for the given uiContact, adds it to this group and performs a sort at the end.
 GroupNode sortedAddContactGroup(UIGroup uiGroup)
          Creates a GroupNode for the given uiGroup, adds it to this group node and performs a sort at the end.
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GroupNode

public GroupNode(ContactListTreeModel treeModel,
                 UIGroup uiGroup)
Creates a GroupNode by specifying the parent treeModel and the corresponding uiGroup.

Parameters:
treeModel - the parent tree model containing this group
uiGroup - the corresponding UIGroup
Method Detail

addContact

public ContactNode addContact(UIContact uiContact)
Creates a ContactNode for the given uiContact and adds it to this group.

Parameters:
uiContact - the UIContact to add
Returns:
the created ContactNode

sortedAddContact

public ContactNode sortedAddContact(UIContact uiContact)
Creates a ContactNode for the given uiContact, adds it to this group and performs a sort at the end.

Parameters:
uiContact - the UIContact to add
Returns:
the created ContactNode

removeContact

public void removeContact(UIContact uiContact)
Removes the node corresponding to the given uiContact from this group.

Parameters:
uiContact - the UIContact to remove

addContactGroup

public GroupNode addContactGroup(UIGroup uiGroup)
Creates a GroupNode for the given uiGroup and adds it to this group.

Parameters:
uiGroup - the UIGroup to add
Returns:
the created GroupNode

removeContactGroup

public void removeContactGroup(UIGroup uiGroup)
Removes the node corresponding to the given uiGroup from this group node.

Parameters:
uiGroup - the UIGroup to remove

sortedAddContactGroup

public GroupNode sortedAddContactGroup(UIGroup uiGroup)
Creates a GroupNode for the given uiGroup, adds it to this group node and performs a sort at the end.

Parameters:
uiGroup - the UIGroup to add
Returns:
the created GroupNode

getGroupDescriptor

public UIGroup getGroupDescriptor()
Returns the UIGroup corresponding to this GroupNode.

Returns:
the UIGroup corresponding to this GroupNode

getSourceIndex

public int getSourceIndex()
Returns the index of this node in its parent group.

Specified by:
getSourceIndex in interface ContactListNode
Returns:
the index of this node in its parent group

sort

public void sort(ContactListTreeModel treeModel)
Sorts the children of this node.

Parameters:
treeModel - the ContactListTreeModel, which should be refreshed

isCollapsed

public boolean isCollapsed()
Returns true if the group is collapsed or false otherwise.

Returns:
true if the group is collapsed or false otherwise.

clear

public void clear()
Clears all dependencies for all children in the given groupNode (i.e. GroupNode - UIGroup - MetaContactGroup or ContactNode - UIContact - SourceContact).


Jitsi: the OpenSource Java VoIP and Instant Messaging client.

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