[jdom-interest] Re: JDOM events

philip.nelson at omniresources.com philip.nelson at omniresources.com
Fri Jun 29 07:29:19 PDT 2001

> Hi
> Please read my mail to the list from Tuesday, 19:36
> title: [jdom-interest] Event enabled classes
> I think the subclasses are quite complete.
> To Do
> ******
> - subclass PartialList / FilterList to fire events
> - look for bugs
> - code models, like
>     TreeModel, TableModel, TableColumnModel, ListSelectionModel ....
> - THINK ABOUT BUBBLING (How to implement, where to use,..)
> - ....

I have been reading this with interest but I have to say, I think this is
the hard way to do it.  In order to use these classes it seems like you
would have to 

subclass jdom core nodes
subclass JDOMFactory to use them
create listeners and add them to the tree at build time
extract the info needed for models
build and set models
handle events and locate the element to update
update the element
listener code does it stuff.
update model
redraw gui

This is off the top of my head and could easily be better than this in your
implementation but bear with me here ;)

If you instead wrap the jdom nodes it gets a lot simpler I think.  The
wrapper can have toString specifically taylored to the model you want to
use.  I can carry a reference to the underlying JDOM core class instance.
You can build iterators of full, partial, filtered content of your document
specifically taylored to your application.  Then the rest is simpler.

build a normal jdom document
iterate on document creating wrapper nodes and insert into model
set model on gui
handle events and update node selected in model
redraw gui

OK, maybe there's more steps than this ;) but it really is quite a bit
simpler I think.  Brett's upcoming second edition of JavaXML will have an
example of doing much of this.

More information about the jdom-interest mailing list