org.jdesktop.wonderland.client.cell
Class MovableComponent

java.lang.Object
  extended by org.jdesktop.wonderland.client.cell.CellComponent
      extended by org.jdesktop.wonderland.client.cell.MovableComponent
Direct Known Subclasses:
MovableAvatarComponent

public class MovableComponent
extends CellComponent

A component that provides cell movement

Author:
paulby

Nested Class Summary
static interface MovableComponent.CellMoveListener
           
static interface MovableComponent.CellMoveModifiedListener
           
static class MovableComponent.CellMoveSource
           
 
Field Summary
protected  ChannelComponent channelComp
           
protected static java.util.logging.Logger logger
           
protected  ChannelComponent.ComponentMessageReceiver msgReceiver
           
protected  java.util.ArrayList<MovableComponent.CellMoveListener> serverMoveListeners
           
protected  Throttle throttle
           
 
Fields inherited from class org.jdesktop.wonderland.client.cell.CellComponent
cell, status
 
Constructor Summary
MovableComponent(Cell cell)
           
 
Method Summary
 void addServerCellMoveListener(MovableComponent.CellMoveListener listener)
          Listen for move events from the server
protected  void applyLocalTransformChange(CellTransform transform, TransformChangeListener.ChangeSource source)
          Apply the transform change to the cell
protected  CellMessage createMoveRequestMessage(CellTransform transform)
           
protected  ResponseListener createMoveResponseListener(MovableComponent.CellMoveModifiedListener listener)
           
protected  java.lang.Class getMessageClass()
           
 void localMoveRequest(CellTransform transform)
          A request from this client to move the cell.
 void localMoveRequest(CellTransform transform, MovableComponent.CellMoveModifiedListener listener)
          A request from this client to move the cell.
protected  void notifyServerCellMoveListeners(MovableMessage msg, CellTransform transform, MovableComponent.CellMoveSource source)
          Notify any serverMoveListeners that the cell has moved
 void removeServerCellMoveListener(MovableComponent.CellMoveListener listener)
          Remove the server move listener.
protected  void serverMoveRequest(MovableMessage msg)
          Called when a message arrives from the server requesting that the cell be moved.
protected  void setStatus(CellStatus status, boolean increasing)
          Set the status of the component.
 
Methods inherited from class org.jdesktop.wonderland.client.cell.CellComponent
setClientState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

throttle

protected final Throttle throttle

logger

protected static java.util.logging.Logger logger

serverMoveListeners

protected java.util.ArrayList<MovableComponent.CellMoveListener> serverMoveListeners

channelComp

protected ChannelComponent channelComp

msgReceiver

protected ChannelComponent.ComponentMessageReceiver msgReceiver
Constructor Detail

MovableComponent

public MovableComponent(Cell cell)
Method Detail

setStatus

protected void setStatus(CellStatus status,
                         boolean increasing)
Description copied from class: CellComponent
Set the status of the component. This method is overridden by subclasses of cell component. However, if you wish to set the status of a cell component, invoke setComponentStatus() instead.

Overrides:
setStatus in class CellComponent
Parameters:
status - The new status of the component

getMessageClass

protected java.lang.Class getMessageClass()
Returns:
the class of the message this component handles.

localMoveRequest

public void localMoveRequest(CellTransform transform,
                             MovableComponent.CellMoveModifiedListener listener)
A request from this client to move the cell. The cell we be moved locally and the requested change sent to the server. If the server denies the move the cell will be moved to a server provided location and the listener will be called. The server will notify all other clients of the new location.

Parameters:
transform - the requrested transformt
listener - the listener that will be notified in the event the system modifies this move (due to collision etc).

createMoveRequestMessage

protected CellMessage createMoveRequestMessage(CellTransform transform)

createMoveResponseListener

protected ResponseListener createMoveResponseListener(MovableComponent.CellMoveModifiedListener listener)

applyLocalTransformChange

protected void applyLocalTransformChange(CellTransform transform,
                                         TransformChangeListener.ChangeSource source)
Apply the transform change to the cell

Parameters:
transform -
source -

localMoveRequest

public void localMoveRequest(CellTransform transform)
A request from this client to move the cell. The cell we be moved locally and the requested change sent to the server. If the server denies the move the cell will be moved to a server provided location. The server will notify all other clients of the new location.

Parameters:
transform -

serverMoveRequest

protected void serverMoveRequest(MovableMessage msg)
Called when a message arrives from the server requesting that the cell be moved.

Parameters:
msg - the message received from the server

addServerCellMoveListener

public void addServerCellMoveListener(MovableComponent.CellMoveListener listener)
Listen for move events from the server

Parameters:
listener -

removeServerCellMoveListener

public void removeServerCellMoveListener(MovableComponent.CellMoveListener listener)
Remove the server move listener.

Parameters:
listener -

notifyServerCellMoveListeners

protected void notifyServerCellMoveListeners(MovableMessage msg,
                                             CellTransform transform,
                                             MovableComponent.CellMoveSource source)
Notify any serverMoveListeners that the cell has moved

Parameters:
transform -


Open Wonderland - http://openwonderland.org