edu.brook.ascape.model
Interface ScapeListener

All Known Subinterfaces:
ComponentView
All Known Implementing Classes:
DefaultScapeListener, NonGraphicView, ChartViewModel

public abstract interface ScapeListener
extends java.util.EventListener, HasName

A listener to an agent scape. When a scape is updated, it is the listener's responsility to update itself, and then inform the scape that updating is finished, so that the scape can continue iterating through its rules. CanvasView and NonGraphicView provide good reference implementations of the listener contract. Important: it is the scape listeners responibility to remove itself from the scape on deletion. ComponentView requires a remove method where this should be done. Again, see CanvasView for the reference implementation.

Since:
1.0
Version:
1.2.6
See Also:
CanvasView, NonGraphicView

Method Summary
 void addScape(Scape scape)
          Add a scape to this view.
 void removeScape(Scape scape)
          Removes the scape from this view.
 void scapeUpdated(ScapeEvent event)
          Informs the listener that the agent scape has been updated, so that the listener can update itself.
 
Methods inherited from interface edu.brook.ascape.util.HasName
getName
 

Method Detail

addScape

public void addScape(Scape scape)
              throws java.util.TooManyListenersException
Add a scape to this view. A given view typically has one and only one scape.
Parameters:
scape - the agent scape this listener is primarily interested in
See Also:
CanvasView.addScape(edu.brook.ascape.model.Scape)

removeScape

public void removeScape(Scape scape)
Removes the scape from this view. Typically there should ony be one scape to remove. In this common case (all component views should act this way), null may be passed. This method must be called whenever a listener is destroyed or becomes unresponsive; otherwise the model will wait indefinetly for the listener's updated response.
Parameters:
scape - the agent scape to remove

scapeUpdated

public void scapeUpdated(ScapeEvent event)
Informs the listener that the agent scape has been updated, so that the listener can update itself.
Parameters:
event - the scape setup event

(c) 1998-2000 The Brookings Insitution
Webpage