Auar / flexvizgraphlib

Automatically exported from code.google.com/p/flexvizgraphlib
0 stars 0 forks source link

Drag and Drop #30

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi Everyone,

First of all great job on the class and component, looks fantastic.

I would like to extend the component by allowing drag and drop on the 
Visual-Graph, thus the 
ability to select a node from either a list or data grid and drop it on the 
display area - And populate 
all underlying nodes. Any tips or advice, you guys, where I should start? - 
once I am done, I will 
post it if your interested.

James

Original issue reported on code.google.com by ja...@karboninteractive.com on 25 Apr 2008 at 1:23

GoogleCodeExporter commented 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