Make my ListChangeListener to be called as last one

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Make my ListChangeListener to be called as last one

Dirk Fauth
Hi,

I am searching for a way to create a ListChangeEventHandler that is called after all other listeners are finished. I have found the ListEventPublisher documentation, but addDependency() is deprecated and it doesn't work.

I have the following EventList stack:
1. GlazedLists.eventList()
2. GlazedLists.threadSafeList(eventList)
3. SortedList(threadSafeList)
4. FilterList(sortedList)
5. TreeList(filterList)

I started adding my listener to the TreeList, but at processing time it seems the other lists are not yet finished processing. If I add a delay before processing, everything works fine.

In the Javadoc I read that I should use setRelatedSubject() instead of addDependency(). But I am not sure what relatedSubject should be to achieve that my listener is called as the last one in line.

Any help is appreciated.

Thanks in advance,
Dirk
Reply | Threaded
Open this post in threaded view
|

Re: Make my ListChangeListener to be called as last one

James Lemieux
Hey Dirk,

   Hmmm.... that's a tricky requirement. I think adding a listener to TreeList is as close as you'll get right now, but it depends on your desired results. What I mean is:

If your pipeline really is as simple as you sketch then I think your listener is in the right spot. But, I suspect you have some UI Models listening to the TreeList and they have not yet been called when your listener is notified. I'm not sure if your goal is to know your PIPELINE is consistent, or to know that every last listener on that pipeline has had a chance to react to the ListEvent.

   I've mused for a while at bracketing callbacks to listeners from the ListEventPublisher before and after a ListEvent is about to ripple through the pipeline might be an ok idea. It would be ideal for your current use case.

James


On Wed, Apr 17, 2013 at 8:33 AM, Dirk Fauth <[hidden email]> wrote:
Hi,

I am searching for a way to create a ListChangeEventHandler that is called
after all other listeners are finished. I have found the ListEventPublisher
documentation, but addDependency() is deprecated and it doesn't work.

I have the following EventList stack:
1. GlazedLists.eventList()
2. GlazedLists.threadSafeList(eventList)
3. SortedList(threadSafeList)
4. FilterList(sortedList)
5. TreeList(filterList)

I started adding my listener to the TreeList, but at processing time it
seems the other lists are not yet finished processing. If I add a delay
before processing, everything works fine.

In the Javadoc I read that I should use setRelatedSubject() instead of
addDependency(). But I am not sure what relatedSubject should be to achieve
that my listener is called as the last one in line.

Any help is appreciated.

Thanks in advance,
Dirk



--
View this message in context: http://glazedlists.1045722.n5.nabble.com/Make-my-ListChangeListener-to-be-called-as-last-one-tp5709917.html
Sent from the GlazedLists - User mailing list archive at Nabble.com.