views:

62

answers:

2

Does the JGoodies list binding support binding list contents to a list object in the model? I know I can add listeners to the list model and domain model and coordinate changes between the two fairly easily, but I wasn't sure if JGoodies would do that. I could only find list binding that dealt with list selection events.

A: 

I'd suggest you use GlazedLists. It's really easy to use and works great.

One issue is you have to use one of their classes that implements EventList; you can't just bind a list model to a pre-existing List.

Jason S
Thanks. I think requiring to use an EventList is problematic in this case though. I have a custom list (that uses checkboxes).
Jeff Storey
That's not hard to do. Decouple your raw data model from the rendering of your data... typically what I do is have a XXXXBean class to represent the data itself, then I use a custom TableFormat from GlazedLists to control the output of the results for the different fields of the data. I am pretty sure that if a field is a boolean then it automatically displays a checkbox. (if not then you just have to add renderers for checkboxes)
Jason S
I do have it separated, though I like to keep a separate model that indicates which items are "checkbox selected" (vs the list selection model). I could probably build that functionality into the list model itself rather than giving the list 2 models (the 2 model are the ListModel and the CheckBoxListModel).
Jeff Storey
ah... you do have a point there.
Jason S
But, I will look into GlazedLists, but I think I'm still trying to figure out if the JGoodies binding will do this...
Jeff Storey
A: 

It looks like the LinkedListModel and ArrayListModel do this. I overlooked those before.

Jeff Storey