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

Last change on this file since 681 was 681, checked in by sherbold, 12 years ago
  • added getStringIdentifier() to interface IEventTarget
  • all event types and targets now implement equals and hashCode
  • Property svn:executable set to *
File size: 2.8 KB
Line 
1package de.ugoe.cs.quest.plugin.mfc.guimodel;
2
3import de.ugoe.cs.quest.eventcore.guimodel.AbstractDefaultGUIElement;
4import de.ugoe.cs.quest.eventcore.guimodel.IGUIElementSpec;
5
6/**
7 * TODO comment
8 *
9 * @version $Revision: $ $Date: $
10 * @author 2011, last modified by $Author: $
11 */
12public abstract class MFCGUIElement extends AbstractDefaultGUIElement {
13   
14    /**  */
15    private static final long serialVersionUID = 1L;
16
17    /**
18     * @param name
19     * @param id
20     * @param isModal
21     */
22    public MFCGUIElement(MFCGUIElementSpec specification, MFCGUIElement parent) {
23        super(specification, parent);
24    }
25
26    /* (non-Javadoc)
27     * @see de.ugoe.cs.quest.eventcore.IEventTarget#getPlatform()
28     */
29    @Override
30    public String getPlatform() {
31        return "MFC";
32    }
33
34    /**
35     * @return Returns the id.
36     */
37    public String getId() {
38        return Long.toString(((MFCGUIElementSpec) super.getSpecification()).getHwnd());
39    }
40
41    /**
42     * @return Returns the name.
43     */
44    public String getType() {
45        return ((MFCGUIElementSpec) super.getSpecification()).getType();
46    }
47
48    /**
49     * @return Returns the name.
50     */
51    public String getName() {
52        return ((MFCGUIElementSpec) super.getSpecification()).getName();
53    }
54
55    /**
56     * @return Returns the isModal.
57     */
58    public boolean isModal() {
59        return ((MFCGUIElementSpec) super.getSpecification()).isModal();
60    }
61
62    /**
63     * <p>
64     * TODO: comment
65     * </p>
66     *
67     * @return
68     */
69    public int getResourceId() {
70        return ((MFCGUIElementSpec) super.getSpecification()).getResourceId();
71    }
72
73    /* (non-Javadoc)
74     * @see de.ugoe.cs.quest.eventcore.guimodel.IGUIElement#updateSpecification(de.ugoe.cs.quest.eventcore.guimodel.IGUIElementSpec)
75     */
76    @Override
77    public void updateSpecification(IGUIElementSpec furtherSpec) {
78        ((MFCGUIElementSpec) super.getSpecification()).update(furtherSpec);
79    }
80   
81    @Override
82    public String getStringIdentifier() {
83        String str = this.toString();
84        if( getParent()!=null ) {
85            return getParent().getStringIdentifier() + "->" + str;
86        }
87        return str;
88    }
89
90    /* (non-Javadoc)
91     * @see java.lang.Object#toString()
92     */
93    @Override
94    public String toString() {
95        return super.getSpecification().toString();
96    }
97
98    /**
99     * <p>
100     * TODO: comment
101     * </p>
102     */
103    public String toXML() {
104        if (getParent() != null) {
105            return
106                ((MFCGUIElement) getParent()).toXML() +
107                ((MFCGUIElementSpec) super.getSpecification()).toXML();
108        }
109        else {
110            return ((MFCGUIElementSpec) super.getSpecification()).toXML();
111        }
112    }
113}
Note: See TracBrowser for help on using the repository browser.