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.eventmask.AWTEventMaskGroup;
29: import jacareto.eventmask.ComponentEventMask;
30:
31: import java.awt.event.ActionEvent;
32:
33: import javax.swing.JCheckBoxMenuItem;
34:
35: /**
36: * The menu item for enabling and disabling the capturing of window moving / resizing.
37: *
38: * @author <a href="mailto:cspannagel@web.de">Christian Spannagel</a>
39: * @version 1.0
40: */
41: public class CaptureWindowMovingResizing extends CleverPHLAction {
42: /**
43: * Creates a new instance.
44: *
45: * @param cleverPHL the CleverPHL instance
46: */
47: public CaptureWindowMovingResizing(CleverPHL cleverPHL) {
48: super (cleverPHL);
49: applyCustomization("CleverPHL.Menu.CaptureWindowMovingResizing");
50: }
51:
52: /**
53: * Opens the dialog.
54: *
55: * @param e DOCUMENT ME!
56: */
57: public void actionPerformed(ActionEvent e) {
58: JCheckBoxMenuItem checkbox = (JCheckBoxMenuItem) getCleverPHL()
59: .getMainFrame().getCleverPHLMenuBar().getMenuItem(
60: "CleverPHL.Menu.CaptureWindowMovingResizing");
61: boolean capture = checkbox.isSelected();
62: getCustomization().put("WindowMovingResizing.Capture", capture);
63:
64: Session session = getCleverPHL().getSessionList().getActual();
65: AWTEventMaskGroup eventMask = session.getEventMask();
66: eventMask.removeMask("jacareto.eventmask.ComponentEventMask");
67:
68: if (capture) {
69: eventMask.addMask(new ComponentEventMask(getEnvironment()));
70: }
71: }
72: }
|