Line | |
---|
1 | package de.ugoe.cs.eventbench.windows;
|
---|
2 |
|
---|
3 | import de.ugoe.cs.eventbench.windows.data.WindowTree;
|
---|
4 | import de.ugoe.cs.eventbench.windows.data.WindowTreeNode;
|
---|
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 | */
|
---|
14 | public class HandlerSetText extends MessageHandler {
|
---|
15 |
|
---|
16 | /**
|
---|
17 | * <p>
|
---|
18 | * Constructor. Creates a new HanderSetText.
|
---|
19 | * </p>
|
---|
20 | */
|
---|
21 | public HandlerSetText() {
|
---|
22 | super();
|
---|
23 | }
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * <p>
|
---|
27 | * New name of the window.
|
---|
28 | * </p>
|
---|
29 | */
|
---|
30 | private String windowName;
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * <p>
|
---|
34 | * HWND of the window.
|
---|
35 | * </p>
|
---|
36 | */
|
---|
37 | private int hwnd;
|
---|
38 |
|
---|
39 | /*
|
---|
40 | * (non-Javadoc)
|
---|
41 | *
|
---|
42 | * @see de.ugoe.cs.eventbench.windows.MessageHandler#onEndElement()
|
---|
43 | */
|
---|
44 | @Override
|
---|
45 | public void onEndElement() {
|
---|
46 | if (hwnd != 0) {
|
---|
47 | WindowTreeNode node = WindowTree.getInstance().find(hwnd);
|
---|
48 | node.setName(windowName);
|
---|
49 | }
|
---|
50 | }
|
---|
51 |
|
---|
52 | /*
|
---|
53 | * (non-Javadoc)
|
---|
54 | *
|
---|
55 | * @see
|
---|
56 | * de.ugoe.cs.eventbench.windows.MessageHandler#onParameter(java.lang.String
|
---|
57 | * , java.lang.String)
|
---|
58 | */
|
---|
59 | @Override
|
---|
60 | public void onParameter(String name, String value) {
|
---|
61 | if (name.equals("window.hwnd")) {
|
---|
62 | hwnd = Integer.parseInt(value);
|
---|
63 | } else if (name.equals("window.newText")) {
|
---|
64 | windowName = value;
|
---|
65 | }
|
---|
66 | }
|
---|
67 |
|
---|
68 | /*
|
---|
69 | * (non-Javadoc)
|
---|
70 | *
|
---|
71 | * @see de.ugoe.cs.eventbench.windows.MessageHandler#onStartElement()
|
---|
72 | */
|
---|
73 | @Override
|
---|
74 | public void onStartElement() {
|
---|
75 | windowName = "";
|
---|
76 | hwnd = 0;
|
---|
77 | }
|
---|
78 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.