source: trunk/quest-plugin-jfc/src/main/java/de/ugoe/cs/quest/plugin/jfc/guimodel/JFCGUIElement.java @ 778

Last change on this file since 778 was 778, checked in by sherbold, 12 years ago
  • made GUI element specifications Serializable
  • Property svn:executable set to *
File size: 2.7 KB
Line 
1package de.ugoe.cs.quest.plugin.jfc.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 class JFCGUIElement extends AbstractDefaultGUIElement {
13   
14    /**
15     * <p>
16     * Id for object serialization.
17     * </p>
18     */
19    private static final long serialVersionUID = 1L;
20
21    /** the specification of the GUI Element */
22    private JFCGUIElementSpec specification;
23
24    /**
25     * @param name
26     * @param id
27     * @param isModal
28     */
29    public JFCGUIElement(JFCGUIElementSpec specification, JFCGUIElement parent) {
30        super(specification, parent);
31        this.specification = specification;
32    }
33
34    /* (non-Javadoc)
35     * @see de.ugoe.cs.quest.eventcore.IEventTarget#getPlatform()
36     */
37    @Override
38    public String getPlatform() {
39        return "JFC";
40    }
41
42    /**
43     * TODO: comment
44     *
45     * @return
46     */
47    public String getJavaType() {
48        return specification.getType();
49    }
50
51    /**
52     * @return Returns the name.
53     */
54    String getName() {
55        return specification.getName();
56    }
57
58    /**
59     * @return the icon
60     */
61    String getIcon() {
62        return specification.getIcon();
63    }
64
65    /**
66     * @return the index
67     */
68    int getIndex() {
69        return specification.getIndex();
70    }
71
72    /**
73     * @return the hashCode
74     */
75    int getElementHash() {
76        return specification.getElementHash();
77    }
78
79    /**
80     * <p>
81     * TODO comment
82     * </p>
83     */
84    @Override
85    public void updateSpecification(IGUIElementSpec updateSpecification) {
86        if (updateSpecification instanceof JFCGUIElementSpec) {
87            specification.update(((JFCGUIElementSpec) updateSpecification));
88        }
89    }
90   
91    /*
92     * (non-Javadoc)
93     *
94     * @see java.lang.Object#toString()
95     */
96    @Override
97    public String getStringIdentifier() {
98        String str = this.toString();
99        if( getParent()!=null ) {
100            return getParent().getStringIdentifier() + "->" + str;
101        }
102        return str;
103    }
104   
105    /*
106     * (non-Javadoc)
107     *
108     * @see java.lang.Object#toString()
109     */
110    @Override
111    public String toString() {
112        String str = getElementDescriptor() + "(" + getName() + "," + getElementHash() + "," +
113            getIcon() + "," + getIndex() +")";
114        return str;
115    }
116   
117    protected String getElementDescriptor() {
118        return "Default";
119    }
120
121}
Note: See TracBrowser for help on using the repository browser.