java - JGraphX Moving cells and keeping edges -


i try move graph in jgraphx. first try use setgeometry, moves entire coordinate system , origin. no option me, because bit tricky when moving several graphs.

my second try with

object[] ver = graph.getchildvertices(graph.getdefaultparent()); graph.movecells(ver, 100, 100, false); 

moves cells. far good, edges start , end points change positions.

after moving cells:

after

before moving cells, edges have correct position.

before

so how can set position of edges normal start , endpoints? alternatively, appreciate other approach move cells given position.

edit: seems behaviour occurs, if add layout before. without layout, moving cells works expected.

mxgraph graph = new mxgraph();     object parent = graph.getdefaultparent();      graph.getmodel().beginupdate();     try     {         object v1 = graph.insertvertex(parent, null, "hello", 20, 20, 80,                 30);         object v2 = graph.insertvertex(parent, null, "world!", 240, 150,                 80, 30);         graph.insertedge(parent, null, "edge", v1, v2);       }         {         graph.getmodel().endupdate();     }     new mxhierarchicallayout(graph).execute(graph.getdefaultparent());     graph.getmodel().beginupdate();     try     {         object[] ver = graph.getchildvertices(graph.getdefaultparent());         graph.movecells(ver, 100, 100, false);     }         {         graph.getmodel().endupdate();     }     mxgraphcomponent graphcomponent = new mxgraphcomponent(graph);     getcontentpane().add(graphcomponent); 

i read through api documents of jgraphx anf found interesting property xgraph class:

mxgraph.prototype.resetedgesonmove:

specifies if edge control points should reset after move of connected cell. default false.

i try toggle , see if may or not in situation. @ least affects edges behavior in moving condition.


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -