diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java b/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java index c81b30b..d807cba 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java @@ -231,7 +231,7 @@ updateEdgeAttiributes(dataFlowGraph); // Set DAG layout. - setDAGLayout(); +// setDAGLayout(); curFilePath = file.getAbsolutePath(); curFileName = file.getName(); @@ -393,13 +393,16 @@ // create resource vertices for (ResourceNode resNode: dataFlowGraph.getRootResourceNodes()) { + int w = 300; + int h = 200; ResourcePath res = resNode.getOutSideResource(); Object resource = graph.insertVertex(parent, null, - res.getResourceName(), 20, 20, 80, 30, + res.getResourceName(), 20, 20, w, h, "shape=ellipse;perimeter=ellipsePerimeter"); // insert a resource as a vertex resources.put(res, resource); + getChildResource(resource, resNode, resources, w, h); } - + // add input, output and reference edges for (Edge edge: dataFlowGraph.getEdges()) { DataFlowEdge dfEdge = (DataFlowEdge) edge; @@ -426,12 +429,30 @@ } finally { graph.getModel().endUpdate(); } - setTreeLayout(); +// setTreeLayout(); bReflectingArchitectureModel = false; return graph; } + + public void getChildResource(Object resource, ResourceNode resNode, Map resources, int w, int h) { + + for (ResourceNode c: resNode.getChildren()) { + w = w - 100; + if(w <= 0) { + w = 100; + } + h = (2 * w) / 3; + ResourcePath chRes = c.getOutSideResource(); + Object chResource = graph.insertVertex(resource, null, + chRes.getName(), 110, 90, w, h, + "shape=ellipse;perimeter=ellipsePerimeter"); // insert a resource as a vertex + resources.put(chRes, chResource); + getChildResource(chResource, c, resources, w, h); + } + } + public void setDAGLayout() { Object parent = graph.getDefaultParent(); graph.getModel().beginUpdate();