// Define a class, which implements a listener interface
public class MyListenerClass implements NetworkAddedListener {
....
public void handleEvent(NetworkAddedEvent e){
// do something here
}
}
and// Register the listener in the CyActivator class
registerService(bc,myListenerClass, NetworkAddedListener.class, new Properties());
However, I have a custom object I would like to update when a network is added. How do I do that if my listener class has to be instantiated inside my CyActivator class..?In other words, is there a way to register a listener class outside the CyActivator class?
Thanks,
Omar --
You received this message because you are subscribed to the Google Groups "cytoscape-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/cytoscape-discuss/-/GktsG6btVRAJ.
To post to this group, send email to cytoscap...@googlegroups.com.
To unsubscribe from this group, send email to cytoscape-disc...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cytoscape-discuss?hl=en.
MyClass myObject = new MyClass();
MyListenerClass listener = new MyListenerClass(myObject);
registerService(bc, listener, NetworkAddedListener.class, new Properties());
I tried Jason's suggestion
1) Set CyServiceRegistrar reference in CyActivator class
//Service regisrar
public static CyServiceRegistrar serviceRegistrar;
However, when for example a view is created, the handleEvent method for the NetworkViewAddedListener is called more than onceI am positive I am adding the network view only once..Is there something I am missing?