| 1 | // Copyright © 2004-2006 University of Helsinki, Department of Computer Science | |
| 2 | // Copyright © 2012 various contributors | |
| 3 | // This software is released under GNU Lesser General Public License 2.1. | |
| 4 | // The license text is at http://www.gnu.org/licenses/lgpl-2.1.html | |
| 5 | ||
| 6 | package fi.helsinki.cs.titokone; | |
| 7 | ||
| 8 | import javax.swing.*; | |
| 9 | import java.awt.*; | |
| 10 | ||
| 11 | ||
| 12 | public class GUIRunSettingsDialog extends GUISettingsDialog { | |
| 13 | ||
| 14 | public JCheckBox lineByLineCheckBox; | |
| 15 | public JCheckBox showCommentsCheckBox; | |
| 16 | public JCheckBox showAnimationCheckBox; | |
| 17 | ||
| 18 | GUI ownerGUI; | |
| 19 | ||
| 20 | public static String APPLY = "GUIRunSettingsDialog_Apply"; | |
| 21 | ||
| 22 | public GUIRunSettingsDialog(Frame ownerFrame, boolean modal) { | |
| 23 | ||
| 24 | super(ownerFrame, modal); | |
| 25 | ||
| 26 | 1 | ownerGUI = (GUI) ownerFrame; |
| 27 | ||
| 28 | 1 | setTitle("Set running options"); |
| 29 | 5 | setSize(250, 180); |
| 30 | ||
| 31 | 2 | applyButton = new JButton("Apply"); |
| 32 | 2 | closeButton = new JButton("Close"); |
| 33 | ||
| 34 | 1 | applyButton.setActionCommand(APPLY); |
| 35 | 1 | applyButton.addActionListener(ownerGUI); |
| 36 | 1 | applyButton.addActionListener(applyButtonActionListener); |
| 37 | ||
| 38 | 1 | closeButton.addActionListener(closeButtonActionListener); |
| 39 | ||
| 40 | 1 | this.addComponentListener(settingsDialogListener); |
| 41 | ||
| 42 | ||
| 43 | 2 | lineByLineCheckBox = new JCheckBox("Execute line by line"); |
| 44 | 1 | lineByLineCheckBox.addChangeListener(stateChangeListener); |
| 45 | 2 | showCommentsCheckBox = new JCheckBox("Show comments"); |
| 46 | 1 | showCommentsCheckBox.addChangeListener(stateChangeListener); |
| 47 | 2 | showAnimationCheckBox = new JCheckBox("Show animation"); |
| 48 | 1 | showAnimationCheckBox.addChangeListener(stateChangeListener); |
| 49 | ||
| 50 | 3 | getContentPane().setLayout(new BorderLayout()); |
| 51 | ||
| 52 | 6 | JPanel checkBoxPanel = new JPanel(new GridLayout(3, 1)); |
| 53 | ||
| 54 | 1 | checkBoxPanel.add(lineByLineCheckBox); |
| 55 | 1 | checkBoxPanel.add(showCommentsCheckBox); |
| 56 | 1 | checkBoxPanel.add(showAnimationCheckBox); |
| 57 | ||
| 58 | 2 | JPanel buttonPanel = new JPanel(new FlowLayout()); |
| 59 | 1 | buttonPanel.add(applyButton); |
| 60 | 1 | buttonPanel.add(closeButton); |
| 61 | ||
| 62 | 2 | getContentPane().add(checkBoxPanel, BorderLayout.CENTER); |
| 63 | 2 | getContentPane().add(buttonPanel, BorderLayout.SOUTH); |
| 64 | ||
| 65 | 1 | pack(); |
| 66 | ||
| 67 | 3 | setDefaultCloseOperation(DISPOSE_ON_CLOSE); |
| 68 | ||
| 69 | } | |
| 70 | ||
| 71 | protected void checkCorrespondance(JCheckBox changee) { | |
| 72 | 2 | if (changee.isSelected()) {// Something was selected: animator -> line-by-line? |
| 73 | 4 | if (showAnimationCheckBox.isSelected() && !lineByLineCheckBox.isSelected()) { |
| 74 | 3 | lineByLineCheckBox.setSelected(true); |
| 75 | } | |
| 76 | } else // Something was unselected: !line-by-line -> !animator? | |
| 77 | 4 | if (showAnimationCheckBox.isSelected() && !lineByLineCheckBox.isSelected()) { |
| 78 | 3 | showAnimationCheckBox.setSelected(false); |
| 79 | } | |
| 80 | } | |
| 81 | ||
| 82 | public void updateAllTexts() { | |
| 83 | 3 | setTitle(new Message("Set running options").toString()); |
| 84 | 3 | lineByLineCheckBox.setText(new Message("Execute code line by line").toString()); |
| 85 | 3 | showCommentsCheckBox.setText(new Message("Show extra comments while executing").toString()); |
| 86 | 3 | showAnimationCheckBox.setText(new Message("Show animation while executing").toString()); |
| 87 | 3 | applyButton.setText(new Message("Apply").toString()); |
| 88 | 3 | closeButton.setText(new Message("Close").toString()); |
| 89 | 1 | pack(); |
| 90 | } | |
| 91 | ||
| 92 | } | |
Mutations | ||
| 26 |
Removed assignment to member variable ownerGUI : NO_COVERAGE |
|
| 28 |
removed call to fi/helsinki/cs/titokone/GUIRunSettingsDialog::setTitle : NO_COVERAGE |
|
| 29 |
removed call to fi/helsinki/cs/titokone/GUIRunSettingsDialog::setSize : NO_COVERAGE Replaced constant value of 180 with 181 : NO_COVERAGE Substituted 180 with 181 : NO_COVERAGE Substituted 250 with 251 : NO_COVERAGE Replaced constant value of 250 with 251 : NO_COVERAGE |
|
| 31 |
Removed assignment to member variable applyButton : NO_COVERAGE removed call to javax/swing/JButton::<init> : NO_COVERAGE |
|
| 32 |
removed call to javax/swing/JButton::<init> : NO_COVERAGE Removed assignment to member variable closeButton : NO_COVERAGE |
|
| 34 |
removed call to javax/swing/JButton::setActionCommand : NO_COVERAGE |
|
| 35 |
removed call to javax/swing/JButton::addActionListener : NO_COVERAGE |
|
| 36 |
removed call to javax/swing/JButton::addActionListener : NO_COVERAGE |
|
| 38 |
removed call to javax/swing/JButton::addActionListener : NO_COVERAGE |
|
| 40 |
removed call to fi/helsinki/cs/titokone/GUIRunSettingsDialog::addComponentListener : NO_COVERAGE |
|
| 43 |
Removed assignment to member variable lineByLineCheckBox : NO_COVERAGE removed call to javax/swing/JCheckBox::<init> : NO_COVERAGE |
|
| 44 |
removed call to javax/swing/JCheckBox::addChangeListener : NO_COVERAGE |
|
| 45 |
removed call to javax/swing/JCheckBox::<init> : NO_COVERAGE Removed assignment to member variable showCommentsCheckBox : NO_COVERAGE |
|
| 46 |
removed call to javax/swing/JCheckBox::addChangeListener : NO_COVERAGE |
|
| 47 |
removed call to javax/swing/JCheckBox::<init> : NO_COVERAGE Removed assignment to member variable showAnimationCheckBox : NO_COVERAGE |
|
| 48 |
removed call to javax/swing/JCheckBox::addChangeListener : NO_COVERAGE |
|
| 50 |
removed call to fi/helsinki/cs/titokone/GUIRunSettingsDialog::getContentPane : NO_COVERAGE removed call to java/awt/Container::setLayout : NO_COVERAGE removed call to java/awt/BorderLayout::<init> : NO_COVERAGE |
|
| 52 |
Substituted 1 with 0 : NO_COVERAGE removed call to java/awt/GridLayout::<init> : NO_COVERAGE removed call to javax/swing/JPanel::<init> : NO_COVERAGE Substituted 3 with 4 : NO_COVERAGE Substituted 3 with 4 : NO_COVERAGE Substituted 1 with 0 : NO_COVERAGE |
|
| 54 |
removed call to javax/swing/JPanel::add : NO_COVERAGE |
|
| 55 |
removed call to javax/swing/JPanel::add : NO_COVERAGE |
|
| 56 |
removed call to javax/swing/JPanel::add : NO_COVERAGE |
|
| 58 |
removed call to java/awt/FlowLayout::<init> : NO_COVERAGE removed call to javax/swing/JPanel::<init> : NO_COVERAGE |
|
| 59 |
removed call to javax/swing/JPanel::add : NO_COVERAGE |
|
| 60 |
removed call to javax/swing/JPanel::add : NO_COVERAGE |
|
| 62 |
removed call to fi/helsinki/cs/titokone/GUIRunSettingsDialog::getContentPane : NO_COVERAGE removed call to java/awt/Container::add : NO_COVERAGE |
|
| 63 |
removed call to java/awt/Container::add : NO_COVERAGE removed call to fi/helsinki/cs/titokone/GUIRunSettingsDialog::getContentPane : NO_COVERAGE |
|
| 65 |
removed call to fi/helsinki/cs/titokone/GUIRunSettingsDialog::pack : NO_COVERAGE |
|
| 67 |
Substituted 2 with 3 : NO_COVERAGE Substituted 2 with 3 : NO_COVERAGE removed call to fi/helsinki/cs/titokone/GUIRunSettingsDialog::setDefaultCloseOperation : NO_COVERAGE |
|
| 72 |
negated conditional : NO_COVERAGE removed call to javax/swing/JCheckBox::isSelected : NO_COVERAGE |
|
| 73 |
removed call to javax/swing/JCheckBox::isSelected : NO_COVERAGE removed call to javax/swing/JCheckBox::isSelected : NO_COVERAGE negated conditional : NO_COVERAGE negated conditional : NO_COVERAGE |
|
| 74 |
Substituted 1 with 0 : NO_COVERAGE Substituted 1 with 0 : NO_COVERAGE removed call to javax/swing/JCheckBox::setSelected : NO_COVERAGE |
|
| 77 |
negated conditional : NO_COVERAGE removed call to javax/swing/JCheckBox::isSelected : NO_COVERAGE removed call to javax/swing/JCheckBox::isSelected : NO_COVERAGE negated conditional : NO_COVERAGE |
|
| 78 |
removed call to javax/swing/JCheckBox::setSelected : NO_COVERAGE Substituted 0 with 1 : NO_COVERAGE Substituted 0 with 1 : NO_COVERAGE |
|
| 83 |
removed call to fi/helsinki/cs/titokone/Message::<init> : NO_COVERAGE removed call to fi/helsinki/cs/titokone/Message::toString : NO_COVERAGE removed call to fi/helsinki/cs/titokone/GUIRunSettingsDialog::setTitle : NO_COVERAGE |
|
| 84 |
removed call to fi/helsinki/cs/titokone/Message::toString : NO_COVERAGE removed call to javax/swing/JCheckBox::setText : NO_COVERAGE removed call to fi/helsinki/cs/titokone/Message::<init> : NO_COVERAGE |
|
| 85 |
removed call to fi/helsinki/cs/titokone/Message::toString : NO_COVERAGE removed call to fi/helsinki/cs/titokone/Message::<init> : NO_COVERAGE removed call to javax/swing/JCheckBox::setText : NO_COVERAGE |
|
| 86 |
removed call to javax/swing/JCheckBox::setText : NO_COVERAGE removed call to fi/helsinki/cs/titokone/Message::toString : NO_COVERAGE removed call to fi/helsinki/cs/titokone/Message::<init> : NO_COVERAGE |
|
| 87 |
removed call to fi/helsinki/cs/titokone/Message::<init> : NO_COVERAGE removed call to javax/swing/JButton::setText : NO_COVERAGE removed call to fi/helsinki/cs/titokone/Message::toString : NO_COVERAGE |
|
| 88 |
removed call to fi/helsinki/cs/titokone/Message::toString : NO_COVERAGE removed call to javax/swing/JButton::setText : NO_COVERAGE removed call to fi/helsinki/cs/titokone/Message::<init> : NO_COVERAGE |
|
| 89 |
removed call to fi/helsinki/cs/titokone/GUIRunSettingsDialog::pack : NO_COVERAGE |