dmc
Class UserList

java.lang.Object
  |
  +--dmc.UserList
All Implemented Interfaces:
IUserList

public class UserList
extends java.lang.Object
implements IUserList

Manages user lists over multiple connections. It uses a tree hierarchy with a users connected to groups, connected to connections, connected to a single root node.


Constructor Summary
UserList()
          Default ctor, creates the tree representation of user lists.
 
Method Summary
 void addConnection(java.lang.String connectionName)
          Adds a connection named connectionName.
 void addGroup(java.lang.String groupName, java.lang.String connectionName)
          Adds a group named groupName to connectionName.
protected  void addNode(javax.swing.tree.DefaultMutableTreeNode child, javax.swing.tree.DefaultMutableTreeNode parent)
          Adds a node child to parent node.
 void addUser(java.lang.String userName, java.lang.String groupName, java.lang.String connectionName)
          Adds userName to the specified group.
 void delConnection(java.lang.String connectionName)
          Removes the named connection, and everything under it.
 void delGroup(java.lang.String groupName, java.lang.String connectionName)
          Removes the named group, and all users under it.
 void delUser(java.lang.String userName, java.lang.String groupName, java.lang.String connectionName)
          Removes the named user, assuming user exists under the named group and connection.
 javax.swing.JScrollPane getUI()
          Returns the GUI representation of the user list.
protected  void registerMessageGUI(dmc.TabbedChat tc)
          Registers the messaging GUI to allow the buddy list to open windows for conversations.
protected  void updateTree(javax.swing.tree.DefaultMutableTreeNode node)
          House keeping to be done after tree manipuplations, such as additions and deletions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserList

public UserList()
Default ctor, creates the tree representation of user lists.

Method Detail

getUI

public javax.swing.JScrollPane getUI()
Returns the GUI representation of the user list.

Returns:
GUI element representing this UserList.

addNode

protected void addNode(javax.swing.tree.DefaultMutableTreeNode child,
                       javax.swing.tree.DefaultMutableTreeNode parent)
Adds a node child to parent node.

Parameters:
child - Node to be added.
parent - Node to add child to.

updateTree

protected void updateTree(javax.swing.tree.DefaultMutableTreeNode node)
House keeping to be done after tree manipuplations, such as additions and deletions.

Parameters:
node - Node for whom this function is called (or its parent).

addConnection

public void addConnection(java.lang.String connectionName)
Adds a connection named connectionName. If the connection already exists, no change is made.

If there is already a connection by this name, there is no change made.

Specified by:
addConnection in interface IUserList
Parameters:
connectionName - The name of connection to be added.

addGroup

public void addGroup(java.lang.String groupName,
                     java.lang.String connectionName)
Adds a group named groupName to connectionName. If groupName already exists under connectionName, no change is made. If connectionName does not exist, no change is made.

If the specified group already exists, no change is made.

Specified by:
addGroup in interface IUserList
Parameters:
groupName - The group to be added.
connectionName - An existing connection to which group is to be added.

addUser

public void addUser(java.lang.String userName,
                    java.lang.String groupName,
                    java.lang.String connectionName)
Adds userName to the specified group. If the user already exists in the group, or the group does not exist under the given connection, no change is made.

If the specified user already exists, no change is made.

Specified by:
addUser in interface IUserList
Parameters:
userName - The name of the user to add.
groupName - The name of the group to add userName to.
connectionName - The connection in which to search for groupName.

delConnection

public void delConnection(java.lang.String connectionName)
Removes the named connection, and everything under it. No change is made if connectionName does not exist.

Specified by:
delConnection in interface IUserList
Parameters:
connectionName - Name of connection to remove.

delGroup

public void delGroup(java.lang.String groupName,
                     java.lang.String connectionName)
Removes the named group, and all users under it. No change is made if either the group or connection named do not exist.

Specified by:
delGroup in interface IUserList
Parameters:
groupName - Name of group to be removed.
connectionName - Name of connection under which group exists.

delUser

public void delUser(java.lang.String userName,
                    java.lang.String groupName,
                    java.lang.String connectionName)
Removes the named user, assuming user exists under the named group and connection. There should be no change otherwise.

Specified by:
delUser in interface IUserList
Parameters:
userName - User to be removed from the user list.
groupName - Group name to which User belongs.
connectionName - Connection under which to search for groupName.

registerMessageGUI

protected void registerMessageGUI(dmc.TabbedChat tc)
Registers the messaging GUI to allow the buddy list to open windows for conversations.

This may be abstracted away at some point, but for now it is a TabbedChat.

Parameters:
tc - GUI to use to create windows when a buddy is clicked.