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: /*
25: * Created on 20.05.2003
26: *
27: * To change the template for this generated file go to
28: * Window>Preferences>Java>Code Generation>Code and Comments
29: */
30: package jacareto.editor;
31:
32: import jacareto.struct.StructureElement;
33: import jacareto.system.Environment;
34: import jacareto.test.JMenuItemTest;
35:
36: import java.awt.event.ActionEvent;
37: import java.awt.event.ActionListener;
38:
39: import javax.swing.JCheckBox;
40:
41: /**
42: * This class is the editor class for <code>jacareto.test.JMenuItemTest</code> tests.
43: *
44: * @author <a href="mailto:coch@rbg.informatik.tu-darmstadt.de">Carola Coch</a>
45: * @version 1.0
46: */
47: public class JMenuItemTestEditor extends AbstractButtonTestEditor {
48: /** Whether or not the menu item is armed. */
49: protected JCheckBox chkArmed;
50:
51: /**
52: * Creates an editor with the specified env.
53: *
54: * @param env the environment
55: */
56: public JMenuItemTestEditor(Environment env) {
57: super (env);
58:
59: // The armed checkbox
60: c.gridx = 0;
61:
62: // increment y- position of superclass by one
63: c.gridy += 1;
64:
65: c.gridwidth = 2;
66: chkArmed = new JCheckBox(language
67: .getString("Tests.JMenuItemTest.Armed"));
68: chkArmed.addActionListener(new ActionListener() {
69: public void actionPerformed(ActionEvent e) {
70: if (isUpdateOnChange && (getElement() != null)) {
71: ((JMenuItemTest) getElement())
72: .setItemArmed(chkArmed.isSelected());
73: }
74: }
75: });
76: editorPanel.add(chkArmed, c);
77: }
78:
79: /**
80: * @see jacareto.editor.Editor#handlesElement(jacareto.struct.StructureElement)
81: */
82: public boolean handlesElement(StructureElement element) {
83: return (element != null) && (element instanceof JMenuItemTest);
84: }
85:
86: /**
87: * @see jacareto.editor.Editor#setElement(jacareto.struct.StructureElement)
88: */
89: public void setElement(StructureElement element) {
90: super .setElement(element);
91:
92: JMenuItemTest test = (JMenuItemTest) element;
93: chkArmed.setSelected(test.isItemArmed());
94: }
95: }
|