Open GoogleCodeExporter opened 9 years ago
That might be tricky, because currently the library does not explicitly support
dynamic adding of nodes, most likely you would get crashes. You are free to
start
working on it though. Look at VisualGraph.createNode() and Graph.createNode()
which
is most likely what you need.
I would imagine it as follows:
- add event handler to your source component to associate all required data to
the
currently "dragged" object.
- add an event handler to VisualGraph for a drop even (MOUSE_UP), actually this
already exists, but you would need to modify it, so it can detect that you
were dragging something (i.e. an object with all data for a new node).
- then create the node from the "dragged" data in the graph and visualgraph
object.
- be aware that many UI related components (and not only those) rely on an XML
object
being associated with a node, that contains additional information about it.
So you might want to make sure to add one.
- Then you still have the problem to connect the node to other nodes so that it
becomes part of a connected graph (currently a requirement for all layouters),
before
you call the draw() method of VisualGraph.
Hope this helps,
Daniel
Original comment by spo...@gmail.com
on 18 May 2008 at 6:39
Original issue reported on code.google.com by
ja...@karboninteractive.com
on 25 Apr 2008 at 1:23