gcspy.vis
Class SpaceManager

java.lang.Object
  extended by gcspy.vis.SpaceManager
All Implemented Interfaces:
EventListener, SpaceListener, DisconnectListener, TileManagerListener

public class SpaceManager
extends java.lang.Object
implements TileManagerListener, DisconnectListener, EventListener, SpaceListener

Manages the interaction between a Space and the visualiser

Author:
Tony Printezis, Richard Jones

Constructor Summary
SpaceManager(AbstractFrame owner, ClientInterpreter interpreter, ClientSpace space, SpaceManagerInterface spaceManagerInterface, boolean active, boolean small, boolean tiny)
          Create a new space manager
 
Method Summary
 void activate()
          Activate this space
 void deactivate()
          Deactivate this space
 void disconnect(boolean reconnecting)
          Respond to the client disconnecting from the server
 void event(int eventID, int elapsedTime, int compensationTime)
          Respond to an EVENT command from the server
 javax.swing.JPanel getMainPanel()
          Get the main panel
 void mapImage()
          Draw the tiles image
 void redraw()
          Redraw the tiles
 void redrawOne(TileManager tm)
          Redraw the space
 void selectedStream(int id)
          Select a stream
 void setWidth(int width)
          Set the width of the space
 void space(ClientSpace space)
          Respond to a SPACE command from the server.
 void tileDeselected()
          Deselect a (previously selected) tile
 void tileSelected(int index)
          A tile is selected
 void updateBlockInfo()
          Update the block info
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpaceManager

public SpaceManager(AbstractFrame owner,
                    ClientInterpreter interpreter,
                    ClientSpace space,
                    SpaceManagerInterface spaceManagerInterface,
                    boolean active,
                    boolean small,
                    boolean tiny)
Create a new space manager

Parameters:
owner - The parent fram
interpreter - The client interpreter
space - the space to manage
spaceManagerInterface - Typically the main frame
active - True if this space is active
small - True if the tiles are small
tiny - True if the tiles are tiny
Method Detail

selectedStream

public void selectedStream(int id)
Select a stream

Parameters:
id - The stream's ID

event

public void event(int eventID,
                  int elapsedTime,
                  int compensationTime)
Description copied from interface: EventListener
Respond to an EVENT command from the server

Specified by:
event in interface EventListener
Parameters:
eventID - The event's ID
elapsedTime - the elapsed time for the event
compensationTime - The compensation time

space

public void space(ClientSpace space)
Description copied from interface: SpaceListener
Respond to a SPACE command from the server.

Specified by:
space in interface SpaceListener
Parameters:
space - The new ClientSpace

mapImage

public void mapImage()
Draw the tiles image


redraw

public void redraw()
Description copied from interface: TileManagerListener
Redraw the tiles

Specified by:
redraw in interface TileManagerListener

disconnect

public void disconnect(boolean reconnecting)
Description copied from interface: DisconnectListener
Respond to the client disconnecting from the server

Specified by:
disconnect in interface DisconnectListener
Parameters:
reconnecting - Is the client reconnnecting?

deactivate

public void deactivate()
Deactivate this space


activate

public void activate()
Activate this space


redrawOne

public void redrawOne(TileManager tm)
Redraw the space

Parameters:
tm - The tile manager for this space

tileSelected

public void tileSelected(int index)
Description copied from interface: TileManagerListener
A tile is selected

Specified by:
tileSelected in interface TileManagerListener
Parameters:
index - The index of the tile

tileDeselected

public void tileDeselected()
Description copied from interface: TileManagerListener
Deselect a (previously selected) tile

Specified by:
tileDeselected in interface TileManagerListener

updateBlockInfo

public void updateBlockInfo()
Update the block info


setWidth

public void setWidth(int width)
Set the width of the space

Parameters:
width - The width to set

getMainPanel

public javax.swing.JPanel getMainPanel()
Get the main panel

Returns:
the main panel