VisionSet said:
What is the best approach to take in order to fire an event that signifies
that an object has been modified.
This needs to be appropriate for objects with deep trees, where any child
object being modified will fire the event.
The very best way is not to observe individual nodes at all. Reordering
a tree might result in a huge amount of fired events, depending on the
type of events you want to have. Instead, let the tree itself be monitored.
The second best way is to at last avoid the situation where each node in
the tree has its own list of event listeners. Depending on your
situation, it might be enough to have a single list for the whole tree,
and provide the changed node (or some node id) as an actual parameter
when an event is fired. If you need multiple - but not to many -
sets/groups of event listeners, consider to use the flyweight design
pattern to avoid having to duplicate the groups for each associated node.
/Thomas