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.cleverphl.menu;
25:
26: import jacareto.cleverphl.CleverPHL;
27: import jacareto.cleverphl.session.Session;
28: import jacareto.comp.Components;
29: import jacareto.comp.select.ComponentSelection;
30: import jacareto.record.ComponentPropertiesRecordable;
31: import jacareto.system.Environment;
32:
33: import java.awt.event.ActionEvent;
34:
35: /**
36: * Enables all selected components.
37: *
38: * @author <a href="mailto:cspannagel@web.de">Christian Spannagel</a>
39: * @version 1.01
40: */
41: public class EnableComponents extends CleverPHLAction {
42: /**
43: * Creates a new instance.
44: *
45: * @param cleverPHL the CleverPHL instance
46: */
47: public EnableComponents(CleverPHL cleverPHL) {
48: super (cleverPHL);
49: applyCustomization("CleverPHL.Menu.EnableComponents");
50: }
51:
52: /**
53: * Called when this action should be performed.
54: *
55: * @param e the action event
56: */
57: public void actionPerformed(ActionEvent e) {
58: Environment env = getEnvironment();
59: Session session = getCleverPHL().getSessionList().getActual();
60: Components components = session.getComponents();
61: ComponentSelection selection = components
62: .getComponentSelection();
63: java.awt.Component[] selectedComponents = selection
64: .getComponents();
65:
66: for (int i = 0; i < selectedComponents.length; i++) {
67: String componentName = components
68: .getName(selectedComponents[i]);
69: ComponentPropertiesRecordable recordable = new ComponentPropertiesRecordable(
70: env, componentName, true, true, true, false, false);
71: recordable.apply(selectedComponents[i], components);
72: session.insertRecordable(recordable);
73: }
74: }
75: }
|