Created mechanism for listeners to hear about object death.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@535 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// $Id: ObjectDeathListener.java,v 1.1 2001/10/23 23:56:12 mdb Exp $
|
||||
|
||||
package com.threerings.presents.dobj;
|
||||
|
||||
/**
|
||||
* Implemented by entites which wish to hear about object destruction
|
||||
* events.
|
||||
*
|
||||
* @see DObject#addListener
|
||||
*/
|
||||
public interface ObjectDeathListener
|
||||
{
|
||||
/**
|
||||
* Called when this object has been destroyed. This will be called
|
||||
* <em>after</em> the event has been applied to the object.
|
||||
*
|
||||
* @param event The event that was dispatched on the object.
|
||||
*/
|
||||
public void objectDestroyed (ObjectDestroyedEvent event);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: ObjectDestroyedEvent.java,v 1.2 2001/10/11 04:07:52 mdb Exp $
|
||||
// $Id: ObjectDestroyedEvent.java,v 1.3 2001/10/23 23:56:12 mdb Exp $
|
||||
|
||||
package com.threerings.presents.dobj;
|
||||
|
||||
@@ -39,9 +39,7 @@ public class ObjectDestroyedEvent extends TypedEvent
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies this attribute change to the object.
|
||||
*/
|
||||
// documentation inherited
|
||||
public boolean applyToObject (DObject target)
|
||||
throws ObjectAccessException
|
||||
{
|
||||
@@ -50,11 +48,21 @@ public class ObjectDestroyedEvent extends TypedEvent
|
||||
return true;
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public short getType ()
|
||||
{
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
protected void notifyListener (Object listener)
|
||||
{
|
||||
if (listener instanceof ObjectDeathListener) {
|
||||
((ObjectDeathListener)listener).objectDestroyed(this);
|
||||
}
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
protected void toString (StringBuffer buf)
|
||||
{
|
||||
buf.append("DESTROY:");
|
||||
|
||||
Reference in New Issue
Block a user