diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowDelegationStage.java b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowDelegationStage.java index 72eb256..eae1f8b 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowDelegationStage.java +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/stages/ControlFlowDelegationStage.java @@ -95,41 +95,33 @@ */ public void showDelegatableNodes(mxGraph graph, final CallEdgeAttribute callEdgeAttr){ mxCell root = (mxCell)graph.getDefaultParent(); - mxCell layerCell = null; - switch(callEdgeAttr.getSelectedOption()) { - case PUSH: - layerCell = (mxCell)root.getChildAt(Stage.PUSH_FLOW_LAYER); - break; - - case PULL: - case PUSHorPULL: - layerCell = (mxCell)root.getChildAt(Stage.PULL_FLOW_LAYER); - } - graph.getModel().beginUpdate(); try { ObjectNode delegatingNode = callEdgeAttr.getDestinationObjectNode(); - - for(Object node : graph.getChildVertices(layerCell)) { - if( !(node instanceof mxCell) ) continue; - mxCell cell = (mxCell)node; - - ObjectNodeAttribute objNodeAttr = (ObjectNodeAttribute)cell.getValue(); - if(objNodeAttr == null) return; - - ObjectNode objNode = objNodeAttr.getObjectNode(); - ControlFlowDelegator delegator = new ControlFlowDelegator(controlFlowGraph); - List delegatableNodes = delegator.searchDelegatableNodes(callEdgeAttr.getCallEdge()); + for(int layerNo = Stage.PUSH_FLOW_LAYER; layerNo <= PULL_FLOW_LAYER; layerNo++) { - if(delegatableNodes.contains(objNode)) // enable - graph.getModel().setStyle(cell, objNodeAttr.getEnableStyle()); - else // disable - graph.getModel().setStyle(cell, objNodeAttr.getDisableStyle()); + mxCell layerCell = (mxCell)root.getChildAt(layerNo); + for(Object node : graph.getChildVertices(layerCell)) { + if( !(node instanceof mxCell) ) continue; + mxCell cell = (mxCell)node; - - // base-Node - if(delegatingNode.equals(objNodeAttr.getObjectNode())) - graph.getModel().setStyle(cell, objNodeAttr.getDelegatingStyle()); + ObjectNodeAttribute objNodeAttr = (ObjectNodeAttribute)cell.getValue(); + if(objNodeAttr == null) return; + + ObjectNode objNode = objNodeAttr.getObjectNode(); + ControlFlowDelegator delegator = new ControlFlowDelegator(controlFlowGraph); + List delegatableNodes = delegator.searchDelegatableNodes(callEdgeAttr.getCallEdge()); + + if(delegatableNodes.contains(objNode)) { + graph.getModel().setStyle(cell, objNodeAttr.getEnableStyle()); + } + else { + graph.getModel().setStyle(cell, objNodeAttr.getDisableStyle()); + } + + if(delegatingNode.equals(objNodeAttr.getObjectNode())) + /* base-Node*/graph.getModel().setStyle(cell, objNodeAttr.getDelegatingStyle()); + } } } finally { @@ -190,8 +182,9 @@ graph.getModel().beginUpdate(); try { - for(int i = Stage.PUSH_FLOW_LAYER; i <= Stage.PULL_FLOW_LAYER; i++) { - mxCell layerCell = (mxCell)root.getChildAt(i); + for(int layerNo = Stage.PUSH_FLOW_LAYER; layerNo <= Stage.PULL_FLOW_LAYER; layerNo++) { + + mxCell layerCell = (mxCell)root.getChildAt(layerNo); for(Object node : graph.getChildVertices(layerCell)) { mxCell cell = null; if(node instanceof mxCell) cell = (mxCell)node;