[573] | 1 | package de.ugoe.cs.quest.plugin.jfc.guimodel;
|
---|
| 2 |
|
---|
| 3 | import de.ugoe.cs.quest.eventcore.guimodel.AbstractDefaultGUIElement;
|
---|
[589] | 4 | import de.ugoe.cs.quest.eventcore.guimodel.IGUIElementSpec;
|
---|
[573] | 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 | */
|
---|
[605] | 25 | public JFCGUIElement(JFCGUIElementSpec specification, JFCGUIElement parent) {
|
---|
| 26 | super(specification, parent);
|
---|
[573] | 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 | */
|
---|
[736] | 71 | String getElementHash() {
|
---|
[573] | 72 | return specification.getElementHash();
|
---|
| 73 | }
|
---|
| 74 |
|
---|
[599] | 75 | /**
|
---|
| 76 | * <p>
|
---|
| 77 | * TODO comment
|
---|
| 78 | * </p>
|
---|
| 79 | */
|
---|
[589] | 80 | @Override
|
---|
| 81 | public void updateSpecification(IGUIElementSpec updateSpecification) {
|
---|
[714] | 82 | if (updateSpecification instanceof JFCGUIElementSpec) {
|
---|
| 83 | specification.update(((JFCGUIElementSpec) updateSpecification));
|
---|
[589] | 84 | }
|
---|
| 85 | }
|
---|
[606] | 86 |
|
---|
| 87 | /*
|
---|
| 88 | * (non-Javadoc)
|
---|
| 89 | *
|
---|
| 90 | * @see java.lang.Object#toString()
|
---|
| 91 | */
|
---|
| 92 | @Override
|
---|
[681] | 93 | public String getStringIdentifier() {
|
---|
| 94 | String str = this.toString();
|
---|
[606] | 95 | if( getParent()!=null ) {
|
---|
[681] | 96 | return getParent().getStringIdentifier() + "->" + str;
|
---|
[606] | 97 | }
|
---|
| 98 | return str;
|
---|
| 99 | }
|
---|
| 100 |
|
---|
[681] | 101 | /*
|
---|
| 102 | * (non-Javadoc)
|
---|
| 103 | *
|
---|
| 104 | * @see java.lang.Object#toString()
|
---|
| 105 | */
|
---|
| 106 | @Override
|
---|
| 107 | public String toString() {
|
---|
[714] | 108 | String str = getElementDescriptor() + "(" + getName() + "," + getElementHash() + "," +
|
---|
| 109 | getIcon() + "," + getIndex() +")";
|
---|
[681] | 110 | return str;
|
---|
| 111 | }
|
---|
| 112 |
|
---|
[606] | 113 | protected String getElementDescriptor() {
|
---|
| 114 | return "Default";
|
---|
| 115 | }
|
---|
[589] | 116 |
|
---|
[573] | 117 | }
|
---|