edu.brook.ascape.view
Class NonGraphicView

java.lang.Object
  |
  +--edu.brook.ascape.view.NonGraphicView
Direct Known Subclasses:
DataView, SweepControlView

public class NonGraphicView
extends java.lang.Object
implements ScapeListener

A base class for most non-gui observer of scapes. Provides notification of scape updates.

Since:
1.1
Version:
1.0 2/19/1999

Field Summary
protected  java.lang.String name
          The name of the view.
protected  Scape scape
          The scape this view is observing.
 
Constructor Summary
NonGraphicView()
           
 
Method Summary
 void addScape(Scape scape)
          Add a scape to the view.
 java.lang.String getName()
          Returns a name for the view as defined by set name.
 Scape getScape()
          Returns the scape being viewed.
 void NonGraphicView()
          Constructs a non-grahpic view.
 void NonGraphicView(java.lang.String name)
          Constructs a non-grahpic view.
 void onClose()
          Method called when the model is closed.
 void onIterate()
          Called when scape is iterated.
 void onSetup()
          Method called when the scape is ready for setup.
 void onStart()
          Method called when the scape is started.
 void onStop()
          Method called when the scape is stopped.
 void onUpdate()
          Method called each time the scape is updated.
 void removeScape(Scape scape)
          Removes the scape from this listener.
 void scapeUpdated(ScapeEvent scapeEvent)
          Notifies this view that its scape has been updated.
 void setName(java.lang.String name)
          Sets the name of this view.
 java.lang.String toString()
          Returns a short description of this view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

scape

protected Scape scape
The scape this view is observing.

name

protected java.lang.String name
The name of the view.
Constructor Detail

NonGraphicView

public NonGraphicView()
Method Detail

NonGraphicView

public void NonGraphicView()
Constructs a non-grahpic view.

NonGraphicView

public void NonGraphicView(java.lang.String name)
Constructs a non-grahpic view.
Parameters:
name - a user relevant name for this view

getScape

public Scape getScape()
Returns the scape being viewed.

addScape

public void addScape(Scape scape)
              throws java.util.TooManyListenersException
Add a scape to the view. A view can be assigned only one scape.
Specified by:
addScape in interface ScapeListener
Parameters:
scape - the scape to make this view the observer of
Throws:
java.util.TooManyListenersException - on attempt to add a scape when one is allready added

removeScape

public void removeScape(Scape scape)
Removes the scape from this listener. Null expected.
Specified by:
removeScape in interface ScapeListener
Parameters:
scape - the scape to remove

onIterate

public void onIterate()
Called when scape is iterated.

onSetup

public void onSetup()
Method called when the scape is ready for setup. No-op for base class.

onUpdate

public void onUpdate()
Method called each time the scape is updated. No-op for base class.

onStart

public void onStart()
Method called when the scape is started. No-op for base class.

onStop

public void onStop()
Method called when the scape is stopped. No-op for base class.

onClose

public void onClose()
Method called when the model is closed. No-op for base class.

scapeUpdated

public void scapeUpdated(ScapeEvent scapeEvent)
Notifies this view that its scape has been updated. This view then has a chance to update itself, and this super method then notifies the scape that the view itself has been updated. By deafult, calls the onScapeStart, onScapeUpdate, or onScapeStop method as appropriate, and then notifies scape. To subclass NonGraphics view, simply override this method, calling super when finished.
Specified by:
scapeUpdated in interface ScapeListener
Parameters:
scapeEvent - a scape event update, usually unspecified

getName

public java.lang.String getName()
Returns a name for the view as defined by set name.

setName

public final void setName(java.lang.String name)
Sets the name of this view.
Parameters:
name - a user relevant name for this view

toString

public java.lang.String toString()
Returns a short description of this view. Sames as name unless overridden.
Overrides:
toString in class java.lang.Object

(c) 1998-2000 The Brookings Insitution
Webpage