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

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