1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany
|
---|
2 | //
|
---|
3 | // Licensed under the Apache License, Version 2.0 (the "License");
|
---|
4 | // you may not use this file except in compliance with the License.
|
---|
5 | // You may obtain a copy of the License at
|
---|
6 | //
|
---|
7 | // http://www.apache.org/licenses/LICENSE-2.0
|
---|
8 | //
|
---|
9 | // Unless required by applicable law or agreed to in writing, software
|
---|
10 | // distributed under the License is distributed on an "AS IS" BASIS,
|
---|
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
12 | // See the License for the specific language governing permissions and
|
---|
13 | // limitations under the License.
|
---|
14 | package de.ugoe.cs.autoquest.plugin.android.guimodel;
|
---|
15 |
|
---|
16 | import de.ugoe.cs.autoquest.eventcore.guimodel.AbstractDefaultGUIElement;
|
---|
17 | import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement;
|
---|
18 | import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElementSpec;
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * <p>
|
---|
22 | * Base class for all Android GUI elements.
|
---|
23 | * </p>
|
---|
24 | *
|
---|
25 | * @version 1.0
|
---|
26 | * @author Florian Unger
|
---|
27 | */
|
---|
28 | public class ANDROIDGUIElement extends AbstractDefaultGUIElement{
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * <p>
|
---|
32 | * Id for object serialization.
|
---|
33 | * </p>
|
---|
34 | */
|
---|
35 | private static final long serialVersionUID = 1L;
|
---|
36 |
|
---|
37 | /**
|
---|
38 | * <p>
|
---|
39 | * Specification of the GUI Element
|
---|
40 | * </p>
|
---|
41 | */
|
---|
42 | private ANDROIDGUIElementSpec specification;
|
---|
43 |
|
---|
44 | /**
|
---|
45 | * <p>
|
---|
46 | * Constructor. Creates a new JFCGUIElement.
|
---|
47 | * </p>
|
---|
48 | *
|
---|
49 | * @param specification
|
---|
50 | * specification of created GUI element
|
---|
51 | * @param parent
|
---|
52 | * parent of the created GUI element; null means that the element is a top-level
|
---|
53 | * window
|
---|
54 | */
|
---|
55 | public ANDROIDGUIElement(ANDROIDGUIElementSpec specification, ANDROIDGUIElement parent) {
|
---|
56 | super(specification, parent);
|
---|
57 | this.specification = specification;
|
---|
58 | }
|
---|
59 |
|
---|
60 | /*
|
---|
61 | * (non-Javadoc)
|
---|
62 | *
|
---|
63 | * @see
|
---|
64 | * de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement#updateSpecification(de.ugoe.cs.autoquest
|
---|
65 | * .eventcore .guimodel.IGUIElementSpec)
|
---|
66 | */
|
---|
67 | @Override
|
---|
68 | public void updateSpecification(IGUIElementSpec furtherSpec) {
|
---|
69 | //nothing do do here up to now.
|
---|
70 | }
|
---|
71 |
|
---|
72 | /*
|
---|
73 | * (non-Javadoc)
|
---|
74 | *
|
---|
75 | * @see de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement#getDistanceTo(IGUIElement)
|
---|
76 | */
|
---|
77 | @Override
|
---|
78 | public double getDistanceTo(IGUIElement otherElement) {
|
---|
79 | throw new UnsupportedOperationException("not implemented yet");
|
---|
80 | }
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * <p>
|
---|
84 | * Returns the type of the GUI element, i.e., the name of its Java class.
|
---|
85 | * </p>
|
---|
86 | *
|
---|
87 | * @return the Java class name
|
---|
88 | */
|
---|
89 | public String getSpecType() {
|
---|
90 | return specification.getType();
|
---|
91 | }
|
---|
92 |
|
---|
93 |
|
---|
94 |
|
---|
95 | /*
|
---|
96 | * (non-Javadoc)
|
---|
97 | *
|
---|
98 | * @see de.ugoe.cs.autoquest.eventcore.IEventTarget#getPlatform()
|
---|
99 | */
|
---|
100 | @Override
|
---|
101 | public String getPlatform() {
|
---|
102 | return "Android";
|
---|
103 | }
|
---|
104 |
|
---|
105 | /*
|
---|
106 | * (non-Javadoc)
|
---|
107 | *
|
---|
108 | * @see java.lang.Object#toString()
|
---|
109 | */
|
---|
110 | @Override
|
---|
111 | public String getStringIdentifier() {
|
---|
112 | String str = this.toString();
|
---|
113 | if (getParent() != null) {
|
---|
114 | return str + "<-" + getParent().getStringIdentifier();
|
---|
115 | }
|
---|
116 | return str;
|
---|
117 | }
|
---|
118 |
|
---|
119 | /**
|
---|
120 | * <p>
|
---|
121 | * A short string describing the GUI element, e.g., Button, Canvas, or ScrollBar.
|
---|
122 | * </p>
|
---|
123 | *
|
---|
124 | * @return short element descriptor
|
---|
125 | */
|
---|
126 | protected String getElementDescriptor() {
|
---|
127 | return "Default";
|
---|
128 | }
|
---|
129 |
|
---|
130 | }
|
---|