source: trunk/autoquest-plugin-mfc/src/main/java/de/ugoe/cs/autoquest/plugin/mfc/MessageHandler.java @ 927

Last change on this file since 927 was 927, checked in by sherbold, 12 years ago
  • added copyright under the Apache License, Version 2.0
File size: 2.5 KB
Line 
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
15package de.ugoe.cs.autoquest.plugin.mfc;
16
17import de.ugoe.cs.autoquest.plugin.mfc.guimodel.WindowTree;
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 * @version 1.0
28 */
29public class MessageHandler {
30
31    /**
32     * <p>
33     * during parsing, a tree of GUI elements is created and adapted.
34     * This is the reference to it.
35     * </p>
36     */
37    private WindowTree windowTree;
38
39    /**
40     * <p>
41     * Constructor. Protected to prohibit initialization of the base class itself.
42     * </p>
43     *
44     * @param windowTree the tree of GUI element specifications to be created and adapted during
45     *                   parsing
46     */
47    protected MessageHandler(WindowTree windowTree) {
48        this.windowTree = windowTree;
49    }
50
51    /**
52     * <p>
53     * Called in the startElement() method of the {@link MFCLogParser} when a msg-node begins.
54     * </p>
55     */
56    public void onStartElement() {}
57
58    /**
59     * <p>
60     * Called by the {@link MFCLogParser} to handle param-nodes.
61     * </p>
62     *
63     * @param name
64     *            name (type) of the parameter
65     * @param value
66     *            value of the parameter
67     */
68    public void onParameter(String name, String value) {}
69
70    /**
71     * <p>
72     * Called in the endElement() method of {@link MFCLogParser} when a msg-node ends.
73     * </p>
74     */
75    public void onEndElement() {}
76
77    /**
78     * @return the window tree created and adapted during parsing
79     */
80    protected WindowTree getWindowTree() {
81        return windowTree;
82    }
83   
84}
Note: See TracBrowser for help on using the repository browser.