1 | package de.ugoe.cs.quest.plugin.mfc;
|
---|
2 |
|
---|
3 | import de.ugoe.cs.quest.plugin.mfc.guimodel.WindowTree;
|
---|
4 |
|
---|
5 | /**
|
---|
6 | * <p>
|
---|
7 | * Base class to define custom message handlers, for messages that shall be handled differently
|
---|
8 | * during the parsing of usage logs. It provides dummy implementations for all required methods,
|
---|
9 | * such that implementations can only overwrite the parts they actually require and ignore the rest.
|
---|
10 | * </p>
|
---|
11 | *
|
---|
12 | * @author Steffen Herbold
|
---|
13 | * @version 1.0
|
---|
14 | */
|
---|
15 | public class MessageHandler {
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * <p>
|
---|
19 | * during parsing, a tree of GUI elements is created and adapted.
|
---|
20 | * This is the reference to it.
|
---|
21 | * </p>
|
---|
22 | */
|
---|
23 | private WindowTree windowTree;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * <p>
|
---|
27 | * Constructor. Protected to prohibit initialization of the base class itself.
|
---|
28 | * </p>
|
---|
29 | *
|
---|
30 | * @param windowTree the tree of GUI element specifications to be created and adapted during
|
---|
31 | * parsing
|
---|
32 | */
|
---|
33 | protected MessageHandler(WindowTree windowTree) {
|
---|
34 | this.windowTree = windowTree;
|
---|
35 | }
|
---|
36 |
|
---|
37 | /**
|
---|
38 | * <p>
|
---|
39 | * Called in the startElement() method of the {@link MFCLogParser} when a msg-node begins.
|
---|
40 | * </p>
|
---|
41 | */
|
---|
42 | public void onStartElement() {}
|
---|
43 |
|
---|
44 | /**
|
---|
45 | * <p>
|
---|
46 | * Called by the {@link MFCLogParser} to handle param-nodes.
|
---|
47 | * </p>
|
---|
48 | *
|
---|
49 | * @param name
|
---|
50 | * name (type) of the parameter
|
---|
51 | * @param value
|
---|
52 | * value of the parameter
|
---|
53 | */
|
---|
54 | public void onParameter(String name, String value) {}
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * <p>
|
---|
58 | * Called in the endElement() method of {@link MFCLogParser} when a msg-node ends.
|
---|
59 | * </p>
|
---|
60 | */
|
---|
61 | public void onEndElement() {}
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * @return the window tree created and adapted during parsing
|
---|
65 | */
|
---|
66 | protected WindowTree getWindowTree() {
|
---|
67 | return windowTree;
|
---|
68 | }
|
---|
69 |
|
---|
70 | }
|
---|