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

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