How to respond to nodes/edges being created/destroyed/modified?

28 views
Skip to first unread message

dyzzy

unread,
Jun 30, 2008, 11:17:06 AM6/30/08
to cytoscape-discuss
I'm writing a plugin for Cytoscape and I want it to automatically
update itself whenever a node or edge is changed in some way, like
when a new node is created or when some attribute for a node is
changed. However, I don't know how to do so since I can't figure out
what to listen for. I just made my plugin print out any property
changes that occur, and I don't get anything happening whenever I
create a new node or change an attribute. I do get NETWORK_MODIFIED if
I delete a node, or when I undo that action, but it doesn't occur if I
create a node.

Does anyone know how to listen for these changes?

Mike Smoot

unread,
Jul 2, 2008, 2:08:31 AM7/2/08
to cytoscap...@googlegroups.com
Yes, you can listen to everything that you want to, but you're going to need to listen for several types of events coming from a few different places.  To hear changes made to the network you'll want to listen to PropertyChange events from Cytoscape and possibly CytoscapeDesktop.  If you're interested in node and edge creation, you'll need to listen to GraphPerspectiveChangeEvents and RootGraphChangeEvents from CyNetwork and the RootGraph.  Finally, to hear changes to attributes, you'll need implement MultiHashMapListener.  Its ridiculous really, but how 2.6 works.  We'll be reworking everything for 3.0 to be *much* easier.


Mike
--
____________________________________________________________
Michael Smoot, Ph.D. Bioengineering Department
tel: 858-822-4756 University of California San Diego

dyzzy

unread,
Jul 7, 2008, 9:34:01 AM7/7/08
to cytoscape-discuss
Thanks, I think what I want are GraphPerspectiveChangeEvents and
RootGraphChangeEvents. Can you be a bit more specific on how to listen
to them? I can't find anything about these in the Cytoscape API.

john cole

unread,
May 1, 2012, 12:22:58 PM5/1/12
to cytoscap...@googlegroups.com
Greetings.

I should preface by saying that I am a novice with a lot of this stuff, but I also am having difficulty implementing a listener to changes in the RootGraph.  Can someone point me towards some example code that detects a node or edge being added and responds somehow? I am not sure where i should register the listener, or how to instantiate it correctly, any help in this would be greatly appreciated.

John
Reply all
Reply to author
Forward
0 new messages