source: trunk/autoquest-plugin-mfc/src/main/java/de/ugoe/cs/autoquest/plugin/mfc/HandlerDestroy.java @ 1008

Last change on this file since 1008 was 1008, checked in by fglaser, 12 years ago
  • autoquest-plugin-mfc subproject refactored to use GUI element naming convention were appropriate
  • MFCWindowTree marked as deprecated (one should use generalized GUIElementTree instead)
File size: 2.2 KB
Line 
1//   Copyright 2012 Georg-August-Universität Göttingen, Germany
2//
3//   Licensed under the Apache License, Version 2.0 (the "License");
4//   you may not use this file except in compliance with the License.
5//   You may obtain a copy of the License at
6//
7//       http://www.apache.org/licenses/LICENSE-2.0
8//
9//   Unless required by applicable law or agreed to in writing, software
10//   distributed under the License is distributed on an "AS IS" BASIS,
11//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//   See the License for the specific language governing permissions and
13//   limitations under the License.
14
15package de.ugoe.cs.autoquest.plugin.mfc;
16
17import de.ugoe.cs.autoquest.eventcore.guimodel.GUIElementTree;
18
19/**
20 * <p>
21 * Handler for {@code WM_DESTROY} message. The handler maintains the {@link GUIElementTree}.
22 * </p>
23 *
24 * @author Steffen Herbold
25 * @author Fabian Glaser
26 * @version 1.0
27 */
28public class HandlerDestroy extends MessageHandler {
29
30    /**
31     * <p>
32     * Constructor. Creates a new HandlerDestroy.
33     * </p>
34     *
35     * @param guiElementTree
36     *            the tree of GUI element specifications to be created and adapted during parsing
37     */
38    public HandlerDestroy(GUIElementTree guiElementTree) {
39        super(guiElementTree);
40    }
41
42    /**
43     * <p>
44     * HWND of the GUI element that is destroyed.
45     * </p>
46     */
47    private long hwnd;
48
49    /*
50     * (non-Javadoc)
51     *
52     * @see de.ugoe.cs.autoquest.plugin.mfc.MessageHandler#onEndElement()
53     */
54    @Override
55    public void onEndElement() {
56        if (hwnd != 0) {
57            super.getGUIElementTree().remove(hwnd);
58        }
59    }
60
61    /*
62     * (non-Javadoc)
63     *
64     * @see de.ugoe.cs.autoquest.plugin.mfc.MessageHandler#onParameter(java.lang.String ,
65     * java.lang.String)
66     */
67    @Override
68    public void onParameter(String name, String value) {
69        if (name.equals("window.hwnd")) {
70            hwnd = Long.parseLong(value);
71        }
72    }
73
74    /*
75     * (non-Javadoc)
76     *
77     * @see de.ugoe.cs.autoquest.plugin.mfc.MessageHandler#onStartElement()
78     */
79    @Override
80    public void onStartElement() {
81        hwnd = 0;
82    }
83
84}
Note: See TracBrowser for help on using the repository browser.