org.ascape.view.nonvis
Class ScapeTransitionListener

java.lang.Object
  extended by org.ascape.model.event.DefaultScapeListener
      extended by org.ascape.view.nonvis.ScapeTransitionListener
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.EventListener, ScapeListener, HasName

public class ScapeTransitionListener
extends DefaultScapeListener

A listener providing notification when a scape transitions from one state to another. For example, when a scape was paused and is now resumed, an apporiate method will be called. Additionally, this view also guarantees that updateTransitions of the view at least 6 times a second regardless of the nature of the scape notification. This will allow pauses and resumes to be noticed in time to immediately alert the user, regardless of what is happening with the model.

Since:
5.1
Version:
5.1
Author:
Miles Parker
See Also:
Serialized Form

Field Summary
protected  boolean lastScapeAppearsPaused
          Did the scape appear to be paused last iteration?.
 
Fields inherited from class org.ascape.model.event.DefaultScapeListener
listeningToScape, name, scape
 
Constructor Summary
ScapeTransitionListener()
          Constructs the control view, creating and laying out its components.
ScapeTransitionListener(java.lang.String name)
          Constructs the speed slider view.
 
Method Summary
 void environmentNowNoScape()
          Environment now no scape.
 void environmentNowScape()
          Environment now scape.
 boolean isLifeOfScape()
          Returns true if the listener is intended to be used only for the current scape; in this case returns false because control views typically will exist for multiple scapes.
 void scapeAdded(ScapeEvent scapeEvent)
          Called on interation; delays models return by delay slider setting.
 void scapeNotification(ScapeEvent scapeEvent)
          Notifies this view that something has happened on the scape.
 void scapeNowPaused()
          Scape now paused.
 void scapeNowResumed()
          Scape now resumed.
 void scapeNowRunning()
          Scape now running.
 void scapeNowSteppable()
          Scape now steppable.
 void scapeNowStopped()
          Scape now stopped.
 void scapeRemoved(ScapeEvent scapeEvent)
          Called on interation; delays models return by delay slider setting.
 void updateTransitions()
          Update the components.
 
Methods inherited from class org.ascape.model.event.DefaultScapeListener
clone, environmentQuiting, getName, getScape, isGraphic, isNotifyScapeAutomatically, notifyScapeUpdated, scapeClosing, scapeDeserialized, scapeInitialized, scapeIterated, scapeSetup, scapeStarted, scapeStopped, setName, setNotifyScapeAutomatically, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

lastScapeAppearsPaused

protected boolean lastScapeAppearsPaused
Did the scape appear to be paused last iteration?.

Constructor Detail

ScapeTransitionListener

public ScapeTransitionListener()
Constructs the control view, creating and laying out its components.


ScapeTransitionListener

public ScapeTransitionListener(java.lang.String name)
Constructs the speed slider view.

Parameters:
name - a user relevant name for this view
Method Detail

scapeNowRunning

public void scapeNowRunning()
Scape now running.


scapeNowStopped

public void scapeNowStopped()
Scape now stopped.


scapeNowPaused

public void scapeNowPaused()
Scape now paused.


scapeNowResumed

public void scapeNowResumed()
Scape now resumed.


scapeNowSteppable

public void scapeNowSteppable()
Scape now steppable.


environmentNowScape

public void environmentNowScape()
Environment now scape.


environmentNowNoScape

public void environmentNowNoScape()
Environment now no scape.


scapeAdded

public void scapeAdded(ScapeEvent scapeEvent)
                throws java.util.TooManyListenersException
Called on interation; delays models return by delay slider setting.

Specified by:
scapeAdded in interface ScapeListener
Overrides:
scapeAdded in class DefaultScapeListener
Parameters:
scapeEvent - the scape event
Throws:
java.util.TooManyListenersException - the too many listeners exception

scapeRemoved

public void scapeRemoved(ScapeEvent scapeEvent)
Called on interation; delays models return by delay slider setting.

Specified by:
scapeRemoved in interface ScapeListener
Overrides:
scapeRemoved in class DefaultScapeListener
Parameters:
scapeEvent - the scape event
See Also:
scapeAdded

updateTransitions

public void updateTransitions()
Update the components. Ensures that the state of all buttons matchhes the state of the observed scape.


isLifeOfScape

public boolean isLifeOfScape()
Returns true if the listener is intended to be used only for the current scape; in this case returns false because control views typically will exist for multiple scapes.

Specified by:
isLifeOfScape in interface ScapeListener
Overrides:
isLifeOfScape in class DefaultScapeListener
Returns:
true, if is life of scape

scapeNotification

public void scapeNotification(ScapeEvent scapeEvent)
Notifies this view that something has happened on the scape. 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 default, calls the onStart, updateScapeGraphics, or onStop method as appropriate, and then notifies scape.

Specified by:
scapeNotification in interface ScapeListener
Overrides:
scapeNotification in class DefaultScapeListener
Parameters:
scapeEvent - a scape event update


Copyright © 1998-2008 The Brookings Institution, NuTech Solutions, Metascape, LLC All Rights Reserved.