1 | package de.ugoe.cs.quest.plugin.jfc.guimodel;
|
---|
2 |
|
---|
3 | import de.ugoe.cs.quest.eventcore.guimodel.AbstractDefaultGUIElement;
|
---|
4 | import 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 | */
|
---|
12 | public 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.setName(((JFCGUIElementSpec) updateSpecification).getName());
|
---|
84 | specification.setElementHash(((JFCGUIElementSpec) updateSpecification).getElementHash());
|
---|
85 | }
|
---|
86 | }
|
---|
87 |
|
---|
88 | /*
|
---|
89 | * (non-Javadoc)
|
---|
90 | *
|
---|
91 | * @see java.lang.Object#toString()
|
---|
92 | */
|
---|
93 | @Override
|
---|
94 | public String toString() {
|
---|
95 | String str = getElementDescriptor() + "(" + getName() + ", " + getElementHash() + "," + getIcon() + "," + getIndex() +")";
|
---|
96 | if( getParent()!=null ) {
|
---|
97 | return getParent().toString() + "->" + str;
|
---|
98 | }
|
---|
99 | return str;
|
---|
100 | }
|
---|
101 |
|
---|
102 | protected String getElementDescriptor() {
|
---|
103 | return "Default";
|
---|
104 | }
|
---|
105 |
|
---|
106 | }
|
---|