« Return to Thread: Related subjects, listeners and lists with out-of-pipeline dependencies

Related subjects, listeners and lists with out-of-pipeline dependencies

by Kevin Day-7 :: Rate this Message:

Reply to Author | View in Thread

Some parts of this message have been removed. Learn more about Nabble's security policy.
I think that my knowedlge of the GL event publisher has finally hit a wall.
 
We have a list pipeline/graph that has the following 3 players:
 
List 'source'
 
List 'child' - FunctionList(source)
 
List 'parent' - FunctionList(source, new Function(child))
 
So we have direct dependancy between source and both child and parent lists.  But there's the additional dependency introduced by the fact that the Function for list Parent is also dependant on source.  It seems like the update mechanism needs to ensure the following ordering:  source, child, parent.  But we often find updated occuring as: source, parent, child
 
 
 
Is the setRelatedListener method the correct way to solve this?  So far, all attempts at blindly using combinations of setRelatedListener have not been successful (I am still very uncertain on exactly what setRelatedListener and Subject do...  I understand what a listener is, but what's a subject?  The thing being listened to?)  If I'm thinking about it correctly, what I need to say is that the 'parent' listener is dependent on subject 'child', so I'd think that the following call would suffice:
 
publisher.setRelatedListener(parent, child)
 
To paraphrase the javadoc, this would make it so "Child's dependencies are satisfied before Parent is notified"
 
but when I specify this, I get an exception on the next source list mutation:
 
java.lang.UnsupportedOperationException
 at ca.odell.glazedlists.event.SequenceDependenciesEventPublisher$NoOpEventFormat.fire(SequenceDependenciesEventPublisher.java:406)
 at ca.odell.glazedlists.event.SequenceDependenciesEventPublisher$SubjectAndListener.firePendingEvent(SequenceDependenciesEventPublisher.java:445)
 at ca.odell.glazedlists.event.SequenceDependenciesEventPublisher.fireEvent(SequenceDependenciesEventPublisher.java:344)
 at ca.odell.glazedlists.event.ListEventAssembler.commitEvent(ListEventAssembler.java:316)
 at ca.odell.glazedlists.BasicEventList.add(BasicEventList.java:140)
I'm attaching a test case that creates the exception (see results from testItRelatedListnerA2B).  Note that in this test case, the event ordering just happens to work correctly, so it's not good at showing the original dependency issue (although testItRelatedListnerB2A does show the problem that results if events are fired out of order).
 
 
If anyone can point out what I might be doing wrong, I'd really appreciate it.
 
 
 
Thanks in advance,
 
- Kevin


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

TestDependentLists.java (4K) Download Attachment

 « Return to Thread: Related subjects, listeners and lists with out-of-pipeline dependencies