source: trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/HandlerSetText.java @ 619

Last change on this file since 619 was 619, checked in by pharms, 12 years ago
  • adapted implementation to now generate a full GUI model as well as concrete GUI interaction events
File size: 1.7 KB
Line 
1
2package de.ugoe.cs.quest.plugin.mfc;
3
4import de.ugoe.cs.quest.plugin.mfc.guimodel.WindowTree;
5
6/**
7 * <p>
8 * Handles {@code WM_SETTEXT} messages. Handler maintains the {@link WindowTree}.
9 * </p>
10 *
11 * @author Steffen Herbold
12 * @version 1.0
13 */
14public class HandlerSetText extends MessageHandler {
15
16    /**
17     * <p>
18     * Constructor. Creates a new HanderSetText.
19     * </p>
20     *
21     * @param windowTree
22     *            the tree of GUI element specifications to be created and adapted during parsing
23     */
24    public HandlerSetText(WindowTree windowTree) {
25        super(windowTree);
26    }
27
28    /**
29     * <p>
30     * New name of the window.
31     * </p>
32     */
33    private String windowName;
34
35    /**
36     * <p>
37     * HWND of the window.
38     * </p>
39     */
40    private long hwnd;
41
42    /*
43     * (non-Javadoc)
44     *
45     * @see de.ugoe.cs.quest.plugin.mfc.MessageHandler#onEndElement()
46     */
47    @Override
48    public void onEndElement() {
49        if (hwnd != 0) {
50            super.getWindowTree().setName(hwnd, windowName);
51        }
52    }
53
54    /*
55     * (non-Javadoc)
56     *
57     * @see de.ugoe.cs.quest.plugin.mfc.MessageHandler#onParameter(java.lang.String ,
58     * java.lang.String)
59     */
60    @Override
61    public void onParameter(String name, String value) {
62        if (name.equals("window.hwnd")) {
63            hwnd = Long.parseLong(value);
64        }
65        else if (name.equals("window.newText")) {
66            windowName = value;
67        }
68    }
69
70    /*
71     * (non-Javadoc)
72     *
73     * @see de.ugoe.cs.quest.plugin.mfc.MessageHandler#onStartElement()
74     */
75    @Override
76    public void onStartElement() {
77        windowName = "";
78        hwnd = 0;
79    }
80}
Note: See TracBrowser for help on using the repository browser.