diff --git a/AlgebraicDataflowArchitectureModel/src/application/simulator/InputEventCellEditor.java b/AlgebraicDataflowArchitectureModel/src/application/simulator/InputEventCellEditor.java index 10e5565..8d219c5 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/simulator/InputEventCellEditor.java +++ b/AlgebraicDataflowArchitectureModel/src/application/simulator/InputEventCellEditor.java @@ -82,13 +82,11 @@ private JComboBox pulldownMenu; private Editor editor; private boolean bReflectingArchitectureModel = false; - private mxGraph graph; - public InputEventCellEditor(mxGraphComponent graphComponent, Simulator simulator, Editor editor, mxGraph graph) { + public InputEventCellEditor(mxGraphComponent graphComponent, Simulator simulator, Editor editor) { this.graphComponent = graphComponent; this.simulator = simulator; this.editor = editor; - this.graph = graph; } @Override @@ -170,10 +168,10 @@ Event newEvent = new Event(eventChs.get(eventNum), eventMessage, eventResPath, simulator.getCurState().getResource(resId)); simulator.transition(newEvent); - SimulationLayout layout = new SimulationLayout(simulator.getCurState()); - layout.constructSimulateGraph(graph, simulator); +// SimulationLayout layout = new SimulationLayout(simulator.getCurState()); +// layout.constructSimulateGraph(graph, simulator); - graphComponent.setCellEditor(new InputEventCellEditor(graphComponent, simulator, this.editor, graph)); + graphComponent.setCellEditor(new InputEventCellEditor(graphComponent, simulator, this.editor)); } catch (ParameterizedIdentifierIsFutureWork | ResolvingMultipleDefinitionIsFutureWork | InvalidMessage | UnificationFailed | ValueUndefined | ExpectedRightBracket | WrongJsonExpression | ExpectedColon e) { @@ -205,56 +203,56 @@ } } - private mxGraph constructNextSimulateGraph(Set simulateRes, DataTransferModel model,DataFlowGraph dataFlowGraph, mxGraph nextGraph) { - bReflectingArchitectureModel = true; - ((mxGraphModel) nextGraph.getModel()).clear(); - Object parent = nextGraph.getDefaultParent(); - nextGraph.getModel().beginUpdate(); - - try { - Map resources = new HashMap<>(); - - // create resource vertices - for (Resource resNode: simulateRes) { - int w = 400; - int h = 150; - ResourcePath res = resNode.getResourceIdentifier(); - Object resource = nextGraph.insertVertex(parent, null, - res.toString(), x, y, w, h, - "shape=ellipse;perimeter=ellipsePerimeter;verticalAlign=top;"); // insert a resource as a vertex - resources.put(resNode, resource); - - createNextChildSimulateResourceVerticies(resource, resNode, resources, w, h); - x+=400; - } - - } finally { - nextGraph.getModel().endUpdate(); - } - - bReflectingArchitectureModel = false; - return nextGraph; - } - - private void createNextChildSimulateResourceVerticies(Object resource, Resource resNode, Map resources, int w, int h) { //sample - - if(resNode.getChildren() != null) { - for (Resource childNode: resNode.getChildren()) { - int i = 1; - ResourcePath childRes = childNode.getResourceIdentifier(); - Object childResource = graph.insertVertex(resource, null, - childRes.toString(), x/i, 0, w/(i+1), h/(i+2), - "shape=ellipse;perimeter=ellipsePerimeter;verticalAlign=top;"); // insert a resource as a vertex - resources.put(childNode, childResource); - i++; - createNextChildSimulateResourceVerticies(childResource, childNode, resources, w, h); - } - } - if (resNode.getChildren() == null || resNode.getChildren().size() == 0) { - Object state = graph.insertVertex(resource, 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 - } - } +// private mxGraph constructNextSimulateGraph(Set simulateRes, DataTransferModel model,DataFlowGraph dataFlowGraph, mxGraph nextGraph) { +// bReflectingArchitectureModel = true; +// ((mxGraphModel) nextGraph.getModel()).clear(); +// Object parent = nextGraph.getDefaultParent(); +// nextGraph.getModel().beginUpdate(); +// +// try { +// Map resources = new HashMap<>(); +// +// // create resource vertices +// for (Resource resNode: simulateRes) { +// int w = 400; +// int h = 150; +// ResourcePath res = resNode.getResourceIdentifier(); +// Object resource = nextGraph.insertVertex(parent, null, +// res.toString(), x, y, w, h, +// "shape=ellipse;perimeter=ellipsePerimeter;verticalAlign=top;"); // insert a resource as a vertex +// resources.put(resNode, resource); +// +// createNextChildSimulateResourceVerticies(resource, resNode, resources, w, h); +// x+=400; +// } +// +// } finally { +// nextGraph.getModel().endUpdate(); +// } +// +// bReflectingArchitectureModel = false; +// return nextGraph; +// } +// +// private void createNextChildSimulateResourceVerticies(Object resource, Resource resNode, Map resources, int w, int h) { //sample +// +// if(resNode.getChildren() != null) { +// for (Resource childNode: resNode.getChildren()) { +// int i = 1; +// ResourcePath childRes = childNode.getResourceIdentifier(); +// Object childResource = graph.insertVertex(resource, null, +// childRes.toString(), x/i, 0, w/(i+1), h/(i+2), +// "shape=ellipse;perimeter=ellipsePerimeter;verticalAlign=top;"); // insert a resource as a vertex +// resources.put(childNode, childResource); +// i++; +// createNextChildSimulateResourceVerticies(childResource, childNode, resources, w, h); +// } +// } +// if (resNode.getChildren() == null || resNode.getChildren().size() == 0) { +// Object state = graph.insertVertex(resource, 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 +// } +// } @Override public void stopEditing(boolean cancel) {