diff --git a/AlgebraicDataflowArchitectureModel/src/application/SimulatorWindow.java b/AlgebraicDataflowArchitectureModel/src/application/SimulatorWindow.java index 0d2add1..0208b49 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/SimulatorWindow.java +++ b/AlgebraicDataflowArchitectureModel/src/application/SimulatorWindow.java @@ -132,25 +132,7 @@ graphComponent.setCellEditor(new InputEventCellEditor(graphComponent, simulator, this.editor, graph)); } - private void createNextChildSimulateResourceVerticies(Object parent, Resource resNode, Map resources, SimulationLayout layout) { //sample - List children = resNode.getChildren(); - if(children != null) { - //List children = resNode.getChildren(); - double i = 1; - double childCount = children.size(); - for (Resource childNode: children) { - Object childResource = layout.setLayout(graph, parent, childNode.getResourceIdentifier(), i, childCount); - resources.put(childNode, childResource); - i++; - createNextChildSimulateResourceVerticies(childResource, childNode, resources,layout); - } - } - if (children == null || children.size() == 0) { - Object state = graph.insertVertex(parent, null, - resNode.getState().getValue().toString(), 0.5, 0.5, 0.25, 0.25, "opacity=0;verticalAlign=down;", true); // insert a state label as a vertex - } - } public mxGraph constructSimulateGraph(Set simulateRes, DataTransferModel model, DataFlowGraph dataFlowGraph) { bReflectingArchitectureModel = true; ((mxGraphModel) graph.getModel()).clear(); diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/SimulationLayout.java b/AlgebraicDataflowArchitectureModel/src/application/editor/SimulationLayout.java index d84c6a1..c516da1 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/editor/SimulationLayout.java +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/SimulationLayout.java @@ -66,7 +66,17 @@ } } } - public Object setLayout(mxGraph graph,Object parent, ResourceIdentifier resourceIdentifier,double index, double length){ + + /** + * 対象リソースに対応するオブジェクトをmxGraphに描画する + * @param graph 描画の土台となるmxGraph + * @param parent 対象リソースの親オブジェクト + * @param resourceIdentifier 対象リソースのID + * @param index インデックス + * @param length 対象リソースの兄弟数 + * @return 対象リソースの描画オブジェクト + */ + private Object setLayout(mxGraph graph,Object parent, ResourceIdentifier resourceIdentifier,double index, double length){ double width, height, x, y; double parentWidth = graph.getCellGeometry(parent).getWidth(); double parentHeight = graph.getCellGeometry(parent).getHeight(); @@ -75,8 +85,10 @@ height = width/2; x = parentWidth * (index - 1)/length + (parentWidth/length)*(1-MARGIN_SCALE)/2; + //親のリソース名を隠してしまわないための処理 if((int)length==1){ y = 20; + height -=20; }else{ y = parentHeight/2 - height/2; }