datum API Documentation

datum.viewer
Class Client

java.lang.Object
  |
  +--datum.viewer.Client
All Implemented Interfaces:
ActionListener, EventListener, Receiver

public class Client
extends Object
implements Receiver, ActionListener


Field Summary
static String PERSISTENCE_FIELD
           
static String VIEWER_MESSAGE
           
 
Constructor Summary
Client(Viewer viewer, boolean raw, int initialDelay)
           
 
Method Summary
 void actionPerformed(ActionEvent e)
           
 void connected(Connection connection)
          Called when a Connection has successfully connected and the definitions table has been already transfered.
 void disconnected(Connection connection)
          Called after a Connection has been dropped.
 void error(Connection connection, String errorMessage)
          Called when an error occurs for a Connection.
 void receivedData(Connection connection, Hashtable data)
          Called every time a complete message is received by a Connection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VIEWER_MESSAGE

public static final String VIEWER_MESSAGE

PERSISTENCE_FIELD

public static final String PERSISTENCE_FIELD
Constructor Detail

Client

public Client(Viewer viewer,
              boolean raw,
              int initialDelay)
Method Detail

error

public void error(Connection connection,
                  String errorMessage)
Description copied from interface: Receiver
Called when an error occurs for a Connection. A simple response would be to display the error to the user and take no further action. Many fatal errors automatically disconnect the Connection, which is detectable as the disconnected method will be called immediately following the error. Note that the Server class sometimes calls error with connection equal to null. This indicates that an error not related to a particular client conneciton occured.

Specified by:
error in interface Receiver
Following copied from interface: datum.protocol.Receiver
Parameters:
connection - The connection which this error is coming from.
errorMessage - A description of the error that occured.
See Also:
Receiver.disconnected(Connection)

connected

public void connected(Connection connection)
Description copied from interface: Receiver
Called when a Connection has successfully connected and the definitions table has been already transfered. Thus send commands can be sent immediately following the call to this method, or even in this method.

Specified by:
connected in interface Receiver
Following copied from interface: datum.protocol.Receiver
Parameters:
connection - The connection which has just been established.
See Also:
Connection.send(java.lang.Object[])

receivedData

public void receivedData(Connection connection,
                         Hashtable data)
Description copied from interface: Receiver
Called every time a complete message is received by a Connection. The data argument contains the message mapped by field name according to definitions stored in the Library for this Connection. Clients will often get most data from the server using the Library class, though, and only react to certain types of messages in the receivedData method which require immediate attention.

Specified by:
receivedData in interface Receiver
Following copied from interface: datum.protocol.Receiver
Parameters:
connection - The connection which received a message.
data - The Hashtable which contains field name-value pairs from the message.
See Also:
Connection.getLibrary()

disconnected

public void disconnected(Connection connection)
Description copied from interface: Receiver
Called after a Connection has been dropped. Once this method is called the Connection is already gone, so no messages can be sent after this event.

Specified by:
disconnected in interface Receiver
Following copied from interface: datum.protocol.Receiver
Parameters:
connection - The connection which has just been dropped.

actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener

Up to datum