[jdom-interest] Doc Listeners etc

Jason Hunter jhunter at acm.org
Tue Apr 3 16:39:14 PDT 2001


> There's doesn't appear to be any support for attaching views or listeners to
> Documents and Elements = nor does the Document appear to get notified of any
> changes to its component Elements. Is this something that will ever appear ?

Here's an excerpt from TODO.txt:

* Consider a listener interface so you could listen to doc changes.
  (Probably after 1.1 honestly; this can be done through manual
subclasses
  already.)  Some pertinent messages on this topic:
 
http://lists.denveronline.net/lists/jdom-interest/2000-July/001586.html
 
http://lists.denveronline.net/lists/jdom-interest/2000-July/001587.html
 
http://lists.denveronline.net/lists/jdom-interest/2000-July/001600.html

Here's also an excerpt I wrote earlier on this topic to a friend who
asked by private email:

Events have the potential to be a performance drag.  For example, you
probably want to be able to tell a doc or element you want to watch all
changes under it, but then all mods have to involve walking up to look
for interested parties, even if no one cares.  I've planned to look at
it in detail for 1.1.  If you want to whip up how you'd see it done in a
way that doesn't make everyone pay a big price, I'd like to take a
look.  What you can do if you want it for your project is to create a
subclass of Element with events and change the builder to build their
subclass version.  We're adding a factory model in SAXBuilder soon to
make that trivial.  Right now you can create an EventElementBuilder
based on SAXBuilder.

Philip wrote:

> Are you talking about SAXBuilder?  There have been about 3 different
> approaches suggested to allow subclassing the jdom classes, all of which
> have some merit.  Ken Rune Helland (3/13/01) submitted a version that allows
> you to specify subclasses to use via a factory.  Jason is hoping for
> comments but there haven't been any yet.  How about you?  Or maybe I've
> missed your point.

Yes, comments are very welcome!

-jh-



More information about the jdom-interest mailing list