Beans binding + disappointment

H

Hole

Hi There,

I was looking for a solution to bind Swing widgets and beans (or list
of beans).
Surprisingly, I've found some projects on dev.java.net that are
completely overlapped and it's not clear which project is active or
not (as for JSRs).

In Java 6 SE, there's no bean binding implementation.

So, is anyone aware of a standard, stabilized and wide-used by java
community for bindings?

In particular, I was looking for some patterns/libraries that allows
to bind directly a JTable and a list of beans. And, for instance,
retrieve the bean which corresponds to a selected row in a JTable and
binding properties of this selected bean to text properties of some
JLabels (imagine a panel with detailed info about the selected
object).

BTW, I'm really disappointed about this mess around...

Thanks in advance,
 
A

Alessio Stalla

Hi There,

I was looking for a solution to bind Swing widgets and beans (or list
of beans).
Surprisingly, I've found some projects on dev.java.net that are
completely overlapped and it's not clear which project is active or
not (as for JSRs).

In Java 6 SE, there's no bean binding implementation.

So, is anyone aware of a standard, stabilized and wide-used by java
community for bindings?
[snip]

I don't know about your specific JTable issue, but in general I
recommend JGoodies Binding. It is actively maintained and has a nice
API, imho. The most popular alternative is probably BBB (Better Beans
Binding), but I've never used it.

hth,
Alessio
 
M

markspace

Hole said:
I was looking for a solution to bind Swing widgets and beans (or list
of beans).
Surprisingly, I've found some projects on dev.java.net that are
completely overlapped and it's not clear which project is active or
not (as for JSRs).


Can you share what you found, overlapped or otherwise? I'd be
interested in seeing what has been worked on so far. It might also help
us understand what sort of binding you are looking for. I think most of
us have a general idea but something a little more specific might be
helpful.
 
H

Hole

I was looking for a solution to bind Swing widgets and beans (or list
of beans).
Surprisingly, I've found some projects on dev.java.net that are
completely overlapped and it's not clear which project is active or
not (as for JSRs).
In Java 6 SE, there's no bean binding implementation.
So, is anyone aware of a standard, stabilized and wide-used by java
community for bindings?

[snip]

I don't know about your specific JTable issue, but in general I
recommend JGoodies Binding. It is actively maintained and has a nice
API, imho. The most popular alternative is probably BBB (Better Beans
Binding), but I've never used it.

hth,
Alessio

Thanks Alessio,

actually I chose to look at that since it seems the proposal that
might be adopted in JDK 7, is it right?
 
A

Alessio Stalla

I was looking for a solution to bind Swing widgets and beans (or list
of beans).
Surprisingly, I've found some projects on dev.java.net that are
completely overlapped and it's not clear which project is active or
not (as for JSRs).
In Java 6 SE, there's no bean binding implementation.
So, is anyone aware of a standard, stabilized and wide-used by java
community for bindings?

I don't know about your specific JTable issue, but in general I
recommend JGoodies Binding. It is actively maintained and has a nice
API, imho. The most popular alternative is probably BBB (Better Beans
Binding), but I've never used it.
hth,
Alessio

Thanks Alessio,

actually I chose to look at that since it seems the proposal that
might be adopted in JDK 7, is it right?

I don't think BBB is being included in JDK 7. At least the JDK 7
features page [1] does not list it. I do believe that it's included in
the Swing GUI editor, Matisse, which is part of NetBeans, but I'm not
sure about that.

Alessio

[1] http://openjdk.java.net/projects/jdk7/features/
 
D

Daniel Pitts

Hi There,

I was looking for a solution to bind Swing widgets and beans (or list
of beans).
Surprisingly, I've found some projects on dev.java.net that are
completely overlapped and it's not clear which project is active or
not (as for JSRs).

In Java 6 SE, there's no bean binding implementation.

So, is anyone aware of a standard, stabilized and wide-used by java
community for bindings?

In particular, I was looking for some patterns/libraries that allows
to bind directly a JTable and a list of beans. And, for instance,
retrieve the bean which corresponds to a selected row in a JTable and
binding properties of this selected bean to text properties of some
JLabels (imagine a panel with detailed info about the selected
object).

BTW, I'm really disappointed about this mess around...

Thanks in advance,
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.

Also note, that while it is certainly a common use-case to have a table
which is bindable to a list of beans, the JTable is much more flexible
(think spread-sheet, or special "command" rows, etc...), and can have
different "sections" of the same table be treated differently.

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.
 
T

Tom Anderson

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?

tom
 
J

John B. Matthews

Tom Anderson said:
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 see NetBeans has a help topic entitled "Binding Data to a Swing
Component". It permits binding to either JTable and JList.
 
D

Daniel Pitts

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.

Code weaving could actually handle this (and field-write could be
wrapped with advice to fire an event, making assumptions about "simple"
getter/setter code.
 
H

Hole

Can you share what you found, overlapped or otherwise?  I'd be
interested in seeing what has been worked on so far.  It might also help
us understand what sort of binding you are looking for.  I think most of
us have a general idea but something a little more specific might be
helpful.

Hi,
thanks for you reply.
I'll come back to you with a post presenting various existing
alternatives on beans binding (some of them are dismissed).

I'll try to explain better (perhaps with some code) my needs...I think
that beans binding is a common need in desktop development
 
H

Hole

I see NetBeans has a help topic entitled "Binding Data to a Swing
Component". It permits binding to either JTable and JList.
Hi John,
AFAIK, it permits quite easily a binding between Swing components'
properties while I look for a solution to bind POJO properties to a
Swing component property.
 
H

Hole

Can you share what you found, overlapped or otherwise?  I'd be
interested in seeing what has been worked on so far.  It might also help
us understand what sort of binding you are looking for.  I think most of
us have a general idea but something a little more specific might be
helpful.

Hi,

I've found this post. Quite interesting. It could help to understand
the issue I was talking about.
http://djnweb2.sjc.collab.net/blog/2009/03/25/lets-fork-beansbinding
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top