diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/InEdgeAttribute.java b/AlgebraicDataflowArchitectureModel/src/application/editor/InEdgeAttribute.java new file mode 100644 index 0000000..5481474 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/InEdgeAttribute.java @@ -0,0 +1,19 @@ +package application.editor; + +import models.dataFlowModel.PushPullAttribute; +import models.dataFlowModel.PushPullValue; +import models.dataFlowModel.ResourceNode; + +public class InEdgeAttribute extends PushPullAttribute { + ResourceNode srcRes; + + public InEdgeAttribute(PushPullAttribute attr, ResourceNode srcRes) { + super(); + super.setOptions(attr.getOptions()); + this.srcRes = srcRes; + } + + public ResourceNode getSrcResource() { + return srcRes; + } +} diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/OutEdgeAttribute.java b/AlgebraicDataflowArchitectureModel/src/application/editor/OutEdgeAttribute.java new file mode 100644 index 0000000..3d5c286 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/OutEdgeAttribute.java @@ -0,0 +1,18 @@ +package application.editor; + +import application.editor.Editor.SrcDstAttribute; +import models.EdgeAttribute; +import models.dataFlowModel.ResourceNode; + +public class OutEdgeAttribute extends SrcDstAttribute { + private ResourceNode dstRes; + + public OutEdgeAttribute(SrcDstAttribute attr, ResourceNode dstRes) { + super(attr.getSrouce(), attr.getDestination()); + this.dstRes = dstRes; + } + + public ResourceNode getDstResource() { + return dstRes; + } +} diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/PushPullSelectionStage.java b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/PushPullSelectionStage.java index ca248e2..35e1a97 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/PushPullSelectionStage.java +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/PushPullSelectionStage.java @@ -6,15 +6,17 @@ import com.mxgraph.view.mxGraph; import algorithms.DataTransferModelAnalyzer; -import application.editor.Editor; import application.editor.Stage; import application.editor.Editor.SrcDstAttribute; +import application.editor.InEdgeAttribute; +import application.editor.OutEdgeAttribute; import application.editor.FlowCellEditor; import models.Edge; import models.dataFlowModel.DataFlowEdge; import models.dataFlowModel.DataFlowGraph; import models.dataFlowModel.DataTransferChannelGenerator; import models.dataFlowModel.DataTransferModel; +import models.dataFlowModel.PushPullAttribute; import models.dataFlowModel.ResourceNode; public class PushPullSelectionStage extends Stage { @@ -62,20 +64,25 @@ Object parent = graph.getDefaultParent(); graph.getModel().beginUpdate(); try { - // add input, output and reference edges + // update attributes of input and output edges for (Edge e : dataFlowGraph.getEdges()) { if (e instanceof DataFlowEdge) { DataFlowEdge dataFlow = (DataFlowEdge) e; DataTransferChannelGenerator channelGen = dataFlow.getChannelGenerator(); ResourceNode srcRes = (ResourceNode) dataFlow.getSource(); - // input edge + ResourceNode dstRes = (ResourceNode) dataFlow.getDestination(); for (Object edge: graph.getChildEdges(parent)) { mxCell edgeCell = (mxCell) edge; if (edgeCell.getValue() instanceof SrcDstAttribute) { SrcDstAttribute edgeAttr = (SrcDstAttribute) edgeCell.getValue(); if (edgeAttr.getSrouce() == srcRes.getIdentifierTemplate() && edgeAttr.getDestination() == channelGen) { - edgeCell.setValue(dataFlow.getAttribute()); + // input edge + edgeCell.setValue(new InEdgeAttribute((PushPullAttribute) dataFlow.getAttribute(), srcRes)); break; + } else if (edgeAttr.getSrouce() == channelGen && edgeAttr.getDestination() == dstRes.getIdentifierTemplate()) { + // output edge + edgeCell.setValue(new OutEdgeAttribute(edgeAttr, dstRes)); + break; } } } diff --git a/AlgebraicDataflowArchitectureModel/src/application/views/NavigationWindow.java b/AlgebraicDataflowArchitectureModel/src/application/views/NavigationWindow.java index c7d188b..de83e6d 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/views/NavigationWindow.java +++ b/AlgebraicDataflowArchitectureModel/src/application/views/NavigationWindow.java @@ -44,7 +44,7 @@ panel.add(pushPullSelectionButton); panel.add(controlFlowDelegationButton); controlFlowDelegationButton.setEnabled(false); - dataFlowModelingButton.setEnabled(false); + pushPullSelectionButton.setEnabled(false); dataFlowModelingButton.setSelected(true); pack(); setResizable(false);