| |
---|
| | import java.awt.event.ActionListener; |
---|
| | import java.awt.geom.Dimension2D; |
---|
| | import java.awt.geom.Path2D; |
---|
| | import java.awt.geom.Point2D; |
---|
| | import java.awt.geom.Point2D.Double; |
---|
| | import java.util.AbstractMap; |
---|
| | import java.util.ArrayList; |
---|
| | import java.util.Collections; |
---|
| | import java.util.HashMap; |
---|
| |
---|
| | for (int i = fromFrame; i <= toFrame; i++) { |
---|
| | List<Alias> aliasList = new ArrayList<>(aliasCollector.getAliasList()); |
---|
| | Alias alias = aliasList.get(i); |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println("\r\n" + i + ": " + alias.getAliasType().toString()); |
---|
| | System.out.println(alias.getObjectId() + ", " + alias.getMethodSignature() + " l." + alias.getLineNo()); |
---|
| | System.out.println("\r\n" + TAG + ": Frame=" + i + ", aliasType=" + alias.getAliasType().toString() + ", objectId=" + alias.getObjectId() + ", methodSignature=" + alias.getMethodSignature() + ", l." + alias.getLineNo()); |
---|
| | switch(alias.getAliasType()) { |
---|
| | case RETURN_VALUE: |
---|
| | moveObjectVertex(alias); |
---|
| | update(); |
---|
| |
---|
| | default: |
---|
| | break; |
---|
| | } |
---|
| | curFrame = i + 1; |
---|
| | // Test code (will be deleted) |
---|
| | outputLog(); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | /** |
---|
| |
---|
| | } finally { |
---|
| | mxgraph.getModel().endUpdate(); |
---|
| | } |
---|
| | } |
---|
| | // deltaAnimation.setVertexAnimation(ovCell, new mxPoint(objectVertex.getInitialX(), objectVertex.getInitialY())); |
---|
| | // deltaAnimation.startVertexAnimation(); |
---|
| | // deltaAnimation.sleepThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | MagnetRONAnimation vertexAnim = new TranslateAnimation(mxgraph, getGraphComponent()); |
---|
| | vertexAnim.setTotalCycleCount(10); |
---|
| | vertexAnim.setDelay(100); |
---|
| | vertexAnim.init(ovCell, objectVertex.getX(), objectVertex.getY(), threadPoolExecutor); |
---|
| | // vertexAnim.play(); |
---|
| | // sleepMainThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | vertexAnim.syncPlay(); |
---|
| | } |
---|
| | |
---|
| | /** |
---|
| |
---|
| | } finally { |
---|
| | mxgraph.getModel().endUpdate(); |
---|
| | } |
---|
| | } |
---|
| | // deltaAnimation.setVertexAnimation(ovCell, new mxPoint(objectVertex.getInitialX(), objectVertex.getInitialY())); |
---|
| | // deltaAnimation.startVertexAnimation(); |
---|
| | // deltaAnimation.sleepThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | MagnetRONAnimation vertexAnim = new TranslateAnimation(mxgraph, getGraphComponent()); |
---|
| | vertexAnim.setTotalCycleCount(10); |
---|
| | vertexAnim.setDelay(100); |
---|
| | vertexAnim.init(ovCell, objectVertex.getInitialX(), objectVertex.getInitialY(), threadPoolExecutor); |
---|
| | // vertexAnim.play(); |
---|
| | // sleepMainThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | vertexAnim.syncPlay(); |
---|
| | } |
---|
| | |
---|
| | /** |
---|
| |
---|
| | |
---|
| | mxgraph.getModel().beginUpdate(); |
---|
| | synchronized (mxgraph.getModel()) { |
---|
| | try { |
---|
| | // dstCell.getParent().remove(dstCell); |
---|
| | // dstCell.setParent(mxDefaultParent); |
---|
| | if (!dstCell.getParent().equals(getMxDefaultParent())) { |
---|
| | // If parent of ObjectVertex cell isn't mxDefaltParent, reset parent. |
---|
| | dstCell.getParent().remove(dstCell); |
---|
| | dstCell.setParent(getMxDefaultParent()); |
---|
| |
---|
| | mxICell edge = |
---|
| | (mxICell) mxgraph.insertDeltaEdge(getMxDefaultParent(), fieldUpdateStatement.getFieldName(), fieldName, |
---|
| | objectToVertexMap.get(srcObjId).getCell(), objectToVertexMap.get(dstObjId).getCell()); |
---|
| | edge.setStyle("strokeColor=red;"); |
---|
| | // mxgraph.orderCells(true, new Object[] {edge}); |
---|
| | // mxgraph.orderCells(true, new Object[] {edge}); |
---|
| | edgeMap.put(fieldUpdateStatement.getFieldName(), new Edge(fieldName, TypeName.Reference, edge)); |
---|
| | } finally { |
---|
| | mxgraph.getModel().endUpdate(); |
---|
| | } |
---|
| | } |
---|
| | // deltaAnimation.setVertexAnimation(dstCell, new mxPoint(objectToVertexMap.get(dstObjId).getInitialX(), objectToVertexMap.get(dstObjId).getInitialY())); |
---|
| | // deltaAnimation.startVertexAnimation(); |
---|
| | // deltaAnimation.sleepThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | MagnetRONAnimation vertexAnim = new TranslateAnimation(mxgraph, getGraphComponent()); |
---|
| | vertexAnim.setTotalCycleCount(10); |
---|
| | vertexAnim.setDelay(100); |
---|
| | vertexAnim.init(dstCell, dstObjVertex.getInitialX(), dstObjVertex.getInitialY(), threadPoolExecutor); |
---|
| | // vertexAnim.play(); |
---|
| | // sleepMainThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | vertexAnim.syncPlay(); |
---|
| | mxgraph.getModel().beginUpdate(); |
---|
| | synchronized (mxgraph.getModel()) { |
---|
| | try { |
---|
| |
---|
| | // Add a vertex to the graph in a transactional fashion. The vertex is actually a 'cell' in jgraphx terminology. |
---|
| | mxgraph.getModel().beginUpdate(); |
---|
| | synchronized (mxgraph.getModel()) { |
---|
| | try { |
---|
| | // dstCell.getParent().remove(dstCell); |
---|
| | // dstCell.setParent(mxDefaultParent); |
---|
| | if (!dstCell.getParent().equals(getMxDefaultParent())) { |
---|
| | // If parent of ObjectVertex cell isn't mxDefaltParent, reset parent. |
---|
| | dstCell.getParent().remove(dstCell); |
---|
| | dstCell.setParent(getMxDefaultParent()); |
---|
| |
---|
| | } finally { |
---|
| | mxgraph.getModel().endUpdate(); |
---|
| | } |
---|
| | } |
---|
| | // deltaAnimation.setVertexAnimation(dstCell, new mxPoint(objectToVertexMap.get(destinationObjectId).getInitialX(), objectToVertexMap.get(destinationObjectId).getInitialY())); |
---|
| | // deltaAnimation.startVertexAnimation(); |
---|
| | // deltaAnimation.sleepThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | MagnetRONAnimation vertexAnim = new TranslateAnimation(mxgraph, getGraphComponent()); |
---|
| | vertexAnim.setTotalCycleCount(10); |
---|
| | vertexAnim.setDelay(100); |
---|
| | vertexAnim.init(dstCell, dstObjVertex.getInitialX(), dstObjVertex.getInitialY(), threadPoolExecutor); |
---|
| | // vertexAnim.play(); |
---|
| | // sleepMainThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | vertexAnim.syncPlay(); |
---|
| | // Add a vertex to the graph in a transactional fashion. The vertex is actually a 'cell' in jgraphx terminology. |
---|
| | mxgraph.getModel().beginUpdate(); |
---|
| | synchronized (mxgraph.getModel()) { |
---|
| | try { |
---|
| | dstCell.getGeometry().setX(dstObjVertex.getInitialX()); |
---|
| | dstCell.getGeometry().setY(dstObjVertex.getInitialY()); |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println("rTHIS " + sourceClassName + ", " + destinationObjectId); |
---|
| | } finally { |
---|
| | mxgraph.getModel().endUpdate(); |
---|
| | } |
---|
| | } |
---|
| |
---|
| | sleepMainThread(POSTPONE_ANIMATION_MILLIS); |
---|
| | } |
---|
| | // destination {@code ObjectVertex} |
---|
| | MethodExecutionVertex dstMethodExecVertex = methodExecToVertexMap.get(alias.getMethodExecution()); |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println("moveObjectVertex: " + dstMethodExecVertex); |
---|
| | System.out.println("moveObjectVertex: " + alias.getMethodExecution().isStatic()); |
---|
| | moveObjectVertex(alias, srcObjVertex, dstMethodExecVertex); |
---|
| | updateObjectVertices(); |
---|
| | } |
---|
| | |
---|
| |
---|
| | createObjectVertexOnConstractorByFormalParameter(alias); |
---|
| | } |
---|
| | } |
---|
| | if (alias.getAliasType().equals(AliasType.RETURN_VALUE)) { |
---|
| | // sleepMainThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | MagnetRONAnimation.waitAnimationEnd(); |
---|
| | } |
---|
| | moveLocalObjectVertex(methodExec, sourceObjectVertex, destinationMethodExecutionVertex); |
---|
| | } else if (alias.getAliasType().equals(AliasType.FORMAL_PARAMETER)) { |
---|
| |
---|
| | private void moveLocalObjectVertex(MethodExecution callerMethodExecution, ObjectVertex sourceObjectVertex, MethodExecutionVertex destinationMethodExecutionVertex) { |
---|
| | mxICell srcCell = (mxICell)sourceObjectVertex.getCell(); |
---|
| | mxICell dstCell = (mxICell) destinationMethodExecutionVertex.getCell(); |
---|
| | |
---|
| | // if (srcCell == dstCell.getParent()) { |
---|
| | if (srcCell.equals(dstCell.getParent())) { |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println("Nothing to moveLocalObjectVertex()."); |
---|
| | return; |
---|
| | } |
---|
| | |
---|
| | // Remove sourceObjectVertex from Locals and Arguments of MethodExecution's Vertex. |
---|
| | if (methodExecToVertexMap.containsKey(callerMethodExecution) && methodExecToVertexMap.get(callerMethodExecution).getLocals().contains(sourceObjectVertex)) { |
---|
| | methodExecToVertexMap.get(callerMethodExecution).getLocals().remove(sourceObjectVertex); |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println(methodExecToVertexMap.get(callerMethodExecution).getLabel() + " :removeLocal: " + sourceObjectVertex.getLabel()); |
---|
| | } |
---|
| | |
---|
| | if (methodExecToVertexMap.containsKey(callerMethodExecution) && methodExecToVertexMap.get(callerMethodExecution).getArguments().contains(sourceObjectVertex)) { |
---|
| | methodExecToVertexMap.get(callerMethodExecution).getArguments().remove(sourceObjectVertex); |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println(methodExecToVertexMap.get(callerMethodExecution).getLabel() + " :removeArgument: " + sourceObjectVertex.getLabel()); |
---|
| | } |
---|
| | |
---|
| | int time = destinationMethodExecutionVertex.getLocals().size(); |
---|
| | |
---|
| |
---|
| | srcCell.getParent().remove(srcCell); |
---|
| | } |
---|
| | |
---|
| | mxgraph.orderCells(true, new Object[] {srcCell}); |
---|
| | // srcCell.setParent(dstCell.getParent()); |
---|
| | // dstCell.getParent().insert(srcCell); |
---|
| | if (srcCell.getParent() == null || !srcCell.getParent().equals(dstCell.getParent())) { |
---|
| | // TODO: Confirm why not need following comment out. |
---|
| | // if (srcCell.getParent() != null) srcCell.getParent().remove(srcCell); |
---|
| | srcCell.setParent(dstCell.getParent()); |
---|
| | dstCell.getParent().insert(srcCell); |
---|
| | } |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println("moveLocalObjectVertex: " + srcCell.getId() + " (" + srcCell.hashCode() + ")" + ", " + srcCell.getParent().getId() + " (" + srcCell.getParent().hashCode() + ")"); |
---|
| | System.out.println(" " + dstCell.getId() + " (" + dstCell.hashCode() + ")" + ", " + dstCell.getParent().getId() + " (" + dstCell.getParent().hashCode() + ")"); |
---|
| | |
---|
| | Point2D dstCellAbsPt = getAbsolutePointforCell(srcCell.getParent()); |
---|
| | srcCell.getGeometry().setX(srcCellCoordX - dstCellAbsPt.getX()); |
---|
| | srcCell.getGeometry().setY(srcCellCoordY - dstCellAbsPt.getY()); |
---|
| |
---|
| | |
---|
| | double srcCellWidth = srcCell.getGeometry().getWidth(); |
---|
| | double dstCellHeight = dstCell.getGeometry().getHeight(); |
---|
| | |
---|
| | // deltaAnimation.setVertexAnimation(srcCell, new mxPoint(dstCell.getGeometry().getX() - (srcCellWidth / Math.sqrt(2.5)) + (srcCellWidth * time), dstCell.getGeometry().getY() + dstCellHeight)); |
---|
| | // deltaAnimation.startVertexAnimation(); |
---|
| | // deltaAnimation.sleepThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | MagnetRONAnimation vertexAnim = new TranslateAnimation(mxgraph, getGraphComponent()); |
---|
| | vertexAnim.setTotalCycleCount(10); |
---|
| | vertexAnim.setDelay(100); |
---|
| | vertexAnim.init(srcCell, |
---|
| | dstCell.getGeometry().getX() - (srcCellWidth / Math.sqrt(2.5)) + (srcCellWidth * time), dstCell.getGeometry().getY() + dstCellHeight, |
---|
| | threadPoolExecutor); |
---|
| | // vertexAnim.play(); |
---|
| | // sleepMainThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | vertexAnim.syncPlay(); |
---|
| | |
---|
| | // Add a vertex to the graph in a transactional fashion. The vertex is actually a 'cell' in jgraphx terminology. |
---|
| | mxgraph.getModel().beginUpdate(); |
---|
| | synchronized (mxgraph.getModel()) { |
---|
| | try { |
---|
| | // srcCell.setParent(dstCell.getParent()); |
---|
| | // dstCell.getParent().insert(srcCell); |
---|
| | if (!srcCell.getParent().equals(dstCell.getParent())) { |
---|
| | // TODO: Confirm why not need following comment out. |
---|
| | srcCell.getParent().remove(srcCell); |
---|
| | srcCell.setParent(dstCell.getParent()); |
---|
| | dstCell.getParent().insert(srcCell); |
---|
| | } |
---|
| | srcCell.getGeometry().setX(dstCell.getGeometry().getX() - (srcCellWidth / Math.sqrt(2.5)) + (srcCellWidth * time)); |
---|
| | srcCell.getGeometry().setY(dstCell.getGeometry().getY() + dstCellHeight); |
---|
| | destinationMethodExecutionVertex.getLocals().add(sourceObjectVertex); |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println("moveLocalObjectVertex: " + destinationMethodExecutionVertex.getLabel() + " :Local: " + sourceObjectVertex.getLabel()); |
---|
| | } finally { |
---|
| | mxgraph.getModel().endUpdate(); |
---|
| | } |
---|
| | } |
---|
| |
---|
| | // Remove source {@code VertexObject} from Locals and Arguments of {@code MethodExecution}'s Vertex. |
---|
| | MethodExecution callerMethodExec = methodExecution.getCallerMethodExecution(); |
---|
| | if (methodExecToVertexMap.containsKey(callerMethodExec) && methodExecToVertexMap.get(callerMethodExec).getLocals().contains(sourceObjectVertex)) { |
---|
| | methodExecToVertexMap.get(callerMethodExec).getLocals().remove(sourceObjectVertex); |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println(methodExecToVertexMap.get(callerMethodExec).getLabel() + " :removeLocal: " + sourceObjectVertex.getLabel()); |
---|
| | } |
---|
| | |
---|
| | if (methodExecToVertexMap.containsKey(callerMethodExec) && methodExecToVertexMap.get(callerMethodExec).getArguments().contains(sourceObjectVertex)) { |
---|
| | methodExecToVertexMap.get(callerMethodExec).getArguments().remove(sourceObjectVertex); |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println(methodExecToVertexMap.get(callerMethodExec).getLabel() + " :removeArgument: " + sourceObjectVertex.getLabel()); |
---|
| | } |
---|
| | |
---|
| | int time = destinationMethodExecutionVertex.getArguments().size(); |
---|
| | double srcCoordX = srcCell.getGeometry().getX(); |
---|
| |
---|
| | mxgraph.getModel().beginUpdate(); |
---|
| | synchronized (mxgraph.getModel()) { |
---|
| | try { |
---|
| | mxgraph.orderCells(true, new Object[] {srcCell}); |
---|
| | // srcCell.setParent(dstCell.getParent()); |
---|
| | // dstCell.getParent().insert(srcCell); |
---|
| | if (srcCell.getParent() == null || !srcCell.getParent().equals(dstCell.getParent())) { |
---|
| | // TODO: Confirm why not need following comment out. |
---|
| | // if (srcCell.getParent() != null) srcCell.getParent().remove(srcCell); |
---|
| | srcCell.setParent(dstCell.getParent()); |
---|
| |
---|
| | double srcCellHeight = srcCell.getGeometry().getHeight(); |
---|
| | double overlapWidth = srcCellWidth - (srcCellWidth * Math.sqrt(2) * 0.1); |
---|
| | double overlapHeight = srcCellHeight - (srcCellHeight * Math.sqrt(2) * 0.1); |
---|
| | |
---|
| | // deltaAnimation.setVertexAnimation(srcCell, new mxPoint(dstCell.getGeometry().getX() - overlapWidth, dstCell.getGeometry().getY() - overlapHeight + (srcCellHeight * time))); |
---|
| | // deltaAnimation.startVertexAnimation(); |
---|
| | // deltaAnimation.sleepThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | MagnetRONAnimation vertexAnim = new TranslateAnimation(mxgraph, getGraphComponent()); |
---|
| | vertexAnim.setTotalCycleCount(10); |
---|
| | vertexAnim.setDelay(100); |
---|
| | vertexAnim.init(srcCell, |
---|
| | dstCell.getGeometry().getX() - overlapWidth, dstCell.getGeometry().getY() - overlapHeight + (srcCellHeight * time), |
---|
| | threadPoolExecutor); |
---|
| | // vertexAnim.play(); |
---|
| | // sleepMainThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | sleepMainThread(POSTPONE_ANIMATION_MILLIS); |
---|
| | vertexAnim.syncPlay(); |
---|
| | |
---|
| | // Add a vertex to the graph in a transactional fashion. The vertex is actually a 'cell' in jgraphx terminology. |
---|
| |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | destinationMethodExecutionVertex.getArguments().add(sourceObjectVertex); |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println("moveArgumentObejctVertex" + destinationMethodExecutionVertex.getLabel() + " :Argument: " + sourceObjectVertex.getLabel()); |
---|
| | } else { // TODO: 仕様上のバグ、ループが発生 |
---|
| | // Test code (will be deleted) |
---|
| | outputLog(); |
---|
| | |
---|
| | // 元の ObjectVertex |
---|
| | Point2D srcCellAbsPt = getAbsolutePointforCell(srcCell); |
---|
| | Point2D dstParentCellAbsPt = getAbsolutePointforCell(dstCell.getParent()); |
---|
| | |
---|
| | // Add a vertex to the graph in a transactional fashion. The vertex is actually a 'cell' in jgraphx terminology. |
---|
| | mxgraph.getModel().beginUpdate(); |
---|
| | synchronized (mxgraph.getModel()) { |
---|
| | try { |
---|
| | // srcCell.remove(dstCell.getParent()); |
---|
| | // dstCell.getParent().setParent(mxDefaultParent); |
---|
| | // srcCell.setParent(dstCell.getParent()); |
---|
| | // dstCell.getParent().insert(srcCell); |
---|
| | if (dstCell.getParent() != null |
---|
| | || dstCell.getParent().getParent() != null |
---|
| | || srcCell.getParent() != null |
---|
| | || !dstCell.getParent().getParent().equals(getMxDefaultParent()) |
---|
| |
---|
| | double srcCellHeight = srcCell.getGeometry().getHeight(); |
---|
| | double overlapWidth = srcCellWidth - (srcCellWidth * Math.sqrt(2) * 0.1); |
---|
| | double overlapHeight = srcCellHeight - (srcCellHeight * Math.sqrt(2) * 0.1); |
---|
| | |
---|
| | // deltaAnimation.setVertexAnimation(srcCell, new mxPoint(dstCell.getGeometry().getX() - overlapWidth + (srcCellWidth * time), dstCell.getGeometry().getY() - overlapHeight + (srcCellHeight * time))); |
---|
| | // deltaAnimation.startVertexAnimation(); |
---|
| | // deltaAnimation.sleepThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | MagnetRONAnimation vertexAnim = new TranslateAnimation(mxgraph, getGraphComponent()); |
---|
| | vertexAnim.setTotalCycleCount(10); |
---|
| | vertexAnim.setDelay(100); |
---|
| | vertexAnim.init(srcCell, |
---|
| | dstCell.getGeometry().getX() - overlapWidth + (srcCellWidth * time), dstCell.getGeometry().getY() - overlapHeight + (srcCellHeight * time), |
---|
| | threadPoolExecutor); |
---|
| | // vertexAnim.play(); |
---|
| | // sleepMainThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | vertexAnim.syncPlay(); |
---|
| | |
---|
| | // Test code (will be deleted) |
---|
| | outputLog(); |
---|
| | // Add a vertex to the graph in a transactional fashion. The vertex is actually a 'cell' in jgraphx terminology. |
---|
| | mxgraph.getModel().beginUpdate(); |
---|
| | synchronized (mxgraph.getModel()) { |
---|
| | try { |
---|
| |
---|
| | private void moveActualArgumentObjectVertex(MethodExecution methodExecution, ObjectVertex sourceObjectVertex, MethodExecutionVertex destinationMethodExecutionVertex) { |
---|
| | mxICell srcCell = (mxICell)sourceObjectVertex.getCell(); |
---|
| | mxICell dstCell = (mxICell) destinationMethodExecutionVertex.getCell(); |
---|
| | |
---|
| | // if (srcCell == dstCell.getParent()) { |
---|
| | if (srcCell.equals(dstCell.getParent())) { |
---|
| | System.out.println("Nothing to moveActualArgumentObjectVertex()."); |
---|
| | return; |
---|
| | } |
---|
| | |
---|
| | // Remove sourceVertex from Locals and Arguments of MethodExecution's Vertex. |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println(methodExecution.getSignature()); |
---|
| | System.out.println(sourceObjectVertex.getLabel()); |
---|
| | if (methodExecToVertexMap.containsKey(methodExecution) && methodExecToVertexMap.get(methodExecution).getLocals().contains(sourceObjectVertex)) { |
---|
| | methodExecToVertexMap.get(methodExecution).getLocals().remove(sourceObjectVertex); |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println(methodExecToVertexMap.get(methodExecution).getLabel() + " :removeLocal: " + sourceObjectVertex.getLabel()); |
---|
| | } |
---|
| | |
---|
| | if (methodExecToVertexMap.containsKey(methodExecution) && methodExecToVertexMap.get(methodExecution).getArguments().contains(sourceObjectVertex)) { |
---|
| | methodExecToVertexMap.get(methodExecution).getArguments().remove(sourceObjectVertex); |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println(methodExecToVertexMap.get(methodExecution).getLabel() + " :removeArgument: " + sourceObjectVertex.getLabel()); |
---|
| | } |
---|
| | |
---|
| | int time = destinationMethodExecutionVertex.getLocals().size(); |
---|
| | double srcCellCoordX = srcCell.getGeometry().getX(); |
---|
| | double srcCellCoordY = srcCell.getGeometry().getY(); |
---|
| | |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println(time + ", " + destinationMethodExecutionVertex.getLocals().size()); |
---|
| | |
---|
| | // Add a vertex to the graph in a transactional fashion. The vertex is actually a 'cell' in jgraphx terminology. |
---|
| | mxgraph.getModel().beginUpdate(); |
---|
| | synchronized (mxgraph.getModel()) { |
---|
| |
---|
| | srcCellCoordY = srcCellAbsPt.getY(); |
---|
| | srcCell.getParent().remove(srcCell); |
---|
| | } |
---|
| | |
---|
| | // srcCell.setParent(dstCell.getParent()); |
---|
| | // dstCell.getParent().insert(srcCell); |
---|
| | if (srcCell.getParent() == null || !srcCell.getParent().equals(dstCell.getParent())) { |
---|
| | // TODO: Confirm why not need following comment out. |
---|
| | // if (srcCell.getParent() != null) srcCell.getParent().remove(srcCell); |
---|
| | srcCell.setParent(dstCell.getParent()); |
---|
| |
---|
| | } |
---|
| | |
---|
| | double srcCellWidth = srcCell.getGeometry().getWidth(); |
---|
| | double dstCellHeight = dstCell.getGeometry().getHeight(); |
---|
| | |
---|
| | // deltaAnimation.setVertexAnimation(srcCell, |
---|
| | // new mxPoint(dstCell.getGeometry().getX() - (srcCellWidth / Math.sqrt(3)) + (srcCellWidth * time), dstCell.getGeometry().getY() + dstCellHeight)); |
---|
| | // deltaAnimation.startVertexAnimation(); |
---|
| | // deltaAnimation.sleepThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | Point2D srcCellDstPoint = new Point2D.Double(dstCell.getGeometry().getX() - (srcCellWidth / Math.sqrt(3)) + (srcCellWidth * time), |
---|
| | dstCell.getGeometry().getY() + dstCellHeight); |
---|
| | MagnetRONAnimation vertexAnim = new TranslateAnimation(mxgraph, getGraphComponent()); |
---|
| | vertexAnim.setTotalCycleCount(10); |
---|
| | vertexAnim.setDelay(100); |
---|
| | vertexAnim.init(srcCell, |
---|
| | dstCell.getGeometry().getX() - (srcCellWidth / Math.sqrt(3)) + (srcCellWidth * time), dstCell.getGeometry().getY() + dstCellHeight, |
---|
| | threadPoolExecutor); |
---|
| | // vertexAnim.play(); |
---|
| | // sleepMainThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | vertexAnim.init(srcCell, srcCellDstPoint.getX(), srcCellDstPoint.getY(), threadPoolExecutor); |
---|
| | vertexAnim.syncPlay(); |
---|
| | |
---|
| | // Add a vertex to the graph in a transactional fashion. The vertex is actually a 'cell' in jgraphx terminology. |
---|
| | mxgraph.getModel().beginUpdate(); |
---|
| | synchronized (mxgraph.getModel()) { |
---|
| | try { |
---|
| | srcCell.getGeometry().setX(dstCell.getGeometry().getX() - (srcCellWidth / Math.sqrt(3)) + (srcCellWidth * time)); |
---|
| | srcCell.getGeometry().setY(dstCell.getGeometry().getY() + dstCellHeight); |
---|
| | srcCell.getGeometry().setX(srcCellDstPoint.getX()); |
---|
| | srcCell.getGeometry().setY(srcCellDstPoint.getY()); |
---|
| | } finally { |
---|
| | mxgraph.getModel().endUpdate(); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | destinationMethodExecutionVertex.getArguments().add(sourceObjectVertex); |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println("moveActualArgumentObjectVertex: " + destinationMethodExecutionVertex.getLabel() + " :Argument: " + sourceObjectVertex.getLabel()); |
---|
| | } |
---|
| | |
---|
| | /** |
---|
| | * Update size and position of all {@code ObjectVertex}. |
---|
| | */ |
---|
| | protected void updateObjectVertices() { |
---|
| | Map<mxICell, MagnetRONAnimation> mxICellToTranslateAnimMap = new HashMap<>(); |
---|
| | MagnetRONAnimation.waitAnimationEnd(); |
---|
| | for (ObjectVertex ov: objectToVertexMap.values()) { |
---|
| | mxICell ovCell = (mxICell) ov.getCell(); |
---|
| | // if (ovCell == null || mxICellToTranslateAnimMap.get(ovCell) != null) continue; |
---|
| | if (ovCell == null) continue; |
---|
| | Dimension2D curDim = new Dimension((int) ovCell.getGeometry().getWidth(), (int) ovCell.getGeometry().getHeight()); |
---|
| | int sizeScale = 0; |
---|
| | for (int i = 0; i < ovCell.getChildCount(); i++) { |
---|
| | if (!ovCell.getChildAt(i).getId().contains("clone")) sizeScale++; |
---|
| | } |
---|
| | if (sizeScale == 0) sizeScale = 1; |
---|
| | // Dimension dstDim = |
---|
| | // new Dimension((int) DEFAULT_OBJECT_VERTEX_SIZE.getWidth() * sizeScale, |
---|
| | // (int) DEFAULT_OBJECT_VERTEX_SIZE.getHeight() * sizeScale); |
---|
| | Dimension2D dstDim = |
---|
| | new Dimension((int) DEFAULT_OBJECT_VERTEX_SIZE.getWidth() * sizeScale, |
---|
| | (int) DEFAULT_OBJECT_VERTEX_SIZE.getHeight() * sizeScale); |
---|
| | Point2D dstPt = new Point2D.Double(ovCell.getGeometry().getX(), ovCell.getGeometry().getY()); |
---|
| | // mxPoint dstPt = new mxPoint(ovCell.getGeometry().getX(), ovCell.getGeometry().getY()); |
---|
| | |
---|
| | if(!curDim.equals(dstDim)) { |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println(TAG + ": Update size of ObjectVertex " + ovCell.getId() + ". " + curDim.getWidth() + "->" + dstDim.getWidth()); |
---|
| | // if (ovCell.getParent() != mxDefaultParent && (ovCell.getChildCount() != 0 || ovCell.getGeometry().getWidth() > DEFAULT_OBJECT_VERTEX_SIZE.getWidth() * time)) { |
---|
| | if (!ovCell.getParent().equals(getMxDefaultParent()) |
---|
| | && (ovCell.getChildCount() != 0 || (curDim.getWidth() > dstDim.getWidth() && curDim.getHeight() > dstDim.getHeight()))) { |
---|
| | double overlapX = (dstDim.getWidth() - curDim.getWidth()) / 2 / Math.sqrt(2); |
---|
| | double overlapY = (dstDim.getHeight() - curDim.getHeight()) / 2 / Math.sqrt(2); |
---|
| | // dstPt = new mxPoint(ovCell.getGeometry().getX() - overlapX, ovCell.getGeometry().getY() + overlapY); |
---|
| | dstPt.setLocation(ovCell.getGeometry().getX() - overlapX, ovCell.getGeometry().getY() + overlapY); |
---|
| | |
---|
| | int idxFromParent = ovCell.getParent().getIndex(ovCell); |
---|
| | if (idxFromParent >= 2) { |
---|
| | overlapY = (dstDim.getHeight() - ovCell.getGeometry().getHeight()) / 2; |
---|
| | // dstPt.setY(ovCell.getGeometry().getY() + overlapY); |
---|
| | dstPt.setLocation(dstPt.getX(), ovCell.getGeometry().getY() + overlapY); |
---|
| | } |
---|
| | // If two and over ObjectVertex are arranged side by side as an argument or local, shift the Y coordinate of ObjectVertex slightly. |
---|
| | for (MethodExecutionVertex methodExecVertex: methodExecToVertexMap.values()) { |
---|
| | List<ObjectVertex> locals = methodExecVertex.getLocals(); |
---|
| | if (locals != null && locals.contains(ov) && locals.indexOf(ov) >= 1) { |
---|
| | overlapY = (dstDim.getHeight() - ovCell.getGeometry().getHeight()) / 2; |
---|
| | dstPt.setLocation(dstPt.getX(), ovCell.getGeometry().getY() + overlapY); |
---|
| | break; |
---|
| | } |
---|
| | List<ObjectVertex> arguments = methodExecVertex.getArguments(); |
---|
| | if (arguments != null && arguments.contains(ov)) { |
---|
| | // dstPt.setY(ovCell.getGeometry().getY() - overlapY); |
---|
| | dstPt.setLocation(dstPt.getX(), ovCell.getGeometry().getY() - overlapY); |
---|
| | break; |
---|
| | } |
---|
| | } |
---|
| | } |
---|
| | dstPt.setLocation(dstPt.getX() - (dstDim.getWidth() - curDim.getWidth()) / 2, dstPt.getY() - (dstDim.getHeight() - curDim.getHeight()) / 2); |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println(TAG + ": Translate " + ovCell.getId() + ". Current point=" + ovCell.getGeometry().getPoint() + ", Destination Point=" + dstPt); |
---|
| | // deltaAnimation.setVertexAnimation(ovCell, dstPt); |
---|
| | // deltaAnimation.startVertexAnimation(); |
---|
| | MagnetRONAnimation vertexAnim = new TranslateAnimation(mxgraph, getGraphComponent()); |
---|
| | mxICellToTranslateAnimMap.put(ovCell, vertexAnim); |
---|
| | vertexAnim.setTotalCycleCount(10); |
---|
| | vertexAnim.setDelay(100); |
---|
| | vertexAnim.init(ovCell, dstPt.getX(), dstPt.getY(), threadPoolExecutor); |
---|
| | vertexAnim.play(); |
---|
| | // sleepMainThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | // deltaAnimation.setResizeVertexAnimation(ovCell, dstDim); |
---|
| | // deltaAnimation.startResizeVertexAnimation(); |
---|
| | // deltaAnimation.sleepThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | MagnetRONAnimation vertexResizeAnim = new VertexResizeAnimation(mxgraph, getGraphComponent()); |
---|
| | vertexResizeAnim.setTotalCycleCount(10); |
---|
| | vertexResizeAnim.setDelay(100); |
---|
| | vertexResizeAnim.init(ovCell, dstDim.getWidth(), dstDim.getHeight(), threadPoolExecutor); |
---|
| | vertexResizeAnim.play(); |
---|
| | // sleepMainThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | for (int i = 0; i < ovCell.getChildCount(); i++) { |
---|
| | mxICell childCell = ovCell.getChildAt(i); |
---|
| | // if (mxICellToTranslateAnimMap.get(childCell) != null) continue; |
---|
| | double childCellCurX = childCell.getGeometry().getX(); |
---|
| | double childCellCurY = childCell.getGeometry().getY(); |
---|
| | Point2D childDstPt = |
---|
| | new Point2D.Double(childCellCurX + (dstDim.getWidth() - curDim.getWidth()) / 2, |
---|
| | childCellCurY + (dstDim.getHeight() - curDim.getHeight()) / 2); |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println(TAG + ": Translate " + childCell.getId() + " of " + ovCell.getId() + ". Current point=" + childCell.getGeometry().getPoint() + ", Destination Point=" + childDstPt); |
---|
| | MagnetRONAnimation childVertexAnim = new TranslateAnimation(mxgraph, getGraphComponent()); |
---|
| | mxICellToTranslateAnimMap.put(childCell, childVertexAnim); |
---|
| | childVertexAnim.setTotalCycleCount(10); |
---|
| | childVertexAnim.setDelay(100); |
---|
| | childVertexAnim.init(childCell, childDstPt.getX(), childDstPt.getY(), threadPoolExecutor); |
---|
| | childVertexAnim.play(); |
---|
| | } |
---|
| | // sleepMainThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | MagnetRONAnimation.waitAnimationEnd(); |
---|
| | } |
---|
| | } |
---|
| | // sleepMainThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | } |
---|
| | |
---|
| | abstract protected void createMethodExecutionVertex(Alias alias); |
---|
| | |
---|
| |
---|
| | methodSignature = methodExecution.getSignature(); |
---|
| | } |
---|
| | |
---|
| | if (methodSignature.matches(".+\\(.*\\)")) { |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println(methodSignature); |
---|
| | methodSignature = formatMethodSignature(methodSignature, methodExecution.getThisClassName()); |
---|
| | } |
---|
| | |
---|
| | if (methodExecution.isStatic() && !objectId.equals("0")) { |
---|
| |
---|
| | double coordY = DEFAULT_OBJECT_VERTEX_SIZE.getHeight() * 0.5; |
---|
| | double stdX = coordX; |
---|
| | double stdY = 0; |
---|
| | int time = objectToVertexMap.get(objectId).getVertexMethodExecutions().size(); |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println("time" + time); |
---|
| | if (time >= 1) { |
---|
| | mxICell stdCell = (mxICell) objectToVertexMap.get(objectId).getVertexMethodExecutions().get(0).getCell(); |
---|
| | stdX = stdCell.getGeometry().getX(); |
---|
| | stdY = stdCell.getGeometry().getY(); |
---|
| |
---|
| | try { |
---|
| | // Creates a white cell of MethodExecutionVertex. |
---|
| | cell = (mxICell) mxgraph.insertDeltaVertex(parentCell, methodSignature, methodSignature, "fillColor=white"); |
---|
| | mxgraph.orderCells(false, new Object[] {cell}); |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println("makeVertexMethodExecution: " + cell.getId() + " in " + objectId + " (" + stdX + ", " + coordY * (time + 1) + stdY + ")"); |
---|
| | methodExecVertex = |
---|
| | new MethodExecutionVertex(methodSignature, cell, stdX, coordY * (time + 1) + stdY, |
---|
| | DEFAULT_METHOD_EXECUTION_VERTEX_SIZE.getWidth(), DEFAULT_METHOD_EXECUTION_VERTEX_SIZE.getHeight()); |
---|
| | methodExecToVertexMap.put(methodExecution, methodExecVertex); |
---|
| | if(methodExecToVertexMap.size() > 1) { |
---|
| | // Caution: If synchronized block is split here, {@code cell} display instantly until cell#setVisible(false) is executed. |
---|
| | // Caution: If synchronized block is split here, {@code cell} is visible instantly until cell#setVisible(false) is executed. |
---|
| | cell.setVisible(false); |
---|
| | } |
---|
| | } finally { |
---|
| | mxgraph.getModel().endUpdate(); |
---|
| |
---|
| | List<ObjectVertex> locals = new ArrayList<>(methodExecToVertexMap.get(calledMethodExec).getLocals()); |
---|
| | if (arguments.size() != 0) { |
---|
| | for (ObjectVertex vo: arguments) { |
---|
| | if (vo != srcObjVertex) { |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println("argumentRemove"); |
---|
| | mxICell cell = (mxICell)vo.getCell(); |
---|
| | if (!cell.getParent().equals(getMxDefaultParent())) { |
---|
| | // If parent of ObjectVertex cell isn't mxDefaltParent, reset parent. |
---|
| | // Add a vertex to the graph in a transactional fashion. The vertex is actually a 'cell' in jgraphx terminology. |
---|
| |
---|
| | mxgraph.getModel().endUpdate(); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | // deltaAnimation.setVertexAnimation(cell, new mxPoint(vo.getInitialX(), vo.getInitialY())); |
---|
| | // deltaAnimation.startVertexAnimation(); |
---|
| | MagnetRONAnimation vertexAnim = new TranslateAnimation(mxgraph, getGraphComponent()); |
---|
| | vertexAnim.setTotalCycleCount(10); |
---|
| | vertexAnim.setDelay(100); |
---|
| | vertexAnim.init(cell, vo.getInitialX(), vo.getInitialY(), threadPoolExecutor); |
---|
| |
---|
| | } |
---|
| | if (locals.size() != 0) { |
---|
| | for (ObjectVertex vo: locals) { |
---|
| | if (vo != srcObjVertex) { |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println("localRemove"); |
---|
| | mxICell cell = (mxICell)vo.getCell(); |
---|
| | // Add a vertex to the graph in a transactional fashion. The vertex is actually a 'cell' in jgraphx terminology. |
---|
| | mxgraph.getModel().beginUpdate(); |
---|
| | synchronized (mxgraph.getModel()) { |
---|
| | try { |
---|
| | Point2D cellAbsPt = getAbsolutePointforCell(cell); |
---|
| | // cell.getParent().remove(cell); |
---|
| | // cell.setParent(mxDefaultParent); |
---|
| | if (!cell.getParent().equals(getMxDefaultParent())) { |
---|
| | // If parent of ObjectVertex cell isn't mxDefaltParent, reset parent. |
---|
| | cell.getParent().remove(cell); |
---|
| | cell.setParent(getMxDefaultParent()); |
---|
| |
---|
| | } finally { |
---|
| | mxgraph.getModel().endUpdate(); |
---|
| | } |
---|
| | } |
---|
| | // deltaAnimation.setVertexAnimation(cell, new mxPoint(vo.getInitialX(), vo.getInitialY())); |
---|
| | // deltaAnimation.startVertexAnimation(); |
---|
| | MagnetRONAnimation vertexAnim = new TranslateAnimation(mxgraph, getGraphComponent()); |
---|
| | vertexAnim.setTotalCycleCount(10); |
---|
| | vertexAnim.setDelay(100); |
---|
| | vertexAnim.init(cell, vo.getInitialX(), vo.getInitialY(), threadPoolExecutor); |
---|
| | vertexAnim.play(); |
---|
| | // methodExecToVertexMap.get(calledMethodExec).getLocals().remove(vo); |
---|
| | } |
---|
| | } |
---|
| | } |
---|
| | } |
---|
| |
---|
| | try { |
---|
| | // Remove source {@code ObjectVertex} from Locals and Arguments of called {@code MethodExecution}'s Vertex. |
---|
| | if (methodExecToVertexMap.containsKey(methodExecution)) { |
---|
| | mxCell dstMethodExecVertexCell = (mxCell)methodExecToVertexMap.get(methodExecution).getCell(); |
---|
| | // dstMethodExecVertexCell.getParent().remove(dstMethodExecVertexCell); |
---|
| | // dstMethodExecVertexCell.setParent(mxDefaultParent); |
---|
| | if (!dstMethodExecVertexCell.getParent().equals(getMxDefaultParent())) { |
---|
| | // If parent of ObjectVertex cell isn't mxDefaltParent, reset parent. |
---|
| | dstMethodExecVertexCell.getParent().remove(dstMethodExecVertexCell); |
---|
| | dstMethodExecVertexCell.setParent(getMxDefaultParent()); |
---|
| |
---|
| | * @param methodExec: current method execution |
---|
| | * @param calledMethodExec: called method execution |
---|
| | */ |
---|
| | protected void removeCalledMethodExecutionVertex(ObjectVertex sourceObjectVertex, MethodExecution methodExecution, MethodExecution calledMethodExecution) { |
---|
| | // Test code (will be deleted) |
---|
| | outputLog(); |
---|
| | MagnetRONAnimation.waitAnimationEnd(); |
---|
| | // Remove ObjectVertex other than sourceObjectVertex from locals and arguments of called MethodExecutionVertex. |
---|
| | if (methodExecToVertexMap.containsKey(calledMethodExecution)) { |
---|
| | MethodExecutionVertex calledMethodExecVertex = methodExecToVertexMap.get(calledMethodExecution); |
---|
| |
---|
| | for (ObjectVertex vo: arguments) { |
---|
| | if (vo != sourceObjectVertex) { |
---|
| | mxICell cell = (mxICell)vo.getCell(); |
---|
| | Point2D cellAbsPt = getAbsolutePointforCell(cell); |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println(cell); |
---|
| | System.out.println(vo.getInitialX() + ", " + vo.getInitialY()); |
---|
| | System.out.println(cell.getGeometry().getX() + ", " + cell.getGeometry().getY()); |
---|
| | System.out.println(cellAbsPt); |
---|
| | // Add a vertex to the graph in a transactional fashion. The vertex is actually a 'cell' in jgraphx terminology. |
---|
| | mxgraph.getModel().beginUpdate(); |
---|
| | synchronized (mxgraph.getModel()) { |
---|
| | try { |
---|
| |
---|
| | } finally { |
---|
| | mxgraph.getModel().endUpdate(); |
---|
| | } |
---|
| | } |
---|
| | // deltaAnimation.setVertexAnimation(cell, new mxPoint(vo.getInitialX(), vo.getInitialY())); |
---|
| | // deltaAnimation.startVertexAnimation(); |
---|
| | // deltaAnimation.sleepThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | MagnetRONAnimation vertexAnim = new TranslateAnimation(mxgraph, getGraphComponent()); |
---|
| | vertexAnim.setTotalCycleCount(10); |
---|
| | vertexAnim.setDelay(100); |
---|
| | vertexAnim.init(cell, vo.getInitialX(), vo.getInitialY(), threadPoolExecutor); |
---|
| | // vertexAnim.play(); |
---|
| | // sleepMainThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | vertexAnim.syncPlay(); |
---|
| | } |
---|
| | methodExecToVertexMap.get(calledMethodExecution).getArguments().remove(vo); |
---|
| | } |
---|
| |
---|
| | for (ObjectVertex vo: locals) { |
---|
| | if (vo != sourceObjectVertex) { |
---|
| | mxICell cell = (mxICell)vo.getCell(); |
---|
| | Point2D cellAbsPt = getAbsolutePointforCell(cell); |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println(cell); |
---|
| | System.out.println(vo.getInitialX() + ", " + vo.getInitialY()); |
---|
| | System.out.println(cell.getGeometry().getX() + ", " + cell.getGeometry().getY()); |
---|
| | System.out.println(cellAbsPt); |
---|
| | // Add a vertex to the graph in a transactional fashion. The vertex is actually a 'cell' in jgraphx terminology. |
---|
| | mxgraph.getModel().beginUpdate(); |
---|
| | synchronized (mxgraph.getModel()) { |
---|
| | try { |
---|
| |
---|
| | } finally { |
---|
| | mxgraph.getModel().endUpdate(); |
---|
| | } |
---|
| | } |
---|
| | // deltaAnimation.setVertexAnimation(cell, new mxPoint(vo.getInitialX(), vo.getInitialY())); |
---|
| | // deltaAnimation.startVertexAnimation(); |
---|
| | // deltaAnimation.sleepThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | MagnetRONAnimation vertexAnim = new TranslateAnimation(mxgraph, getGraphComponent()); |
---|
| | vertexAnim.setTotalCycleCount(10); |
---|
| | vertexAnim.setDelay(100); |
---|
| | vertexAnim.init(cell, vo.getInitialX(), vo.getInitialY(), threadPoolExecutor); |
---|
| | // vertexAnim.play(); |
---|
| | // sleepMainThread(DEFAULT_THREAD_SLEEP_MILLIS); |
---|
| | vertexAnim.syncPlay(); |
---|
| | } |
---|
| | methodExecToVertexMap.get(calledMethodExecution).getLocals().remove(vo); |
---|
| | } |
---|
| |
---|
| | MagnetRONAnimation edgeAnim = new TranslateAnimation(mxgraph, getGraphComponent()); |
---|
| | edgeAnim.setTotalCycleCount(10); |
---|
| | edgeAnim.setDelay(100); |
---|
| | edgeAnim.init(clonedstMethodExecVertexCell[0], srcMethodExecVertexCellAbsPt.getX(), srcMethodExecVertexCellAbsPt.getY() + srcMethodExecVertexCell.getGeometry().getHeight(), threadPoolExecutor); |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println("absPointSourceVertexCell: " + srcMethodExecVertexCellAbsPt); |
---|
| | edgeAnim.setOnFinished(new ActionListener() { |
---|
| | @Override |
---|
| | public void actionPerformed(java.awt.event.ActionEvent e) { |
---|
| | // Add a vertex to the graph in a transactional fashion. The vertex is actually a 'cell' in jgraphx terminology. |
---|
| | mxgraph.getModel().beginUpdate(); |
---|
| | synchronized (mxgraph.getModel()) { |
---|
| | try { |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println("Shrink edge animation action performed. "); |
---|
| | System.out.println(TAG + ": Shrink edge animation action performed."); |
---|
| | mxgraph.removeCells(new Object[]{clonedstMethodExecVertexCell[0]}); |
---|
| | |
---|
| | // TODO: Confirm execution order. |
---|
| | // dstMethodExecVertexCell.getParent().remove(dstMethodExecVertexCell); |
---|
| | // dstMethodExecVertexCell.setParent(mxDefaultParent); |
---|
| | if (!dstMethodExecVertexCell.getParent().equals(getMxDefaultParent())) { |
---|
| | // If parent of ObjectVertex cell isn't mxDefaltParent, reset parent. |
---|
| | dstMethodExecVertexCell.getParent().remove(dstMethodExecVertexCell); |
---|
| | dstMethodExecVertexCell.setParent(getMxDefaultParent()); |
---|
| |
---|
| | e.printStackTrace(); |
---|
| | } |
---|
| | sleepMainThread(POSTPONE_ANIMATION_MILLIS); |
---|
| | } |
---|
| | |
---|
| | // Test code (will be deleted) |
---|
| | outputLog(); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | /** |
---|
| | * Create an edge between method execution While animating the edge to stretch. |
---|
| | */ |
---|
| |
---|
| | MagnetRONAnimation edgeAnim = new TranslateAnimation(mxgraph, getGraphComponent()); |
---|
| | edgeAnim.setTotalCycleCount(10); |
---|
| | edgeAnim.setDelay(100); |
---|
| | edgeAnim.init(clonedstMethodExecVertexCell[0], dstMethodExecVertexCellAbsPt.getX(), dstMethodExecVertexCellAbsPt.getY(), threadPoolExecutor); |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println("absPointSourceVertexCell: " + srcMethodExecVertexCellAbsPt); |
---|
| | edgeAnim.setOnFinished(new ActionListener() { |
---|
| | @Override |
---|
| | public void actionPerformed(java.awt.event.ActionEvent e) { |
---|
| | // Add a vertex to the graph in a transactional fashion. The vertex is actually a 'cell' in jgraphx terminology. |
---|
| | mxgraph.getModel().beginUpdate(); |
---|
| | synchronized (mxgraph.getModel()) { |
---|
| | try { |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println("Stretch edge animation action performed. "); |
---|
| | System.out.println(TAG + ": Stretch edge animation action performed. "); |
---|
| | mxICell edge = (mxICell) mxgraph.insertDeltaEdge(getMxDefaultParent(), methodSig, null, srcMethodExecVertexCell, dstMethodExecVertexCell); |
---|
| | // edge.getParent().remove(edge); |
---|
| | // edge.setParent(mxDefaultParent); |
---|
| | if (!edge.getParent().equals(getMxDefaultParent())) { |
---|
| | // If parent of Edge cell isn't mxDefaltParent, reset parent. |
---|
| | edge.getParent().remove(edge); |
---|
| | edge.setParent(getMxDefaultParent()); |
---|
| |
---|
| | } catch (CloneNotSupportedException e) { |
---|
| | e.printStackTrace(); |
---|
| | } |
---|
| | } |
---|
| | // sleepMainThread(POSTPONE_ANIMATION_MILLIS); |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | /** |
---|
| |
---|
| | * @param srcCellAbsPt |
---|
| | * @param dstCellAbsPt |
---|
| | */ |
---|
| | protected void setEdgePoint(mxICell edge, Point2D srcCellAbsPt, Point2D dstCellAbsPt) { |
---|
| | // mxgraph.orderCells(true, new Object[] {edge}); |
---|
| | // if(srcCellAbsPt.getX() <= dstCellAbsPt.getX()) { |
---|
| | // // 右下から左上へエッジを引く |
---|
| | // edge.setStyle("exitX=0.5;exitY=0.5;exitPerimeter=1;entryX=0;entryY=0.5;entryPerimeter=1;"); |
---|
| | // } else { |
---|
| | // // 左下から右上へエッジを引く |
---|
| | // edge.setStyle("exitX=0.5;exitY=0.5;exitPerimeter=1;entryX=1;entryY=0.5;entryPerimeter=1;"); |
---|
| | // } |
---|
| | // mxgraph.orderCells(true, new Object[] {edge}); |
---|
| | // if(srcCellAbsPt.getX() <= dstCellAbsPt.getX()) { |
---|
| | // // 右下から左上へエッジを引く |
---|
| | // edge.setStyle("exitX=0.5;exitY=0.5;exitPerimeter=1;entryX=0;entryY=0.5;entryPerimeter=1;"); |
---|
| | // } else { |
---|
| | // // 左下から右上へエッジを引く |
---|
| | // edge.setStyle("exitX=0.5;exitY=0.5;exitPerimeter=1;entryX=1;entryY=0.5;entryPerimeter=1;"); |
---|
| | // } |
---|
| | } |
---|
| | |
---|
| | /** |
---|
| | * Styles all cells on the graph. |
---|
| |
---|
| | } |
---|
| | |
---|
| | protected Point2D getAbsolutePointforCell(mxICell cell) { |
---|
| | Point2D p1 = new Point2D.Double(cell.getGeometry().getX(), cell.getGeometry().getY());; |
---|
| | // if(cell.getParent().getValue() == null || cell == cell.getParent()) { |
---|
| | if(cell.getParent() == null |
---|
| | || cell.getParent().getValue() == null |
---|
| | || cell.equals(cell.getParent())) { |
---|
| | return p1; |
---|
| | } |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println(cell.getId() + ", " + cell.getParent().getId()); |
---|
| | Point2D p2 = getAbsolutePointforCell(cell.getParent()); |
---|
| | return new Point2D.Double(p1.getX() + p2.getX(), p1.getY() + p2.getY()); |
---|
| | } |
---|
| | |
---|
| |
---|
| | for(ObjectVertex ov: mev.getArguments()) { |
---|
| | return countChildVertex(ov); |
---|
| | } |
---|
| | } |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println(objectVertex.getLabel() + ": " + time); |
---|
| | return time; |
---|
| | } |
---|
| | |
---|
| | protected static String[] formatFieldName(String fieldName) { |
---|
| |
---|
| | } |
---|
| | if (srcParentCell.equals(destinationCell)) { |
---|
| | return true; |
---|
| | } |
---|
| | // Test code (will be deleted) |
---|
| | System.out.println(sourceCell.getId() + ", " + srcParentCell.getId()); |
---|
| | return isParent(srcParentCell, destinationCell); |
---|
| | } |
---|
| | |
---|
| | protected void reflectCoordinates(DeltaGraphAdapter mxgraph) { |
---|
| |
---|
| | |