On Tue, 22 Jun 2010, Daniel Pitts wrote:
The trouble with this is that the JTable Model is event driven, where
user-beans need a lot of work to add event notification for property
modification. I've tried to write such a library several times, and
always run into the same issues. Also, custom renders and editors for
bean properties aren't easy to handle in certain cases.
It *is* possible to create an object which implements both
java.util.List and javax.swing.ListModel, the trouble comes from
mutable objects. IF the object mutates, technically an event needs to
be fired. In order to handled that, the beans have to register
listeners. A lot of boiler-plate code. Yarg.
Or else, the binding framework could play at being JPA and take care of
dirty tracking. It could play that dead straight and bind to
JPA-annotated beans, and use existing code weaving techniques to detect
changes, or it could maintain a copy of the state, and diff it with the
current state to generate events on demand. It would be memory- and
CPU-heavy, but hey, next to Swing, who's going to notice?
I would notice. Swing is actually fairly light weight with resources,
since is *is* event driven and not poll driven.
getter/setter code.