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

Last change on this file since 1084 was 1084, checked in by pharms, 11 years ago
  • forwarded problems in GUI element mapping to parser to allow better handling of this exception
File size: 2.7 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 org.xml.sax.SAXException;
18
19import de.ugoe.cs.autoquest.eventcore.guimodel.GUIElementTree;
20
21/**
22 * <p>
23 * Base class to define custom message handlers, for messages that shall be handled differently
24 * during the parsing of usage logs. It provides dummy implementations for all required methods,
25 * such that implementations can only overwrite the parts they actually require and ignore the rest.
26 * </p>
27 *
28 * @author Steffen Herbold
29 * @author Fabian Glaser
30 * @version 1.0
31 */
32public class MessageHandler {
33
34    /**
35     * <p>
36     * during parsing, a tree of GUI elements is created and adapted.
37     * This is the reference to it.
38     * </p>
39     */
40    private GUIElementTree<Long> guiElementTree;
41
42    /**
43     * <p>
44     * Constructor. Protected to prohibit initialization of the base class itself.
45     * </p>
46     *
47     * @param guiElementTree the tree of GUI element specifications to be created and adapted during
48     *                   parsing
49     */
50    protected MessageHandler(GUIElementTree<Long> guiElementTree) {
51        this.guiElementTree = guiElementTree;
52    }
53
54    /**
55     * <p>
56     * Called in the startElement() method of the {@link MFCLogParser} when a msg-node begins.
57     * </p>
58     */
59    public void onStartElement() {}
60
61    /**
62     * <p>
63     * Called by the {@link MFCLogParser} to handle param-nodes.
64     * </p>
65     *
66     * @param name
67     *            name (type) of the parameter
68     * @param value
69     *            value of the parameter
70     */
71    public void onParameter(String name, String value) {}
72
73    /**
74     * <p>
75     * Called in the endElement() method of {@link MFCLogParser} when a msg-node ends.
76     * </p>
77     *
78     * @throws SAXException if the msg-node could not be processed for some reason
79     */
80    public void onEndElement() throws SAXException {}
81
82    /**
83     * @return the gui element tree created and adapted during parsing
84     */
85    protected GUIElementTree<Long> getGUIElementTree() {
86        return guiElementTree;
87    }
88   
89}
Note: See TracBrowser for help on using the repository browser.