org.jdesktop.wonderland.client.cell
Class ChannelComponent

java.lang.Object
  extended by org.jdesktop.wonderland.client.cell.CellComponent
      extended by org.jdesktop.wonderland.client.cell.ChannelComponent

public class ChannelComponent
extends CellComponent

A Component that provides a cell specific communication channel with the server.

Author:
paulby

Nested Class Summary
static interface ChannelComponent.ComponentMessageReceiver
           
 
Field Summary
 
Fields inherited from class org.jdesktop.wonderland.client.cell.CellComponent
cell, status
 
Constructor Summary
ChannelComponent(Cell cell)
           
 
Method Summary
 void addMessageReceiver(java.lang.Class<? extends CellMessage> msgClass, ChannelComponent.ComponentMessageReceiver receiver)
          Register a receiver for a specific message class.
protected  ChannelComponent.ComponentMessageReceiver getMessageReceiver(java.lang.Class<? extends CellMessage> msgClass)
          Get a message receiver for the given class
 ClientConnection.Status getStatus()
           
 void messageReceived(CellMessage message)
          Dispatch messages to any receivers registered for the particular message class
 void removeMessageReceiver(java.lang.Class<? extends CellMessage> msgClass)
          Remove the message receiver listening on the specifed message class
 void send(CellMessage message)
           
 void send(CellMessage message, ResponseListener listener)
           
 ResponseMessage sendAndWait(CellMessage message)
           
 void setCellChannelConnection(CellChannelConnection connection)
          Notification of the CellChannelConnection to use when sending data to the server for this cell.
 
Methods inherited from class org.jdesktop.wonderland.client.cell.CellComponent
setClientState, setStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChannelComponent

public ChannelComponent(Cell cell)
Method Detail

setCellChannelConnection

public void setCellChannelConnection(CellChannelConnection connection)
Notification of the CellChannelConnection to use when sending data to the server for this cell. This method will be called automatically at cell creation time.


addMessageReceiver

public void addMessageReceiver(java.lang.Class<? extends CellMessage> msgClass,
                               ChannelComponent.ComponentMessageReceiver receiver)
Register a receiver for a specific message class. Only a single receiver is allowed for each message class, calling this method to add a duplicate receiver will cause an IllegalStateException to be thrown.

Parameters:
msgClass -
receiver -

removeMessageReceiver

public void removeMessageReceiver(java.lang.Class<? extends CellMessage> msgClass)
Remove the message receiver listening on the specifed message class

Parameters:
msgClass -

getMessageReceiver

protected ChannelComponent.ComponentMessageReceiver getMessageReceiver(java.lang.Class<? extends CellMessage> msgClass)
Get a message receiver for the given class

Parameters:
msgClass - the class of message to get a receiver for

messageReceived

public void messageReceived(CellMessage message)
Dispatch messages to any receivers registered for the particular message class

Parameters:
message -

getStatus

public ClientConnection.Status getStatus()

send

public void send(CellMessage message,
                 ResponseListener listener)

send

public void send(CellMessage message)

sendAndWait

public ResponseMessage sendAndWait(CellMessage message)
                            throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException


Open Wonderland - http://openwonderland.org