diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java b/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java index 22c8ff0..db2fb6f 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java @@ -14,7 +14,6 @@ import com.mxgraph.view.mxGraph; import com.mxgraph.view.mxGraphView; import models.EdgeAttribute; -import models.algebra.Expression; import models.algebra.Symbol; import models.algebra.Variable; import models.dataConstraintModel.Channel; @@ -277,8 +276,10 @@ fileString.append("geometry {\n"); Object root = graph.getDefaultParent(); - for (int i = 0; i < graph.getModel().getChildCount(root); i++) { - Object cell = graph.getModel().getChildAt(root, i); + mxCell dataFlowLayer = (mxCell) ((mxCell) root).getChildAt(Stage.DATA_FLOW_LAYER); + + for (int i = 0; i < graph.getModel().getChildCount(dataFlowLayer); i++) { + Object cell = graph.getModel().getChildAt(dataFlowLayer, i); if (graph.getModel().isVertex(cell)) { mxGraphView view = graph.getView(); mxCellState state = view.getState(cell); @@ -287,14 +288,6 @@ int w = (int) state.getWidth(); int h = (int) state.getHeight(); - for (Channel ch : model.getChannels()) { - if (ch instanceof FormulaChannel && state.getLabel().equals(ch.getChannelName())) { - fileString.append("\tnode fc ").append(state.getLabel()).append(":").append(x).append(",").append(y).append(",").append(w).append(",").append(h).append("\n"); - } else if (ch != null && state.getLabel().equals(ch.getChannelName())) { - fileString.append("\tnode c ").append(state.getLabel()).append(":").append(x).append(",").append(y).append(",").append(w).append(",").append(h).append("\n"); - } - } - for (ResourcePath res : model.getResourcePaths()) { if (res != null && state.getLabel().equals(res.getLeafResourceName())) fileString.append("\tnode r ").append(state.getLabel()).append(":").append(x).append(",").append(y).append(",").append(w).append(",").append(h).append("\n"); @@ -305,6 +298,13 @@ fileString.append("\tnode ioc ").append(state.getLabel()).append(":").append(x).append(",").append(y).append(",").append(w).append(",").append(h).append("\n"); } } + for (Channel ch : model.getChannels()) { + if (ch instanceof FormulaChannel && state.getLabel().equals(ch.getChannelName())) { + fileString.append("\tnode fc ").append(state.getLabel()).append(":").append(x).append(",").append(y).append(",").append(w).append(",").append(h).append("\n"); + } else if (ch != null && state.getLabel().equals(ch.getChannelName())) { + fileString.append("\tnode c ").append(state.getLabel()).append(":").append(x).append(",").append(y).append(",").append(w).append(",").append(h).append("\n"); + } + } } } fileString.append("}\n"); @@ -313,11 +313,14 @@ public void setDAGLayout() { mxCell root = (mxCell) graph.getDefaultParent(); - + mxCell dataFlowLayer = (mxCell) root.getChildAt(Stage.DATA_FLOW_LAYER); graph.getModel().beginUpdate(); try { DAGLayout ctl = new DAGLayout(graph); - ctl.execute(root); + ctl.execute(dataFlowLayer); +// for(int i = 0; i < dataFlowLayer.getChildCount(); i++){ +// ctl.execute(dataFlowLayer.getChildAt(i)); +// } } finally { graph.getModel().endUpdate(); } @@ -325,7 +328,6 @@ public void setTreeLayout() { mxCell root = (mxCell) graph.getDefaultParent(); - graph.getModel().beginUpdate(); try { mxCompactTreeLayout ctl = new mxCompactTreeLayout(graph); @@ -342,7 +344,6 @@ public void setCircleLayout() { mxCell root = (mxCell) graph.getDefaultParent(); - graph.getModel().beginUpdate(); try { mxCircleLayout ctl = new mxCircleLayout(graph);