diff --git a/AlgebraicDataflowArchitectureModel/src/application/SimulatorWindow.java b/AlgebraicDataflowArchitectureModel/src/application/SimulatorWindow.java index 915eb6c..a8b4281 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/SimulatorWindow.java +++ b/AlgebraicDataflowArchitectureModel/src/application/SimulatorWindow.java @@ -12,6 +12,7 @@ import javax.swing.JFrame; +import application.editor.SimulationLayout; import com.mxgraph.model.mxCell; import com.mxgraph.model.mxGeometry; import com.mxgraph.model.mxGraphModel; @@ -129,22 +130,22 @@ DataTransferModel model = this.editor.getModel(); TypeInference.infer(model); simulator = new Simulator(model); - constructSimulateGraph(simulator.getCurState().getRootResources(), this.editor.getModel(),this.editor.getDataFlowGraph()); + SimulationLayout layout = new SimulationLayout(simulator.getCurState()); + layout.constructSimulateGraph(graph, simulator); graphComponent.setCellEditor(new InputEventCellEditor(graphComponent, simulator, this.editor, graph)); uiWindow = new UIWindow(simulator); } - - + public mxGraph constructSimulateGraph(Set simulateRes, DataTransferModel model, DataFlowGraph dataFlowGraph) { bReflectingArchitectureModel = true; ((mxGraphModel) graph.getModel()).clear(); Object parent = graph.getDefaultParent(); graph.getModel().beginUpdate(); - + try { Map resources = new HashMap<>(); - + // create resource vertices for (Resource resNode: simulateRes) { int w = 80; @@ -157,11 +158,11 @@ createChildSimulateResourceVerticies(resource, resNode, resources, w, h); x+=80; } - + } finally { graph.getModel().endUpdate(); } - + bReflectingArchitectureModel = false; return graph; }