candy.conf
Class Chat

java.lang.Object
  |
  +--candy.core.candyObject
        |
        +--candy.conf.Chat
All Implemented Interfaces:
net.jini.core.entry.Entry, java.io.Serializable, Transcriptable

public class Chat
extends candyObject
implements Transcriptable

manages a Chat session

Author:
Jeremy Mullendore
See Also:
, Serialized Form

Field Summary
(package private)  java.util.Vector members
          Members involved in this Chat
(package private)  net.jini.core.transaction.server.TransactionManager mgr
          TransactionManager to insure atomic actions in the JavaSpace
(package private)  ClientApp myOwner
          client app that owns this chat
(package private)  ChatView myView
          ui for this chat
(package private)  java.lang.String sessionID
          ID for this chat session
(package private)  net.jini.space.JavaSpace space
          JavaSpace
(package private)  java.util.Vector theData
          The Vector of ChatPackets which is the entire chat session Stored for data-maintenance, and transcript creation
(package private)  CUserList theUserList
          the user list object used to show active user's in this Chat's GUI
 java.lang.Integer transcriptIdx
          index used when running this Chat as a transcript represents the current location in the Vector of stored ChatPackets
 java.lang.Boolean transcripting
          flag telling this chat whether or not it should create a transcript of itself
 
Fields inherited from class candy.core.candyObject
description, handle, timestamp
 
Constructor Summary
Chat(net.jini.space.JavaSpace space, ClientApp client, ChatView view, net.jini.core.transaction.server.TransactionManager m)
           
Chat(net.jini.space.JavaSpace space, ClientApp client, ChatView view, java.util.Vector users, net.jini.core.transaction.server.TransactionManager m)
           
Chat(net.jini.space.JavaSpace space, ClientApp client, ChatView view, java.util.Vector users, net.jini.core.transaction.server.TransactionManager m, boolean transcript)
           
Chat(net.jini.space.JavaSpace space, ClientApp client, ChatView view, java.util.Vector users, net.jini.core.transaction.server.TransactionManager m, java.lang.String session)
           
 
Method Summary
 void add(candy.core.packet.ChatAddPacket cap)
          add a new Member to this Chat
 void addMember(Member m)
           
 void addMember(java.lang.String ID)
           
 void completeTranscript()
          fast forward to the end of the Transcript packets, displaying them all
 void createTranscript()
          create a transcript of this Chat session
 CandyView createViewForTranscript(javax.swing.JDesktopPane p, ClientApp a, java.lang.String s)
          A Factory procedure that returns a correct view for this Chat class
 void depart()
          this user is leaving this Chat, tell other active members of this Chat
 MemberTable getActiveMembers()
           
 int getCurrent()
          gets the current indice in the Transcript packets
 java.util.Vector getMembers()
           
 java.lang.String getSessionID()
          get the ID for this Chat
 int getTotal()
           
 void invite(java.lang.String ID)
          used to invite another Member to join this Chat
 void kill()
          remove this Chat from the owning ClientApps list of active Chats
 void newMessage(java.lang.String message)
          add and send a new message for this Chat
 boolean nextForTranscript()
          gets the next Packet for this Chat as a Transcript
 void playTranscript()
          play this Chat Transcript
 void receive(candy.core.packet.ChatMsgPacket cmp)
          receives a ChatMsgPacket sent to this user
 void remove(candy.core.packet.ChatLeavePacket clp)
          remove a Member from this Chat
 void removeMember(Member m)
           
 CandyView rewindTranscript(javax.swing.JDesktopPane p, ClientApp a, java.lang.String s)
          clears the current chat display in the view and resets the index of the transcripted data to the beginning
 void send(candy.core.packet.ChatPacket cp)
          sends a packet containing a chat message
 void setMembers(java.util.Vector users)
           
 void setSessionID(java.lang.String s)
          set this Chat's unique ID
 void setTranscripting(boolean b)
          set whether this Chat will handle its own transcripting (false if this a Chat inside of a Meeting/CodeWalkthrough)
 void setView(ChatView view)
          set this Chat's GUI
 void updateUserView()
          update this Chat's ChatView's user list
 
Methods inherited from class candy.core.candyObject
getDescription, getHandle, setDescription, setHandle
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

members

java.util.Vector members
Members involved in this Chat

sessionID

java.lang.String sessionID
ID for this chat session

space

net.jini.space.JavaSpace space
JavaSpace

myView

transient ChatView myView
ui for this chat

myOwner

transient ClientApp myOwner
client app that owns this chat

mgr

transient net.jini.core.transaction.server.TransactionManager mgr
TransactionManager to insure atomic actions in the JavaSpace

theData

java.util.Vector theData
The Vector of ChatPackets which is the entire chat session Stored for data-maintenance, and transcript creation

theUserList

transient CUserList theUserList
the user list object used to show active user's in this Chat's GUI

transcripting

public java.lang.Boolean transcripting
flag telling this chat whether or not it should create a transcript of itself

transcriptIdx

public java.lang.Integer transcriptIdx
index used when running this Chat as a transcript represents the current location in the Vector of stored ChatPackets
Constructor Detail

Chat

public Chat(net.jini.space.JavaSpace space,
            ClientApp client,
            ChatView view,
            net.jini.core.transaction.server.TransactionManager m)

Chat

public Chat(net.jini.space.JavaSpace space,
            ClientApp client,
            ChatView view,
            java.util.Vector users,
            net.jini.core.transaction.server.TransactionManager m)

Chat

public Chat(net.jini.space.JavaSpace space,
            ClientApp client,
            ChatView view,
            java.util.Vector users,
            net.jini.core.transaction.server.TransactionManager m,
            java.lang.String session)

Chat

public Chat(net.jini.space.JavaSpace space,
            ClientApp client,
            ChatView view,
            java.util.Vector users,
            net.jini.core.transaction.server.TransactionManager m,
            boolean transcript)
Method Detail

addMember

public void addMember(Member m)

addMember

public void addMember(java.lang.String ID)

removeMember

public void removeMember(Member m)

setMembers

public void setMembers(java.util.Vector users)

getActiveMembers

public MemberTable getActiveMembers()

getMembers

public java.util.Vector getMembers()

send

public void send(candy.core.packet.ChatPacket cp)
sends a packet containing a chat message
Parameters:
cp - a ChatPacket containing a chat message

getSessionID

public java.lang.String getSessionID()
get the ID for this Chat
Returns:
String representing this Chat session

setSessionID

public void setSessionID(java.lang.String s)
set this Chat's unique ID

newMessage

public void newMessage(java.lang.String message)
add and send a new message for this Chat

setTranscripting

public void setTranscripting(boolean b)
set whether this Chat will handle its own transcripting (false if this a Chat inside of a Meeting/CodeWalkthrough)

setView

public void setView(ChatView view)
set this Chat's GUI

depart

public void depart()
this user is leaving this Chat, tell other active members of this Chat

receive

public void receive(candy.core.packet.ChatMsgPacket cmp)
receives a ChatMsgPacket sent to this user

add

public void add(candy.core.packet.ChatAddPacket cap)
add a new Member to this Chat

remove

public void remove(candy.core.packet.ChatLeavePacket clp)
remove a Member from this Chat

kill

public void kill()
remove this Chat from the owning ClientApps list of active Chats

invite

public void invite(java.lang.String ID)
used to invite another Member to join this Chat
Parameters:
mem - Member to be invited

updateUserView

public void updateUserView()
update this Chat's ChatView's user list

createTranscript

public void createTranscript()
create a transcript of this Chat session

createViewForTranscript

public CandyView createViewForTranscript(javax.swing.JDesktopPane p,
                                         ClientApp a,
                                         java.lang.String s)
A Factory procedure that returns a correct view for this Chat class
Specified by:
createViewForTranscript in interface Transcriptable

rewindTranscript

public CandyView rewindTranscript(javax.swing.JDesktopPane p,
                                  ClientApp a,
                                  java.lang.String s)
clears the current chat display in the view and resets the index of the transcripted data to the beginning
Specified by:
rewindTranscript in interface Transcriptable

getTotal

public int getTotal()
Specified by:
getTotal in interface Transcriptable

getCurrent

public int getCurrent()
gets the current indice in the Transcript packets
Specified by:
getCurrent in interface Transcriptable

nextForTranscript

public boolean nextForTranscript()
gets the next Packet for this Chat as a Transcript
Specified by:
nextForTranscript in interface Transcriptable

playTranscript

public void playTranscript()
play this Chat Transcript

completeTranscript

public void completeTranscript()
fast forward to the end of the Transcript packets, displaying them all