[ImageJ-devel] EventBus issues.

Grant B. Harris gharris at mbl.edu
Thu Jun 23 11:55:34 CDT 2011


I think EventBus can serve us well, but I have run into a serious issue 
that demands that we move from EventBus version 1.2 to 1.4.

Because "subscribers are called in the order in which they subscribed", 
we cannot use the EventBus (1.2) in ways that we need.  If I have a 
class which is watching things (say a ROI Manager or the Window menu 
list of open displays) it's behavior depends on when it was subscribed.  
I've been working on this for a week and I have not found a way to 
manage this.  Fortunately I discovered that as of version 1.3 there is a 
PrioritizedEventSubscriber  
(http://www.jarvana.com/jarvana/view/org/bushe/eventbus/1.3/eventbus-1.3-javadoc.jar!/org/bushe/swing/event/Prioritized.html)  
I think this is just what we need.

(Using this priority mechanism may also eliminate the need for the 
ObjectsUpdatedEvent that I added last week.)

EventBus version 1.4 is here: 
http://mvnrepository.com/artifact/org.bushe/eventbus/1.4

We will need to change the Events framework a bit to add Prioritized 
Event Subscription, but otherwise I don't think it will require any 
refactoring except for the subscribers that need to set priority.

-- Grant





More information about the ImageJ-devel mailing list