diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/DependencyModelingStage.java b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/DependencyModelingStage.java index ee88089..afb3904 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/DependencyModelingStage.java +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/DependencyModelingStage.java @@ -319,32 +319,29 @@ mxCell srcCell = null; mxCell dstCell = null; + // Resource → Resource edges (for layout consistency) + boolean srcIsRes = false; + boolean dstIsRes = false; + // Determine if the source is an EventChannel or a Resource - DataTransferChannel srcEvent = dependencyGraph.getEventChannelFromObjectNode(srcNode); - if (srcEvent != null) { - srcCell = eventChNodeCells.get(srcEvent); - } else { - ResourceNode srcRes = dependencyGraph.getResourceNodeFromObjectNode(srcNode); - if (srcRes != null) srcCell = resNodeCells.get(srcRes); + if(srcNode instanceof EventChannelObjectNode){ + srcCell = eventChNodeCells.get(((EventChannelObjectNode) srcNode).getIOChannel()); + } else if (srcNode instanceof StatefulObjectNode){ + srcCell = resNodeCells.get(((StatefulObjectNode) srcNode).getResource()); + srcIsRes = true; } // Determine if the destination is an EventChannel or a Resource - DataTransferChannel dstEvent = dependencyGraph.getEventChannelFromObjectNode(dstNode); - if (dstEvent != null) { - dstCell = eventChNodeCells.get(dstEvent); - } else { - ResourceNode dstRes = dependencyGraph.getResourceNodeFromObjectNode(dstNode); - if (dstRes != null) dstCell = resNodeCells.get(dstRes); + if(dstNode instanceof EventChannelObjectNode){ + dstCell = eventChNodeCells.get(((EventChannelObjectNode) dstNode).getIOChannel()); + } else if (dstNode instanceof StatefulObjectNode){ + dstCell = resNodeCells.get(((StatefulObjectNode) dstNode).getResource()); + dstIsRes = true; } // Skip if either side cannot be resolved to a cell if (srcCell == null || dstCell == null) continue; - - // Resource → Resource edges (for layout consistency) - boolean srcIsRes = dependencyGraph.getEventChannelFromObjectNode(srcNode) == null; - boolean dstIsRes = dependencyGraph.getEventChannelFromObjectNode(dstNode) == null; - String style = dependencyEdgeStyle; if (srcIsRes && dstIsRes) { @@ -361,21 +358,6 @@ graph.insertEdge(layerCell, null, null, srcCell, dstCell, style); } - // Insert reference edges (Resource → EventChannel) - for (Channel ch : model.getChannels()) { - DataTransferChannel channel = (DataTransferChannel) ch; - for (ResourcePath refRes : channel.getReferenceResources()) { - ResourceNode resNode = dependencyGraph.getDataFlowGraph().getResourceNode(refRes); - - graph.insertEdge( - layerCell, null, null, - resNodeCells.get(resNode), - eventChNodeCells.get(channel), - "strokeWidth=3;strokeColor=green;dashed=true;movable=false" - ); - } - } - return graph; }