[jdom-interest] Event enabled classes
Markus Bernhardt
mbernhardt at swsgmbh.de
Tue Jun 26 11:36:21 PDT 2001
Hi
I have written a set of event enabled jdom classes.
My events are not DOM v3 events (some words later).
Main purpose is the usage as model for a (swing) gui.
The classes are subclasses of the original (beta7).
I placed them into the package org.jdom.contrib.event.
I hope this is ok.
The package can be downloaded via ftp from:
(unix)
ftp://guest:anonymous@pensacola.markus-bernhardt.de/home/guest/jdom-event-b1.tar.gz
(windows)
ftp://guest:anonymous@pensacola.markus-bernhardt.de/home/guest/jdom-event-b1.zip
Any suggestions are welcome !!!
THIS CODE IS BETA.
WORK IN PROGRESS.
START:
*******
on Windows:
1. Unzip package.
2. build.bat start_tree_model_example
on UNIX:
1. Untar package.
2. build.sh start_tree_model_example
After a short time a frame with a tree in it should open.
Press the 'add new element' button.
If a new TreeNode is created everything is correct.
USAGE:
*******
1.
Replace:
import org.jdom.*;
with:
import org.jdom.contrib.event.*;
2.
Change your variable declaration from anything like:
Document document = null;
to
org.jdom.Document document = null;
3.
If you are using SAXBuilder, you have to add one line:
SAXBuilder builder = new SAXBuilder();
builder.setFactory(new org.jdom.contrib.event.input.JDOMFactory());
<= NEW
doc = (Document)builder.build(...);
HOW TO CREATE LISTENER:
****************************
Each listener has to be derived from
org.jdom.contrib.event.JDOMListener
and to implement the method nodeChanged.
Now you can add it to or remove it from any
Element, Document, etc.
use:
element.addJDOMListener(jdomListener);
element.removeJDOMListener(jdomListener);
Your listener will be notified now about all changes.
Why not DOM v3:
***************
DOM v3 specifies several types of events like
DocumentEvents, KeyEvents, FocusEvent etc.
Most of them java already have.
(Think they copied the java events)
DOM v3 specifies some things which are very
critical to performance like bubbling, etc.
I found some reasons to implement this features.
But no time.
Performance
***********
I tried to keep an eye on performance.
If there are for example no listeners at an element,
the whole event stuff will be skipped.
To Do
******
- subclass PartialList / FilterList to fire events
- look for bugs
- code models, like
TreeModel, TableModel, TableColumnModel, ListSelectionModel ....
- think about bubbling
- ....
Hope someone likes this package.
Happy coding.
- markus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mbernhardt.vcf
Type: text/x-vcard
Size: 459 bytes
Desc: Card for Markus Bernhardt
Url : http://jdom.org/pipermail/jdom-interest/attachments/20010626/24c72589/mbernhardt.vcf
More information about the jdom-interest
mailing list