java - Groups break hierarchical layout in JGraphX -


i find if introduce groups in simple graph laid out hierarchical layout, group incorrectly positioned.

for example, here simple graph:

public class hierarchicallayoutwithgrouping extends jframe {      public hierarchicallayoutwithgrouping() {         super("hierarchical layout grouping test");          mxgraph graph = new mxgraph();         object parent = graph.getdefaultparent();          graph.getmodel().beginupdate();         try {             object transfer1 = graph.insertvertex(parent, null, "transfer data1.csv", 0, 0, 100, 40);             object transfer2 = graph.insertvertex(parent, null, "transfer data2.csv", 0, 0, 100, 40);             object load1 = graph.insertvertex(parent, null, "load data1.csv", 0, 0, 100, 40);             object load2 = graph.insertvertex(parent, null, "load data1.csv", 0, 0, 100, 40);             graph.insertedge(parent, null, null, transfer1, load1);             graph.insertedge(parent, null, null, transfer2, load2);             object calculate = graph.insertvertex(parent, null, "calculate", 0, 0, 100, 40);             graph.insertedge(parent, null, null, load1, calculate);             graph.insertedge(parent, null, null, load2, calculate);              // object loads = graph.insertvertex(parent, null, "loads", 0, 0, 200, 400, "shape=swimlane;");             // graph.groupcells(loads, 5, new object[] { load1, load2 });              mxhierarchicallayout layout = new mxhierarchicallayout(graph, swingconstants.west);             layout.execute(parent);          } {             graph.getmodel().endupdate();         }          mxgraphcomponent graphcomponent = new mxgraphcomponent(graph);         getcontentpane().add(graphcomponent);     }      public static void main(string[] args) {         hierarchicallayoutwithgrouping frame = new hierarchicallayoutwithgrouping();         frame.setdefaultcloseoperation(jframe.exit_on_close);         frame.setsize(600, 450);         frame.setvisible(true);     } } 

yields beautiful graph:

enter image description here

but if uncomment following lines:

            object loads = graph.insertvertex(parent, null, "loads", 0, 0, 200, 400, "shape=swimlane;");             graph.groupcells(loads, 5, new object[] { load1, load2 }); 

i this:

enter image description here

i've tried various options on mxhierarchicallayout haven't found works yet. how layout group on correct position?

thanks.

i found out, grouping box gets hierarchy nodes ungrouped. reason why each of group boxes moved new row. think there's no other possibility writing own layout algorithm or override method generates hierarchy attributes during layout execution.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -