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

Last change on this file since 1028 was 1028, checked in by fglaser, 12 years ago
  • The MFCLogParser has been adapted to the new generic GUIElementTree
File size: 2.6 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.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 */
30public 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<Long> 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<Long> 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<Long> getGUIElementTree() {
82        return guiElementTree;
83    }
84   
85}
Note: See TracBrowser for help on using the repository browser.