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