diff --git a/AlgebraicDataflowArchitectureModel/src/application/ApplicationMenuBar.java b/AlgebraicDataflowArchitectureModel/src/application/ApplicationMenuBar.java index c837ba4..95b0b7f 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/ApplicationMenuBar.java +++ b/AlgebraicDataflowArchitectureModel/src/application/ApplicationMenuBar.java @@ -27,8 +27,6 @@ public class ApplicationMenuBar extends JMenuBar { private static final long serialVersionUID = 4811536194182272888L; - private Editor editor = null; - private ApplicationWindow applicationWindow = null; private NewResourceAction newResourceAction = null; @@ -44,7 +42,6 @@ public ApplicationMenuBar(ApplicationWindow applicationWindow) { this.applicationWindow = applicationWindow; - this.editor = editor; JMenu newMenu = new JMenu("New"); newMenu.add(new NewModelAction(applicationWindow)); diff --git a/AlgebraicDataflowArchitectureModel/src/application/ApplicationWindow.java b/AlgebraicDataflowArchitectureModel/src/application/ApplicationWindow.java index 0e7b5d5..4611a57 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/ApplicationWindow.java +++ b/AlgebraicDataflowArchitectureModel/src/application/ApplicationWindow.java @@ -9,8 +9,14 @@ import application.editor.Editor; import application.views.NavigationWindow; -import application.views.controlFlowDelegation.ShowFlowLayerWindow; +import application.views.controlFlowDelegation.FlowLayerWindow; +/** + * Application main window + * + * @author Nitta + * + */ public class ApplicationWindow extends JFrame { private static final long serialVersionUID = -8690140317781055614L; public static final String title = "Visual Modeling Tool"; @@ -21,7 +27,7 @@ private ApplicationMenuBar menuBar = null; private NavigationWindow navigationWindow = null; - private ShowFlowLayerWindow showFlowLayerWindow = null; + private FlowLayerWindow showFlowLayerWindow = null; public ApplicationWindow() { setTitle(title); @@ -55,7 +61,7 @@ navigationWindow = new NavigationWindow(this, editor); navigationWindow.setVisible(true); - showFlowLayerWindow = new ShowFlowLayerWindow(this); + showFlowLayerWindow = new FlowLayerWindow(this); showFlowLayerWindow.setVisible(false); editor.addStageChangeListener(navigationWindow); diff --git a/AlgebraicDataflowArchitectureModel/src/application/actions/ShowSwitchLayerWindowAction.java b/AlgebraicDataflowArchitectureModel/src/application/actions/ShowSwitchLayerWindowAction.java index b137463..9a68279 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/actions/ShowSwitchLayerWindowAction.java +++ b/AlgebraicDataflowArchitectureModel/src/application/actions/ShowSwitchLayerWindowAction.java @@ -6,7 +6,7 @@ public class ShowSwitchLayerWindowAction extends AbstractSystemAction { public ShowSwitchLayerWindowAction(ApplicationWindow frame) { - super("Show Flow", frame); + super("Show Flow Layer", frame); } @Override diff --git a/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java b/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java index 1f2eda4..ff8dc0d 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java +++ b/AlgebraicDataflowArchitectureModel/src/application/editor/Editor.java @@ -53,6 +53,12 @@ import parser.exceptions.WrongRHSExpression; import parser.ParserDTRAM; +/** + * Main editor for all stages + * + * @author Nitta + * + */ public class Editor { public DataTransferModel model = null; public mxGraph graph = null; diff --git a/AlgebraicDataflowArchitectureModel/src/application/layouts/DAGLayout.java b/AlgebraicDataflowArchitectureModel/src/application/layouts/DAGLayout.java index 0389845..23ae67e 100644 --- a/AlgebraicDataflowArchitectureModel/src/application/layouts/DAGLayout.java +++ b/AlgebraicDataflowArchitectureModel/src/application/layouts/DAGLayout.java @@ -29,10 +29,10 @@ * [ *constructor] /************************************************************* * - * @param cell + * @param graph */ - public DAGLayout(mxGraph cell) { - super(cell); + public DAGLayout(mxGraph graph) { + super(graph); } /************************************************************* @@ -65,7 +65,6 @@ } } - // ���בւ� sort(map, 0, false); // layout diff --git a/AlgebraicDataflowArchitectureModel/src/application/views/controlFlowDelegation/FlowLayerWindow.java b/AlgebraicDataflowArchitectureModel/src/application/views/controlFlowDelegation/FlowLayerWindow.java new file mode 100644 index 0000000..18f9c69 --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/src/application/views/controlFlowDelegation/FlowLayerWindow.java @@ -0,0 +1,106 @@ +package application.views.controlFlowDelegation; + +import java.awt.Container; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JCheckBox; +import javax.swing.JDialog; + +import application.ApplicationWindow; +import application.editor.Editor; +import application.editor.IStageChangeListener; +import application.editor.Stage; +import application.editor.stages.ControlFlowDelegationStage; + +/************************************************************* + * Window to change visibility of layers for the control-flow-modeling. + */ +public class FlowLayerWindow extends JDialog implements IStageChangeListener { + private String title = "Flow Layer"; + private JCheckBox dataFlowCheckBox = null; + private JCheckBox pushFlowCheckBox = null; + private JCheckBox pullFlowCheckBox = null; + + private ControlFlowDelegationStage stage = null; + + /************************************************************* + * [ *constructor ] + /************************************************************* + * + */ + public FlowLayerWindow(final ApplicationWindow owner) { + super(owner); + + setTitle(title); + setDefaultCloseOperation(HIDE_ON_CLOSE); + + stage = Editor.STAGE_CONTROL_FLOW_DELEGATION; + + // initialize buttons + dataFlowCheckBox = new JCheckBox("Data-Flow", false); + pushFlowCheckBox = new JCheckBox("Push-Flow", true); + pullFlowCheckBox = new JCheckBox("Pull-Flow", true); + + // each add handler + dataFlowCheckBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + stage.setEnabledForLayer(Stage.DATA_FLOW_LAYER, dataFlowCheckBox.isSelected()); + }}); + + pushFlowCheckBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + stage.setEnabledForLayer(Stage.PUSH_FLOW_LAYER, pushFlowCheckBox.isSelected()); + }}); + + pullFlowCheckBox.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + stage.setEnabledForLayer(Stage.PULL_FLOW_LAYER, pullFlowCheckBox.isSelected()); + }}); + + dataFlowCheckBox.setEnabled(false); + pushFlowCheckBox.setEnabled(false); + pullFlowCheckBox.setEnabled(false); + + // initialize panel + Container panel = getContentPane(); + panel.setLayout(new GridLayout(/*low*/3, /*col*/1)); + panel.add(dataFlowCheckBox); + panel.add(pushFlowCheckBox); + panel.add(pullFlowCheckBox); + + pack(); + setResizable(false); + } + + /************************************************************* + * [ *public ] + /************************************************************* + * + */ + @Override + public void stageChanged(Stage newStage) { + if((newStage instanceof ControlFlowDelegationStage)) { + + dataFlowCheckBox.setEnabled(true); + pushFlowCheckBox.setEnabled(true); + pullFlowCheckBox.setEnabled(true); + + newStage.setEnabledForLayer(Stage.PUSH_FLOW_LAYER, pushFlowCheckBox.isSelected()); + newStage.setEnabledForLayer(Stage.PULL_FLOW_LAYER, pullFlowCheckBox.isSelected()); + } + else { + dataFlowCheckBox.setEnabled(false); + pushFlowCheckBox.setEnabled(false); + pullFlowCheckBox.setEnabled(false); + + newStage.setEnabledForLayer(Stage.PUSH_FLOW_LAYER, false); + newStage.setEnabledForLayer(Stage.PULL_FLOW_LAYER, false); + } + } +} + diff --git a/AlgebraicDataflowArchitectureModel/src/application/views/controlFlowDelegation/ShowFlowLayerWindow.java b/AlgebraicDataflowArchitectureModel/src/application/views/controlFlowDelegation/ShowFlowLayerWindow.java deleted file mode 100644 index 230504c..0000000 --- a/AlgebraicDataflowArchitectureModel/src/application/views/controlFlowDelegation/ShowFlowLayerWindow.java +++ /dev/null @@ -1,106 +0,0 @@ -package application.views.controlFlowDelegation; - -import java.awt.Container; -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.JCheckBox; -import javax.swing.JDialog; - -import application.ApplicationWindow; -import application.editor.Editor; -import application.editor.IStageChangeListener; -import application.editor.Stage; -import application.editor.stages.ControlFlowDelegationStage; - -/************************************************************* - * the window has a button group for swichting layers in the control-flow-modeling. - */ -public class ShowFlowLayerWindow extends JDialog implements IStageChangeListener { - private String title = "ShowFlowLayerWindow"; - private JCheckBox dataFlowCheckBox = null; - private JCheckBox pushFlowCheckBox = null; - private JCheckBox pullFlowCheckBox = null; - - private ControlFlowDelegationStage stage = null; - - /************************************************************* - * [ *constructor ] - /************************************************************* - * - */ - public ShowFlowLayerWindow(final ApplicationWindow owner) { - super(owner); - - setTitle(title); - setDefaultCloseOperation(HIDE_ON_CLOSE); - - stage = Editor.STAGE_CONTROL_FLOW_DELEGATION; - - // initialize buttons - dataFlowCheckBox = new JCheckBox("Data-Flow", false); - pushFlowCheckBox = new JCheckBox("Push-Flow", true); - pullFlowCheckBox = new JCheckBox("Pull-Flow", true); - - // each add handler - dataFlowCheckBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - stage.setEnabledForLayer(Stage.DATA_FLOW_LAYER, dataFlowCheckBox.isSelected()); - }}); - - pushFlowCheckBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - stage.setEnabledForLayer(Stage.PUSH_FLOW_LAYER, pushFlowCheckBox.isSelected()); - }}); - - pullFlowCheckBox.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - stage.setEnabledForLayer(Stage.PULL_FLOW_LAYER, pullFlowCheckBox.isSelected()); - }}); - - dataFlowCheckBox.setEnabled(false); - pushFlowCheckBox.setEnabled(false); - pullFlowCheckBox.setEnabled(false); - - // initialize panel - Container panel = getContentPane(); - panel.setLayout(new GridLayout(/*low*/3, /*col*/1)); - panel.add(dataFlowCheckBox); - panel.add(pushFlowCheckBox); - panel.add(pullFlowCheckBox); - - pack(); - setResizable(false); - } - - /************************************************************* - * [ *public ] - /************************************************************* - * - */ - @Override - public void stageChanged(Stage newStage) { - if((newStage instanceof ControlFlowDelegationStage)) { - - dataFlowCheckBox.setEnabled(true); - pushFlowCheckBox.setEnabled(true); - pullFlowCheckBox.setEnabled(true); - - newStage.setEnabledForLayer(Stage.PUSH_FLOW_LAYER, pushFlowCheckBox.isSelected()); - newStage.setEnabledForLayer(Stage.PULL_FLOW_LAYER, pullFlowCheckBox.isSelected()); - } - else { - dataFlowCheckBox.setEnabled(false); - pushFlowCheckBox.setEnabled(false); - pullFlowCheckBox.setEnabled(false); - - newStage.setEnabledForLayer(Stage.PUSH_FLOW_LAYER, false); - newStage.setEnabledForLayer(Stage.PULL_FLOW_LAYER, false); - } - } -} -