diff --git a/AlgebraicDataflowArchitectureModel/src/application/views/NavigationWindow.java b/AlgebraicDataflowArchitectureModel/src/application/views/NavigationWindow.java index df44a0b..07787f9 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/views/NavigationWindow.java +++ b/AlgebraicDataflowArchitectureModel/src/application/views/NavigationWindow.java @@ -4,6 +4,8 @@ import application.editor.Editor; import application.editor.IStageChangeListener; import application.editor.Stage; +import application.editor.stages.DataFlowModelingStage; +import application.editor.stages.PushPullSelectionStage; import javax.swing.*; import java.awt.*; @@ -48,20 +50,35 @@ @Override public void stageChanged(Stage newStage) { - // TODO Implement + if (forbidReentry) { + return; + } + if (newStage instanceof DataFlowModelingStage) { + dataFlowModelingButton.setSelected(true); + pushPullSelectionButton.setEnabled(editor.canChange(Editor.STAGE_PUSH_PULL_SELECTION)); + } else if (newStage instanceof PushPullSelectionStage) { + pushPullSelectionButton.setSelected(true); + dataFlowModelingButton.setEnabled(editor.canChange(Editor.STAGE_DATA_FLOW_MODELING)); + } } private class DataFlowModelingButtonListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { - // TODO Implement + forbidReentry = true; + editor.changeStage(Editor.STAGE_DATA_FLOW_MODELING); + forbidReentry = false; + pushPullSelectionButton.setEnabled(editor.canChange(Editor.STAGE_PUSH_PULL_SELECTION)); } } private class PushPullSelectionButtonListener implements ActionListener { @Override public void actionPerformed(ActionEvent e) { - // TODO Implement + forbidReentry = true; + editor.changeStage(Editor.STAGE_PUSH_PULL_SELECTION); + forbidReentry = false; + dataFlowModelingButton.setEnabled(editor.canChange(Editor.STAGE_DATA_FLOW_MODELING)); } } }