dmc
Class TabbedChat

java.lang.Object
  |
  +--dmc.TabbedChat

public class TabbedChat
extends java.lang.Object

Manages chats with multiple targets in a single JTabbedPane. Also provides several functions for accessing information on the active connection.


Field Summary
protected  dmc.AutoReader ar
           
protected  dmc.ChatReader cr
           
protected  dmc.MsgReader mr
           
protected  dmc.SystemReader sr
           
protected  javax.swing.JTabbedPane tabbedPane
           
protected  wtalk.IUserList ul
           
protected  dmc.WallReader wr
           
protected  wtalk.WTalk wt
           
 
Constructor Summary
TabbedChat()
          Default ctor.
 
Method Summary
 dmc.JChatPanel addTab(java.lang.String name, int type)
          Adds a new tab to the TabbedChat with caption name.
 void connect(java.lang.String server, int port, java.lang.String login)
          Connects to server:port using login as a handle.
 dmc.ChatInputHandler getInputPanel(java.lang.String room)
          Returns a ChatInputHandler associated with the JChatPanel in charge of room.
 javax.swing.JTabbedPane getUI()
          Returns the GUI representation of a TabbedChat.
 java.lang.String getUserName()
          Returns the user name as reported by the WTalkProtocol.
 javax.swing.JTextPane openBuddy(java.lang.String name)
          Returns the JTextPane used by the JChatPanel displaying the chat with name.
 void setConnectionType(int i)
          Sets the protocol used to connect.
 void setName(java.lang.String name)
          Tells the WTalkProtocol to request a new name, name.
 void setPassword(java.lang.String passwd)
          Tells the WTalkProtocol to use the given password when trying to authenticate.
 void setUserList(wtalk.IUserList u)
          Sets the object to register with WTalkProtocols that will implement IUserList to support GUI representation of buddy lists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tabbedPane

protected final javax.swing.JTabbedPane tabbedPane

wt

protected final wtalk.WTalk wt

cr

protected final dmc.ChatReader cr

wr

protected final dmc.WallReader wr

sr

protected final dmc.SystemReader sr

mr

protected final dmc.MsgReader mr

ar

protected final dmc.AutoReader ar

ul

protected wtalk.IUserList ul
Constructor Detail

TabbedChat

public TabbedChat()
Default ctor.

Method Detail

setConnectionType

public void setConnectionType(int i)
Sets the protocol used to connect. This should be a constant defined in wtalk.Protocol.

Parameters:
i - Protocol to use, as defined in wtalk.Protocol.
See Also:
WTalk, Protocol

setUserList

public void setUserList(wtalk.IUserList u)
Sets the object to register with WTalkProtocols that will implement IUserList to support GUI representation of buddy lists.

Parameters:
u - Object that will be used to manage user lists.

getUI

public javax.swing.JTabbedPane getUI()
Returns the GUI representation of a TabbedChat.

Returns:
Returns GUI representation of this object.

getInputPanel

public dmc.ChatInputHandler getInputPanel(java.lang.String room)
Returns a ChatInputHandler associated with the JChatPanel in charge of room.

Parameters:
room - Room for which we want to get a ChatInputHandler.
Returns:
ChatInputHandler for room

getUserName

public java.lang.String getUserName()
Returns the user name as reported by the WTalkProtocol.

Returns:
User name assocaited with the active connection.

setName

public void setName(java.lang.String name)
Tells the WTalkProtocol to request a new name, name. There is no guarantee that this name will be granted

Parameters:
name - Name to request.

setPassword

public void setPassword(java.lang.String passwd)
Tells the WTalkProtocol to use the given password when trying to authenticate.

Parameters:
passwd - Password to use to authenticate.

connect

public void connect(java.lang.String server,
                    int port,
                    java.lang.String login)
             throws java.io.IOException
Connects to server:port using login as a handle.

Parameters:
server - Host to connect to.
port - Port to connect to on host.
login - Name to login with.
Throws:
java.io.IOException - Throws IOException when the WTalkProtocol cannot connect. For instance, the host is down, or cannot be resolved.

addTab

public dmc.JChatPanel addTab(java.lang.String name,
                             int type)
Adds a new tab to the TabbedChat with caption name.

Parameters:
name - Caption for tab.
type - Type of JChatPanel to create. These are defined in JChatPanel.
Returns:
JChatPanel that belongs to the new tab.
See Also:
JChatPanel

openBuddy

public javax.swing.JTextPane openBuddy(java.lang.String name)
Returns the JTextPane used by the JChatPanel displaying the chat with name. If none exists, a new tab is added which contains a JChatPanel to use in communications with this buddy.

Parameters:
name - The handle of the user whose JChatPanel's JTextPane is to be returned.
Returns:
JTextPane used by the JChatPanel that represents the chat with name.