for (GraphCanvas graphCanvas : graphCanvases) {
Graph graph = graphCanvas.getGraph();
List<WorkflowNode> updatingNodes = new LinkedList<WorkflowNode>();
for (Node node : graph.getNodes()) {
if (node instanceof WorkflowNode) {
WorkflowNode workflowNode = (WorkflowNode) node;
WorkflowComponent workflowComponent = workflowNode
.getComponent();
URI templateID = workflowComponent.getTemplateID();
if (templateID.equals(newTemplateID)) {
updatingNodes.add(workflowNode);
}
}
}
for (WorkflowNode node : updatingNodes) {
Point position = node.getPosition();
// TODO remember connections too
graph.removeNode(node);
WorkflowNode newNode = newComponent.createNode(graph);
newNode.setPosition(position);
}
}
}