Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Pattern for object modified

Reply
Thread Tools

Pattern for object modified

 
 
VisionSet
Guest
Posts: n/a
 
      06-13-2004
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.

TIA
--
Mike W


 
Reply With Quote
 
 
 
 
Thomas Weidenfeller
Guest
Posts: n/a
 
      06-14-2004
VisionSet wrote:
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating an object that can track when its attributes are modified Ben Sizer Python 11 03-08-2013 06:50 PM
documents related to factory design pattern and Abstract foctory pattern. sunny C++ 1 12-07-2006 04:26 AM
Detecting when an object's instance variables are modified Paul Murton Ruby 7 08-28-2006 05:48 AM
boolean endsWith(String s, Pattern pattern) lepikhin@gmail.com Java 17 11-16-2005 10:31 AM
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM



Advertisments