Hi Alexander,
Thank you for your response. You pointed me exactly to the API I
needed.
Thanks
cheers
Lionel
----- Mail original -----
De: "Alexander Pico" <
ap...@gladstone.ucsf.edu>
À: "Lionel" <
lionel....@gmail.com>
Envoyé: Vendredi 30 Mars 2012 04:31:43
Objet: Re: Catch event in Cytoscape
Hi Lionel,
There are some PropertyChangeEvents you can listen for. Like
Cytoscape.SESSION_CLOSED
http://chianti.ucsd.edu/Cyto-2_8_2/javadoc/cytoscape/Cytoscape.html#SESSION_CLOSED
However, if you want to catch the moment a new session if opened and
the current session is closing, I've found this approach effective:
if (prop.equals(Cytoscape.NETWORK_DESTROYED)) {
// listen for last network destroyed and check session state in
// order to determine if new session is being loaded... awkward!
if ((Cytoscape.getNetworkSet().size() <= 1) &&
(Cytoscape.getSessionstate() == Cytoscape.SESSION_OPENED)) {
//clean up stuff from old session
}
}
For "View closing", you might have to listen for NETWORK_MODIFIED and
then ask if Cytoscape.viewExists(network_id). Not sure. I haven't had
to do this one.
- Alex