diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java b/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java index 63702cd..ab13d4d 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java @@ -127,7 +127,7 @@ graph.getModel().addListener(mxEvent.CHANGE, curChangeEventListener); } curStage = nextStage; - // notifyStageChangeListeners(); // <- roop? + notifyStageChangeListeners(); return true; } @@ -176,7 +176,6 @@ model = null; ((DataFlowModelingStage) curStage).clear(); - notifyStageChangeListeners(); curFilePath = null; curFileName = null; @@ -218,7 +217,6 @@ // Change to the push/pull selection stage, analyze the data transfer model and construct a data-flow graph. changeStage(STAGE_PUSH_PULL_SELECTION); - notifyStageChangeListeners(); curFilePath = file.getAbsolutePath(); curFileName = file.getName(); @@ -255,7 +253,6 @@ // Change to the push/pull selection stage, analyze the data transfer model and construct a data-flow graph. changeStage(STAGE_PUSH_PULL_SELECTION); - notifyStageChangeListeners(); curFilePath = file.getAbsolutePath(); curFileName = file.getName(); @@ -427,7 +424,6 @@ ((DataFlowModelingStage) curStage).addIdentifierTemplate(res); model = ((DataFlowModelingStage) curStage).getModel(); - notifyStageChangeListeners(); } public void addChannelGenerator(DataTransferChannelGenerator channelGen) { @@ -437,7 +433,7 @@ ((DataFlowModelingStage) curStage).addChannelGenerator(channelGen); model = ((DataFlowModelingStage) curStage).getModel(); - notifyStageChangeListeners(); + } public void addIOChannelGenerator(DataTransferChannelGenerator ioChannelGen) { @@ -447,7 +443,6 @@ ((DataFlowModelingStage) curStage).addIOChannelGenerator(ioChannelGen); model = ((DataFlowModelingStage) curStage).getModel(); - notifyStageChangeListeners(); } public void addFormulaChannelGenerator(FormulaChannelGenerator formulaChannelGen) { @@ -457,7 +452,6 @@ ((DataFlowModelingStage) curStage).addFormulaChannelGenerator(formulaChannelGen); model = ((DataFlowModelingStage) curStage).getModel(); - notifyStageChangeListeners(); } public boolean connectEdge(mxCell edge, mxCell src, mxCell dst) { @@ -466,7 +460,7 @@ if (!stageChanged) return false; boolean isConnected = ((DataFlowModelingStage) curStage).connectEdge(edge, src, dst); - notifyStageChangeListeners(); + return isConnected; } @@ -476,7 +470,6 @@ if (!stageChanged) return; ((DataFlowModelingStage) curStage).delete(); - notifyStageChangeListeners(); } public static class SrcDstAttribute extends EdgeAttribute { diff --git a/AlgebraicDataflowArchitectureModel/src/application/views/NavigationWindow.java b/AlgebraicDataflowArchitectureModel/src/application/views/NavigationWindow.java index de83e6d..ca47c26 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/views/NavigationWindow.java +++ b/AlgebraicDataflowArchitectureModel/src/application/views/NavigationWindow.java @@ -22,6 +22,7 @@ private JToggleButton dataFlowModelingButton; private JToggleButton pushPullSelectionButton; private JToggleButton controlFlowDelegationButton; + private boolean forbidReentry = false; public NavigationWindow(ApplicationWindow owner, Editor editor) { super(owner); @@ -52,6 +53,7 @@ @Override public void stageChanged(Stage newStage) { + if (forbidReentry) return; if (newStage instanceof DataFlowModelingStage) { dataFlowModelingButton.setSelected(true); if (editor.canChange(Editor.STAGE_PUSH_PULL_SELECTION)) { @@ -94,7 +96,9 @@ private class DataFlowModelingButtonListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { + forbidReentry = true; editor.changeStage(Editor.STAGE_DATA_FLOW_MODELING); + forbidReentry = false; if (editor.canChange(Editor.STAGE_PUSH_PULL_SELECTION)) { pushPullSelectionButton.setEnabled(true); } else { @@ -111,7 +115,9 @@ private class PushPullSelectionButtonListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { + forbidReentry = true; editor.changeStage(Editor.STAGE_PUSH_PULL_SELECTION); + forbidReentry = false; if (editor.canChange(Editor.STAGE_DATA_FLOW_MODELING)) { dataFlowModelingButton.setEnabled(true); } else { @@ -128,7 +134,9 @@ private class ControlFlowDelegationButtonListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { + forbidReentry = true; editor.changeStage(Editor.STAGE_CONTROL_FLOW_DELEGATION); + forbidReentry = false; if (editor.canChange(Editor.STAGE_DATA_FLOW_MODELING)) { dataFlowModelingButton.setEnabled(true); } else {