01: /*
02: * Jacareto Copyright (c) 2002-2005
03: * Applied Computer Science Research Group, Darmstadt University of
04: * Technology, Institute of Mathematics & Computer Science,
05: * Ludwigsburg University of Education, and Computer Based
06: * Learning Research Group, Aachen University. All rights reserved.
07: *
08: * Jacareto is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU General Public
10: * License as published by the Free Software Foundation; either
11: * version 2 of the License, or (at your option) any later version.
12: *
13: * Jacareto is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: * General Public License for more details.
17: *
18: * You should have received a copy of the GNU General Public
19: * License along with Jacareto; if not, write to the Free
20: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21: *
22: */
23:
24: package jacareto.editor;
25:
26: import jacareto.struct.StructureElement;
27: import jacareto.system.Environment;
28: import jacareto.test.JRadioButtonMenuItemTest;
29:
30: import java.awt.event.ActionEvent;
31: import java.awt.event.ActionListener;
32:
33: import javax.swing.JCheckBox;
34:
35: /**
36: * This class is the editor class for <code>jacareto.test.JRadioButtonMenuItemTest</code> tests.
37: *
38: * @author <a href="mailto:coch@rbg.informatik.tu-darmstadt.de">Carola Coch</a>
39: * @version 1.0
40: */
41: public class JRadioButtonMenuItemTestEditor extends JMenuItemTestEditor {
42: /** Whether or not the radio button menu item is selected. */
43: protected JCheckBox chkSelected;
44:
45: /**
46: * Creates an editor with the specified env.
47: *
48: * @param env the environment
49: */
50: public JRadioButtonMenuItemTestEditor(Environment env) {
51: super (env);
52:
53: c.gridx = 0;
54: c.gridy += 1;
55: c.gridwidth = 2;
56: chkSelected = new JCheckBox(language
57: .getString("Tests.JCheckBoxMenuItemTest.Selected"));
58: chkSelected.addActionListener(new ActionListener() {
59: public void actionPerformed(ActionEvent e) {
60: if (isUpdateOnChange && (getElement() != null)) {
61: ((JRadioButtonMenuItemTest) getElement())
62: .setSelected(chkSelected.isSelected());
63: }
64: }
65: });
66: editorPanel.add(chkSelected, c);
67: }
68:
69: public boolean handlesElement(StructureElement element) {
70: return (element != null)
71: && (element instanceof JRadioButtonMenuItemTest);
72: }
73:
74: /**
75: * @see jacareto.editor.Editor#setElement(jacareto.struct.StructureElement)
76: */
77: public void setElement(StructureElement element) {
78: super .setElement(element);
79:
80: JRadioButtonMenuItemTest test = (JRadioButtonMenuItemTest) element;
81: chkSelected.setSelected(test.isSelected());
82: }
83: }
|