[927] | 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 |
|
---|
[922] | 15 | package de.ugoe.cs.autoquest.plugin.mfc;
|
---|
[1] | 16 |
|
---|
[940] | 17 | import de.ugoe.cs.autoquest.plugin.mfc.guimodel.MFCWindowTree;
|
---|
[1] | 18 |
|
---|
[171] | 19 | /**
|
---|
| 20 | * <p>
|
---|
[940] | 21 | * Handles {@code WM_SETTEXT} messages. Handler maintains the {@link MFCWindowTree}.
|
---|
[171] | 22 | * </p>
|
---|
| 23 | *
|
---|
| 24 | * @author Steffen Herbold
|
---|
| 25 | * @version 1.0
|
---|
| 26 | */
|
---|
[1] | 27 | public class HandlerSetText extends MessageHandler {
|
---|
| 28 |
|
---|
[619] | 29 | /**
|
---|
| 30 | * <p>
|
---|
| 31 | * Constructor. Creates a new HanderSetText.
|
---|
| 32 | * </p>
|
---|
| 33 | *
|
---|
| 34 | * @param windowTree
|
---|
| 35 | * the tree of GUI element specifications to be created and adapted during parsing
|
---|
| 36 | */
|
---|
[940] | 37 | public HandlerSetText(MFCWindowTree windowTree) {
|
---|
[619] | 38 | super(windowTree);
|
---|
| 39 | }
|
---|
[1] | 40 |
|
---|
[619] | 41 | /**
|
---|
| 42 | * <p>
|
---|
| 43 | * New name of the window.
|
---|
| 44 | * </p>
|
---|
| 45 | */
|
---|
| 46 | private String windowName;
|
---|
[171] | 47 |
|
---|
[619] | 48 | /**
|
---|
| 49 | * <p>
|
---|
| 50 | * HWND of the window.
|
---|
| 51 | * </p>
|
---|
| 52 | */
|
---|
| 53 | private long hwnd;
|
---|
[1] | 54 |
|
---|
[619] | 55 | /*
|
---|
| 56 | * (non-Javadoc)
|
---|
| 57 | *
|
---|
[922] | 58 | * @see de.ugoe.cs.autoquest.plugin.mfc.MessageHandler#onEndElement()
|
---|
[619] | 59 | */
|
---|
| 60 | @Override
|
---|
| 61 | public void onEndElement() {
|
---|
| 62 | if (hwnd != 0) {
|
---|
| 63 | super.getWindowTree().setName(hwnd, windowName);
|
---|
| 64 | }
|
---|
| 65 | }
|
---|
[1] | 66 |
|
---|
[619] | 67 | /*
|
---|
| 68 | * (non-Javadoc)
|
---|
| 69 | *
|
---|
[922] | 70 | * @see de.ugoe.cs.autoquest.plugin.mfc.MessageHandler#onParameter(java.lang.String ,
|
---|
[619] | 71 | * java.lang.String)
|
---|
| 72 | */
|
---|
| 73 | @Override
|
---|
| 74 | public void onParameter(String name, String value) {
|
---|
| 75 | if (name.equals("window.hwnd")) {
|
---|
| 76 | hwnd = Long.parseLong(value);
|
---|
| 77 | }
|
---|
| 78 | else if (name.equals("window.newText")) {
|
---|
| 79 | windowName = value;
|
---|
| 80 | }
|
---|
| 81 | }
|
---|
[1] | 82 |
|
---|
[619] | 83 | /*
|
---|
| 84 | * (non-Javadoc)
|
---|
| 85 | *
|
---|
[922] | 86 | * @see de.ugoe.cs.autoquest.plugin.mfc.MessageHandler#onStartElement()
|
---|
[619] | 87 | */
|
---|
| 88 | @Override
|
---|
| 89 | public void onStartElement() {
|
---|
| 90 | windowName = "";
|
---|
| 91 | hwnd = 0;
|
---|
| 92 | }
|
---|
[1] | 93 | }
|
---|