I'm playing with the sample mxGraph editor that comes with JGraph. I have a method which I'd like to be called every time a new node is created. Do you know how to do this?
I have a feeling it has something to do with mxGraphComponent, but I couldn't figure out how to do it.
Have a look at the API docs of the
mxGraph
class. It fires a number of granular events to specify what changes have occurred. You are most likely interested inmxEvent.CELLS_ADDED
. So add a listener with:where myHandler implements the
mxIEventListener
interface that requires the invoke method to be implemented (your method that gets called when the event is fired).