wyvern.lib.properties
Interface AddRemoveNotify

All Known Implementing Classes:
AutobagRules, AxisShapeChanger, BerserkSkill, GiantShrink, GuildSkills, HalflingSkills, HealersCurse, JumpSkill, MovableLightSource, MovableSoundSource, NagaShift, PixieSkills, ProximityProperty, RakshasaSkills, Searcher, SpeechFilter, TerrainSpeed, VerboseCommand.Verboser

public interface AddRemoveNotify

This interface is implemented by Bean properties that need to know when they're added to or removed from a GameObject. This is often necessary when a property is acting as a surrogate for its associated GameObject.

For example, the MovableLightSource property contains all the lighting code for normal light sources. You simply add one to any GameObject and that GameObject will become a light source. In order for the MovableLightSource property to be able to get on the appropriate hooks to do its work, it needs to know when it's attached to (or detached from) a GameObject.

If the previous value (the one we're replacing under the same property name, if any) is also an AddRemoveNotify, then its notifyRemove() is called before our notifyAdd().

Version:
1.0, Feb 07, 1999
Author:
Steve Yegge

Method Summary
 void notifyAdd(PropertyList list)
          Notifies the property that it's being added to a PropertyList.
 void notifyRemove(PropertyList list)
          Notifies the property that it's being removed from a PropertyList.
 

Method Detail

notifyAdd

public void notifyAdd(PropertyList list)
Notifies the property that it's being added to a PropertyList.

You should never assume that the passed value is a GameObject. Make sure to test it with instanceof (Java) or isInstance (Jython) first. Properties are added to Archetypes as well as GameObjects, so your AddRemoveNotify is likely to be called for both cases.

Parameters:
list - the PropertyList whose property list we're being added to

notifyRemove

public void notifyRemove(PropertyList list)
Notifies the property that it's being removed from a PropertyList.

You should never assume that the passed value is a GameObject. Make sure to test it with instanceof (Java) or isInstance (Jython) first. Properties are added to Archetypes as well as GameObjects, so your AddRemoveNotify is likely to be called for both cases.

Parameters:
list - the PropertyList we're being removed from