Line | |
---|
1 | package de.ugoe.cs.eventbench.messagehandler;
|
---|
2 |
|
---|
3 | import de.ugoe.cs.eventbench.data.WindowTree;
|
---|
4 |
|
---|
5 | public class HandlerCreate extends MessageHandler {
|
---|
6 |
|
---|
7 | public HandlerCreate() {
|
---|
8 | super();
|
---|
9 | }
|
---|
10 |
|
---|
11 | private String windowName;
|
---|
12 | private int hwnd;
|
---|
13 | private int parentHwnd;
|
---|
14 | private int resourceId;
|
---|
15 | private String className;
|
---|
16 | private boolean isModal;
|
---|
17 |
|
---|
18 | @Override
|
---|
19 | public void onEndElement() {
|
---|
20 | if( hwnd!=0 ) {
|
---|
21 | WindowTree.getInstance().add(parentHwnd, hwnd, windowName, resourceId, className, isModal);
|
---|
22 | }
|
---|
23 | }
|
---|
24 |
|
---|
25 | @Override
|
---|
26 | public void onParameter(String name, String value) {
|
---|
27 | if( name.equals("window.hwnd") ) {
|
---|
28 | hwnd = Integer.parseInt(value);
|
---|
29 | }
|
---|
30 | else if( name.equals("window.name") ) {
|
---|
31 | windowName = value;
|
---|
32 | }
|
---|
33 | else if( name.equals("window.parent.hwnd") ) {
|
---|
34 | parentHwnd = Integer.parseInt(value);
|
---|
35 | }
|
---|
36 | else if( name.equals("window.resourceId") ) {
|
---|
37 | resourceId = Integer.parseInt(value);
|
---|
38 | }
|
---|
39 | else if( name.equals("window.class") ) {
|
---|
40 | if( value.startsWith("Afx:") ) {
|
---|
41 | className = "Afx:";
|
---|
42 | } else {
|
---|
43 | className = value;
|
---|
44 | }
|
---|
45 | }
|
---|
46 | else if( name.equals("window.ismodal") ) {
|
---|
47 | if( value.equals("true") || value.equals("1") ) {
|
---|
48 | isModal = true;
|
---|
49 | }
|
---|
50 | }
|
---|
51 | }
|
---|
52 |
|
---|
53 | @Override
|
---|
54 | public void onStartElement() {
|
---|
55 | windowName = "";
|
---|
56 | hwnd = 0;
|
---|
57 | parentHwnd = 0;
|
---|
58 | resourceId = 0;
|
---|
59 | className = "";
|
---|
60 | isModal = false;
|
---|
61 | }
|
---|
62 |
|
---|
63 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.