source: trunk/autoquest-core-events/src/main/java/de/ugoe/cs/autoquest/eventcore/guimodel/AbstractDefaultGUIElement.java @ 2252

Last change on this file since 2252 was 2146, checked in by pharms, 7 years ago
  • refactored GUI model so that hierarchical event target structures can also be used and created by plugins not being strictly for GUIs
  • Property svn:executable set to *
File size: 3.1 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.eventcore.guimodel;
16
17import de.ugoe.cs.autoquest.eventcore.AbstractDefaultHierarchicalEventTarget;
18
19/**
20 * <p>
21 * Skeletal implementation for GUI elements.
22 * </p>
23 *
24 * @version 1.0
25 * @author Patrick Harms
26 */
27public abstract class AbstractDefaultGUIElement extends AbstractDefaultHierarchicalEventTarget
28    implements IGUIElement
29{
30
31    /**
32     * <p>
33     * Id for object serialization.
34     * </p>
35     */
36    public static final long serialVersionUID = 1L;
37   
38    /**
39     * <p>
40     * Boolean that indicates if a GUIElement was used during a session.
41     * </p>
42     */
43    private boolean usageObserved;
44
45    /**
46     * <p>
47     * Constructor. Creates a new AbstractDefaultGUIElement.
48     * </p>
49     *
50     * @param specification
51     *            specification of the created GUI element
52     * @param parent
53     *            parent of the created GUI element; null means the element is a top-level window
54     */
55    public AbstractDefaultGUIElement(IGUIElementSpec specification, IGUIElement parent) {
56        super(specification, parent);
57    }
58
59    /* (non-Javadoc)
60     * @see de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement#getGUIModel()
61     */
62    @Override
63    public GUIModel getGUIModel() {
64       return (GUIModel) super.getEventTargetModel();
65    }
66
67    /* (non-Javadoc)
68     * @see de.ugoe.cs.autoquest.eventcore.AbstractDefaultHierarchicalEventTarget#getParent()
69     */
70    @Override
71    public IGUIElement getParent() {
72        return (IGUIElement) super.getParent();
73    }
74
75    /* (non-Javadoc)
76     * @see de.ugoe.cs.autoquest.eventcore.AbstractDefaultHierarchicalEventTarget#getSpecification()
77     */
78    @Override
79    public IGUIElementSpec getSpecification() {
80        return (IGUIElementSpec) super.getSpecification();
81    }
82
83    /* (non-Javadoc)
84     * @see de.ugoe.cs.autoquest.eventcore.AbstractDefaultHierarchicalEventTarget#getEventTargetModel()
85     */
86    @Override
87    public GUIModel getEventTargetModel() {
88        return (GUIModel) super.getEventTargetModel();
89    }
90
91    /*
92     * (non-Javadoc)
93     *
94     * @see de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement#isUsed()
95     */
96    @Override
97    public boolean isUsed() {
98        return usageObserved;
99    }
100
101    /*
102     * (non-Javadoc)
103     *
104     * @see de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement#markUsed()
105     */
106    @Override
107    public void markUsed() {
108        this.usageObserved = true;
109    }
110
111}
Note: See TracBrowser for help on using the repository browser.