candy.util.whiteboard
Class Whiteboard

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

public class Whiteboard
extends candyObject
implements Transcriptable

The Whiteboard is the class which encapsulates an entire Whiteboard session from its inception through all of the operations affecting it to its completion. A Whiteboard is comprised mainly of a Vector of Packet's. Each user that is attached to a Whiteboard has a their own copy of the actual Whiteboard and maintains a copy of the same list of packets which represent all the operations on the Whiteboard. Whenever a user adds a WBPrimitive to their copy of the Whiteboard, the WBPrimitive is timestamped and written to the JavaSpace. Each other client attached to the Whiteboard is listening on the JavaSpace for any new WBPrimitive. They extract this WBPrimitive from the JavaSpace and insert it into their ordered list of packets then redraw the Whiteboard; thus ensuring concurrent copies of the same whiteboard.

See Also:
Serialized Form

Field Summary
 java.lang.String handle
          The Whiteboard's identifier
 java.util.Vector members
          A Vector of the Members that are currently attached to the WB
 WhiteboardMeta metadata
          all member vars must be public for javaspace candyObject
(package private)  WhiteboardView myView
          transient WhiteboardView for transcriptable playback
 java.util.Vector packets
          The Vector of timestamped packets making up this WhiteBoard.
 java.lang.Integer transcriptIdx
          Transcriptable interface implementation
 java.lang.Boolean transcripting
           
 
Fields inherited from class candy.core.candyObject
description, timestamp
 
Constructor Summary
Whiteboard()
          Constructor for Entry
Whiteboard(java.lang.String n)
          Construct a regular whiteboard given a string for a handle
Whiteboard(WhiteboardMeta m)
          Construct a whiteboard that will be used to match in the javaspace For this, you are given the meta data on which to match Everything else must be null (jcorso)
 
Method Summary
 void addMember(Member m)
          Add a Member to the Whiteboard
 void addPTD(java.util.Vector p)
          Add this vector of packets to the beginning of my packets vector to "bring me up to date with the current whiteboard"
 void clear()
          Erase the entire whiteboard
 void completeTranscript()
           
 Transcript createTranscript()
           
 CandyView createViewForTranscript(javax.swing.JDesktopPane p, ClientApp a, java.lang.String s)
           
 void deletePrimitive(candy.core.packet.WBPrimitivePacket p)
          Remove a packet from the whiteboard
 boolean equals(Whiteboard b)
          A whiteboard is equal by its handle
 candy.core.packet.WBPrimitivePacket findCollision(java.awt.geom.Point2D.Double l, java.awt.Graphics2D g2)
          Collision detection routine
 int getCurrent()
           
 WhiteboardMeta getMeta()
          Fetch the metadata for this whiteboard
 WBIterator getPrimitivesIterator()
          fetch a specialized iterator for WBPrimitivePackets
 int getTotal()
           
 void newPrimitive(candy.core.packet.WBPrimitivePacket p)
          Add a newPrimitive to this Whiteboard in order.
 boolean nextForTranscript()
           
 void playTranscript()
           
 void removeMember(Member m)
          Remove a member from the current whiteboard
 CandyView rewindTranscript(javax.swing.JDesktopPane p, ClientApp a, java.lang.String s)
          clear display and reset transcript index to beginning of data
 void setTranscripting(boolean b)
           
 java.lang.String toString()
           
 
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, wait, wait, wait
 

Field Detail

myView

transient WhiteboardView myView
transient WhiteboardView for transcriptable playback

members

public java.util.Vector members
A Vector of the Members that are currently attached to the WB

metadata

public WhiteboardMeta metadata
all member vars must be public for javaspace candyObject

handle

public java.lang.String handle
The Whiteboard's identifier

packets

public java.util.Vector packets
The Vector of timestamped packets making up this WhiteBoard. Note: The persistence of the JavaSpace and the ordered-nature of this vector ensure that every user will be rendering the exact same WhiteBoard even though the will have concurrent copies of it.

transcripting

public java.lang.Boolean transcripting

transcriptIdx

public java.lang.Integer transcriptIdx
Transcriptable interface implementation
Constructor Detail

Whiteboard

public Whiteboard(java.lang.String n)
Construct a regular whiteboard given a string for a handle

Whiteboard

public Whiteboard(WhiteboardMeta m)
Construct a whiteboard that will be used to match in the javaspace For this, you are given the meta data on which to match Everything else must be null (jcorso)

Whiteboard

public Whiteboard()
Constructor for Entry
Method Detail

addMember

public void addMember(Member m)
Add a Member to the Whiteboard

addPTD

public void addPTD(java.util.Vector p)
Add this vector of packets to the beginning of my packets vector to "bring me up to date with the current whiteboard"

getPrimitivesIterator

public WBIterator getPrimitivesIterator()
fetch a specialized iterator for WBPrimitivePackets

newPrimitive

public void newPrimitive(candy.core.packet.WBPrimitivePacket p)
Add a newPrimitive to this Whiteboard in order.
Parameters:
p - The WBPrimitivePacket to be inserted

deletePrimitive

public void deletePrimitive(candy.core.packet.WBPrimitivePacket p)
Remove a packet from the whiteboard

clear

public void clear()
Erase the entire whiteboard

equals

public boolean equals(Whiteboard b)
A whiteboard is equal by its handle

getMeta

public WhiteboardMeta getMeta()
Fetch the metadata for this whiteboard

findCollision

public candy.core.packet.WBPrimitivePacket findCollision(java.awt.geom.Point2D.Double l,
                                                         java.awt.Graphics2D g2)
Collision detection routine
Parameters:
l - The point to check for collision
g2 - The graphics context

removeMember

public void removeMember(Member m)
Remove a member from the current whiteboard

setTranscripting

public void setTranscripting(boolean b)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

createTranscript

public Transcript createTranscript()

createViewForTranscript

public CandyView createViewForTranscript(javax.swing.JDesktopPane p,
                                         ClientApp a,
                                         java.lang.String s)
Specified by:
createViewForTranscript in interface Transcriptable

rewindTranscript

public CandyView rewindTranscript(javax.swing.JDesktopPane p,
                                  ClientApp a,
                                  java.lang.String s)
clear display and reset transcript index to beginning of data
Specified by:
rewindTranscript in interface Transcriptable

nextForTranscript

public boolean nextForTranscript()
Specified by:
nextForTranscript in interface Transcriptable

playTranscript

public void playTranscript()

getTotal

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

getCurrent

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

completeTranscript

public void completeTranscript()