package de.ugoe.cs.quest.plugin.mfc.guimodel; import de.ugoe.cs.quest.eventcore.guimodel.AbstractDefaultGUIElement; import de.ugoe.cs.quest.eventcore.guimodel.IGUIElementSpec; /** *

* Base class that represents GUI element in MFC GUIs. *

* * @version 1.0 * @author Patrick Harms */ public abstract class MFCGUIElement extends AbstractDefaultGUIElement { /** *

* Id for object serialization. *

*/ private static final long serialVersionUID = 1L; /** *

* Constructor. Creates a new MFCGUIElement. *

* * @param specification * specification of created GUI element * @param parent * parent of the created GUI element; null means that the element is a top-level * window */ public MFCGUIElement(MFCGUIElementSpec specification, MFCGUIElement parent) { super(specification, parent); } /* * (non-Javadoc) * * @see de.ugoe.cs.quest.eventcore.IEventTarget#getPlatform() */ @Override public String getPlatform() { return "MFC"; } /** *

* Returns the HWND (Id) of the GUI element. *

* * @return the HWND (Id) */ public String getId() { return Long.toString(((MFCGUIElementSpec) super.getSpecification()).getHwnd()); } /** *

* Returns the type of the GUI element. *

* * @return the type */ public String getType() { return ((MFCGUIElementSpec) super.getSpecification()).getType(); } /** *

* Returns the name of the GUI element. *

* * @return the name */ public String getName() { return ((MFCGUIElementSpec) super.getSpecification()).getName(); } /** *

* Returns the modality of the GUI element. *

* * @return the modality */ public boolean isModal() { return ((MFCGUIElementSpec) super.getSpecification()).isModal(); } /** *

* Returns the resource Id of the GUI element. *

* * @return the resource Id */ public int getResourceId() { return ((MFCGUIElementSpec) super.getSpecification()).getResourceId(); } /* * (non-Javadoc) * * @see * de.ugoe.cs.quest.eventcore.guimodel.IGUIElement#updateSpecification(de.ugoe.cs.quest.eventcore * .guimodel.IGUIElementSpec) */ @Override public void updateSpecification(IGUIElementSpec furtherSpec) { ((MFCGUIElementSpec) super.getSpecification()).update(furtherSpec); } /* * (non-Javadoc) * * @see de.ugoe.cs.quest.eventcore.IEventTarget#getStringIdentifier() */ @Override public String getStringIdentifier() { String str = this.toString(); if (getParent() != null) { return getParent().getStringIdentifier() + "->" + str; } return str; } /* * (non-Javadoc) * * @see java.lang.Object#toString() */ @Override public String toString() { return super.getSpecification().toString(); } /** *

* Returns the XML representation of the GUI element. *

* * @return the XML representation */ public String toXML() { if (getParent() != null) { return ((MFCGUIElement) getParent()).toXML() + ((MFCGUIElementSpec) super.getSpecification()).toXML(); } else { return ((MFCGUIElementSpec) super.getSpecification()).toXML(); } } }