source: trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCGUIElement.java @ 837

Last change on this file since 837 was 837, checked in by sherbold, 12 years ago
  • code documentation and clean-up
  • Property svn:executable set to *
File size: 3.7 KB
Line 
1
2package de.ugoe.cs.quest.plugin.mfc.guimodel;
3
4import de.ugoe.cs.quest.eventcore.guimodel.AbstractDefaultGUIElement;
5import de.ugoe.cs.quest.eventcore.guimodel.IGUIElementSpec;
6
7/**
8 * <p>
9 * Base class that represents GUI element in MFC GUIs.
10 * </p>
11 *
12 * @version 1.0
13 * @author Patrick Harms
14 */
15public abstract class MFCGUIElement extends AbstractDefaultGUIElement {
16
17    /**
18     * <p>
19     * Id for object serialization.
20     * </p>
21     */
22    private static final long serialVersionUID = 1L;
23
24    /**
25     * <p>
26     * Constructor. Creates a new MFCGUIElement.
27     * </p>
28     *
29     * @param specification
30     *            specification of created GUI element
31     * @param parent
32     *            parent of the created GUI element; null means that the element is a top-level
33     *            window
34     */
35    public MFCGUIElement(MFCGUIElementSpec specification, MFCGUIElement parent) {
36        super(specification, parent);
37    }
38
39    /*
40     * (non-Javadoc)
41     *
42     * @see de.ugoe.cs.quest.eventcore.IEventTarget#getPlatform()
43     */
44    @Override
45    public String getPlatform() {
46        return "MFC";
47    }
48
49    /**
50     * <p>
51     * Returns the HWND (Id) of the GUI element.
52     * </p>
53     *
54     * @return the HWND (Id)
55     */
56    public String getId() {
57        return Long.toString(((MFCGUIElementSpec) super.getSpecification()).getHwnd());
58    }
59
60    /**
61     * <p>
62     * Returns the type of the GUI element.
63     * </p>
64     *
65     * @return the type
66     */
67    public String getType() {
68        return ((MFCGUIElementSpec) super.getSpecification()).getType();
69    }
70
71    /**
72     * <p>
73     * Returns the name of the GUI element.
74     * </p>
75     *
76     * @return the name
77     */
78    public String getName() {
79        return ((MFCGUIElementSpec) super.getSpecification()).getName();
80    }
81
82    /**
83     * <p>
84     * Returns the modality of the GUI element.
85     * </p>
86     *
87     * @return the modality
88     */
89    public boolean isModal() {
90        return ((MFCGUIElementSpec) super.getSpecification()).isModal();
91    }
92
93    /**
94     * <p>
95     * Returns the resource Id of the GUI element.
96     * </p>
97     *
98     * @return the resource Id
99     */
100    public int getResourceId() {
101        return ((MFCGUIElementSpec) super.getSpecification()).getResourceId();
102    }
103
104    /*
105     * (non-Javadoc)
106     *
107     * @see
108     * de.ugoe.cs.quest.eventcore.guimodel.IGUIElement#updateSpecification(de.ugoe.cs.quest.eventcore
109     * .guimodel.IGUIElementSpec)
110     */
111    @Override
112    public void updateSpecification(IGUIElementSpec furtherSpec) {
113        ((MFCGUIElementSpec) super.getSpecification()).update(furtherSpec);
114    }
115
116    /*
117     * (non-Javadoc)
118     *
119     * @see de.ugoe.cs.quest.eventcore.IEventTarget#getStringIdentifier()
120     */
121    @Override
122    public String getStringIdentifier() {
123        String str = this.toString();
124        if (getParent() != null) {
125            return getParent().getStringIdentifier() + "->" + str;
126        }
127        return str;
128    }
129
130    /*
131     * (non-Javadoc)
132     *
133     * @see java.lang.Object#toString()
134     */
135    @Override
136    public String toString() {
137        return super.getSpecification().toString();
138    }
139
140    /**
141     * <p>
142     * Returns the XML representation of the GUI element.
143     * </p>
144     *
145     * @return the XML representation
146     */
147    public String toXML() {
148        if (getParent() != null) {
149            return ((MFCGUIElement) getParent()).toXML() +
150                ((MFCGUIElementSpec) super.getSpecification()).toXML();
151        }
152        else {
153            return ((MFCGUIElementSpec) super.getSpecification()).toXML();
154        }
155    }
156}
Note: See TracBrowser for help on using the repository browser.