Interface for objects that need to be notified of hierarchy changes above them.
Objects that implement this listener register with their container
and will be notified when certain significant events above them in the hierarchy
occur. In particular:
- if the container of any object above changes;
- if any object changes from an instance to a class or vice versa; or
- if any object changes from opaque to transparent or vice versa
(acquires or loses a Director).
In each case,
two methods will be called on the object implementing this interface:
first,
hierarchyWillChange()
is called, notifying the object that
the hierarchy is about to change; then
hierarchyChanged()
is called,
notifying the object that the hierarchy has changed.
The notified object can prevent changes by throwing an exception when
the first method is called.