|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ascape.model.event.DefaultScapeListener
public abstract class DefaultScapeListener
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. DefaultScapeListener provides a good reference implementation of the listener contract. By default, this is assumed to be a nongrphic view. Overide isGraphic to return true if you are implementing a graphic view.
Field Summary | |
---|---|
protected boolean |
listeningToScape
Is this scape view delegate currently listening to a scape? Seperated from wether scape is null, becuase we want to be able to save old scape. |
protected java.lang.String |
name
The name of the view. |
Scape |
scape
The scape being listened to. |
Constructor Summary | |
---|---|
DefaultScapeListener()
Constructs a default listener. |
|
DefaultScapeListener(java.lang.String name)
Constructs a default listener. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Clones this object. |
void |
environmentQuiting(ScapeEvent scapeEvent)
Method called as the scape is about to be closed. |
java.lang.String |
getName()
Returns a name for the view as defined by set name. |
Scape |
getScape()
Returns the scape the listner is listening to. |
boolean |
isGraphic()
Is this a grpahic view? By default, returns false. |
boolean |
isLifeOfScape()
Returns true (default) if the listener is intended to be used only for the current scape; typical of all but control related listeners. |
boolean |
isNotifyScapeAutomatically()
Should the scape be notified automatically? Default is true. |
void |
notifyScapeUpdated()
Calls the observed scape and notifies it that the view has finished updating its state. |
void |
scapeAdded(ScapeEvent scapeEvent)
Add the view to the scape, registering it as a listener, and ensuring that it hasn't been added to any other scapes. |
void |
scapeClosing(ScapeEvent scapeEvent)
Method called as the scape is about to be closed. |
void |
scapeDeserialized(ScapeEvent scapeEvent)
Method called immediatly after a model is deserialized. |
void |
scapeInitialized(ScapeEvent scapeEvent)
Called immediatly after the scape is initialized. |
void |
scapeIterated(ScapeEvent scapeEvent)
Called immediatly after scape is iterated. |
void |
scapeNotification(ScapeEvent scapeEvent)
Notifies the delegating view that something has happened on the scape. |
void |
scapeRemoved(ScapeEvent scapeEvent)
Notifies the listener that the scape has removed it. |
void |
scapeSetup(ScapeEvent scapeEvent)
Method called when the scape is ready for setup. |
void |
scapeStarted(ScapeEvent scapeEvent)
Called immediatly after the scape is started. |
void |
scapeStopped(ScapeEvent scapeEvent)
Called immediatly after the scape is stopped. |
void |
setName(java.lang.String name)
Sets the name of this view. |
void |
setNotifyScapeAutomatically(boolean notifyScapeAutomatically)
Sets wether the scape is notified automatically. |
java.lang.String |
toString()
Returns a short description of this view. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public Scape scape
protected boolean listeningToScape
protected java.lang.String name
Constructor Detail |
---|
public DefaultScapeListener()
public DefaultScapeListener(java.lang.String name)
name
- a user relevant name for this viewMethod Detail |
---|
public void scapeInitialized(ScapeEvent scapeEvent)
scapeInitialized
in interface ScapeListener
scapeEvent
- the scape eventpublic void scapeStarted(ScapeEvent scapeEvent)
scapeStarted
in interface ScapeListener
scapeEvent
- the scape eventpublic void scapeStopped(ScapeEvent scapeEvent)
scapeStopped
in interface ScapeListener
scapeEvent
- the scape eventpublic void scapeIterated(ScapeEvent scapeEvent)
scapeIterated
in interface ScapeListener
scapeEvent
- the scape eventpublic void scapeSetup(ScapeEvent scapeEvent)
scapeSetup
in interface ScapeListener
scapeEvent
- the scape eventpublic void scapeClosing(ScapeEvent scapeEvent)
scapeClosing
in interface ScapeListener
scapeEvent
- the scape eventpublic void environmentQuiting(ScapeEvent scapeEvent)
environmentQuiting
in interface ScapeListener
scapeEvent
- the scape eventpublic void scapeDeserialized(ScapeEvent scapeEvent)
scapeDeserialized
in interface ScapeListener
scapeEvent
- the scape eventpublic void scapeAdded(ScapeEvent scapeEvent) throws java.util.TooManyListenersException
scapeAdded
in interface ScapeListener
scapeEvent
- the event for this scape to make this view the observer of
java.util.TooManyListenersException
- the too many listeners exception
java.util.TooManyListenersException
- on attempt to add a scape when one is allready addedpublic void scapeRemoved(ScapeEvent scapeEvent)
scapeRemoved
in interface ScapeListener
scapeEvent
- the scape removed notification eventscapeAdded
public void scapeNotification(ScapeEvent scapeEvent)
scapeNotification
in interface ScapeListener
scapeEvent
- a scape event updatepublic void notifyScapeUpdated()
public boolean isGraphic()
isGraphic
in interface ScapeListener
public boolean isLifeOfScape()
isLifeOfScape
in interface ScapeListener
public Scape getScape()
getScape
in interface ScapeListener
public boolean isNotifyScapeAutomatically()
public void setNotifyScapeAutomatically(boolean notifyScapeAutomatically)
notifyScapeAutomatically
- true to send a respond update event back immediatly, false to
waitpublic java.lang.String getName()
getName
in interface HasName
public final void setName(java.lang.String name)
name
- a user relevant name for this viewpublic java.lang.Object clone()
clone
in interface ScapeListener
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |