Java glazedlists: how to update a table row

1.1k Views Asked by At

I'm missing something obvious here.

I have a glazedlists EventList<X> where X is my custom class. This list contains a bunch of values. When I update one of the values, how do I make sure the GUI updates its display for that row?

3

There are 3 best solutions below

1
On BEST ANSWER

The way to do this appears to be to replace the list element with itself:

 EventList<X> list = /* get reference to a list */
 X x = list.get(3);
 /* update x here */
 list.set(3,x);
1
On

The FAQ mentiones two ways under the question:

How do I tell Glazed Lists that an Object in my EventList has been updated?

Either you use the get/set approach as pointed out by Jason, or you make the elements in the list observable by for instance the PropertyChangeListener and then use the ObservableElementList. I think this second approach is cleaner and it should also work with concurrent threads.

0
On

It looks like you can invoke addListEventListener to register a ListEventListener. See also the Glazed Lists Tutorial.