public interface CyListener
Any class implementing this interface must implement the method:
public void handleEvent(ZZZ e);
where ZZZ extends CyEvent.
Unfortunately, we can't parameterize this because Java doesn't verify generic types, meaning a class could only implement ONE instance of this interface, something that doesn't work for us. And so we leave it to convention.
Instead of the customary strategy of registering events with the objects that fire the events, listeners should register themselves as services with the OSGi ServiceRegistry. The event producers will simply query the ServiceRegistry to search for Listeners for the type of events they fire.
It would be fantastic if we could specify one listener interface that differentiated itself by a parameterized type, but that doesn't appear possible with Java. That means users are either must register as different listeners or handle different event types in the handleEvent method.
Module: event-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>event-api</artifactId> </dependency>
Copyright 2011-2015 Cytoscape Consortium. All rights reserved.