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 |
|
---|
15 | package de.ugoe.cs.autoquest.plugin.mfc;
|
---|
16 |
|
---|
17 | import de.ugoe.cs.autoquest.eventcore.guimodel.GUIElementTree;
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * <p>
|
---|
21 | * Base class to define custom message handlers, for messages that shall be handled differently
|
---|
22 | * during the parsing of usage logs. It provides dummy implementations for all required methods,
|
---|
23 | * such that implementations can only overwrite the parts they actually require and ignore the rest.
|
---|
24 | * </p>
|
---|
25 | *
|
---|
26 | * @author Steffen Herbold
|
---|
27 | * @author Fabian Glaser
|
---|
28 | * @version 1.0
|
---|
29 | */
|
---|
30 | public class MessageHandler {
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * <p>
|
---|
34 | * during parsing, a tree of GUI elements is created and adapted.
|
---|
35 | * This is the reference to it.
|
---|
36 | * </p>
|
---|
37 | */
|
---|
38 | private GUIElementTree guiElementTree;
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * <p>
|
---|
42 | * Constructor. Protected to prohibit initialization of the base class itself.
|
---|
43 | * </p>
|
---|
44 | *
|
---|
45 | * @param guiElementTree the tree of GUI element specifications to be created and adapted during
|
---|
46 | * parsing
|
---|
47 | */
|
---|
48 | protected MessageHandler(GUIElementTree guiElementTree) {
|
---|
49 | this.guiElementTree = guiElementTree;
|
---|
50 | }
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * <p>
|
---|
54 | * Called in the startElement() method of the {@link MFCLogParser} when a msg-node begins.
|
---|
55 | * </p>
|
---|
56 | */
|
---|
57 | public void onStartElement() {}
|
---|
58 |
|
---|
59 | /**
|
---|
60 | * <p>
|
---|
61 | * Called by the {@link MFCLogParser} to handle param-nodes.
|
---|
62 | * </p>
|
---|
63 | *
|
---|
64 | * @param name
|
---|
65 | * name (type) of the parameter
|
---|
66 | * @param value
|
---|
67 | * value of the parameter
|
---|
68 | */
|
---|
69 | public void onParameter(String name, String value) {}
|
---|
70 |
|
---|
71 | /**
|
---|
72 | * <p>
|
---|
73 | * Called in the endElement() method of {@link MFCLogParser} when a msg-node ends.
|
---|
74 | * </p>
|
---|
75 | */
|
---|
76 | public void onEndElement() {}
|
---|
77 |
|
---|
78 | /**
|
---|
79 | * @return the gui element tree created and adapted during parsing
|
---|
80 | */
|
---|
81 | protected GUIElementTree getGUIElementTree() {
|
---|
82 | return guiElementTree;
|
---|
83 | }
|
---|
84 |
|
---|
85 | }
|
---|