Changeset 1819 for trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/guimodel
- Timestamp:
- 11/11/14 13:38:39 (10 years ago)
- Location:
- trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/guimodel
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/guimodel/ANDROIDButton.java
r1813 r1819 12 12 // See the License for the specific language governing permissions and 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.plugin.android.guimodel; 15 16 … … 24 25 * @author Florian Unger 25 26 */ 26 public class ANDROIDButton extends ANDROIDGUIElement implements IButton {27 27 public class ANDROIDButton extends ANDROIDGUIElement implements IButton { 28 /** 28 29 * <p> 29 30 * Id for object serialization. … … 31 32 */ 32 33 private static final long serialVersionUID = 1L; 33 34 34 35 /** 35 36 * <p> … … 43 44 * window 44 45 */ 45 public ANDROIDButton(ANDROIDGUIElementSpec specification, 46 ANDROIDGUIElement parent) { 47 super(specification, parent); 48 // TODO Auto-generated constructor stub 49 } 50 46 public ANDROIDButton(ANDROIDGUIElementSpec specification, ANDROIDGUIElement parent) { 47 super(specification, parent); 48 // TODO Auto-generated constructor stub 49 } 50 51 51 /* 52 52 * (non-Javadoc) -
trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/guimodel/ANDROIDFrame.java
r1813 r1819 12 12 // See the License for the specific language governing permissions and 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.plugin.android.guimodel; 15 16 16 17 import de.ugoe.cs.autoquest.eventcore.guimodel.IFrame; 18 17 19 /** 18 20 * <p> … … 23 25 * @author Florian Unger 24 26 */ 25 public class ANDROIDFrame extends ANDROIDGUIElement implements IFrame {26 27 public class ANDROIDFrame extends ANDROIDGUIElement implements IFrame { 28 /** 27 29 * <p> 28 30 * Id for object serialization. … … 30 32 */ 31 33 private static final long serialVersionUID = 1L; 32 34 33 35 /** 34 36 * <p> … … 42 44 * window 43 45 */ 44 public ANDROIDFrame(ANDROIDGUIElementSpec specification, 45 ANDROIDGUIElement parent) { 46 super(specification, parent); 47 } 46 public ANDROIDFrame(ANDROIDGUIElementSpec specification, ANDROIDGUIElement parent) { 47 super(specification, parent); 48 } 48 49 49 50 /* 50 51 * (non-Javadoc) 51 52 * -
trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/guimodel/ANDROIDGUIElement.java
r1790 r1819 12 12 // See the License for the specific language governing permissions and 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.plugin.android.guimodel; 15 16 … … 26 27 * @author Florian Unger 27 28 */ 28 public class ANDROIDGUIElement extends AbstractDefaultGUIElement {29 public class ANDROIDGUIElement extends AbstractDefaultGUIElement { 29 30 30 31 /** 31 32 * <p> 32 33 * Id for object serialization. … … 34 35 */ 35 36 private static final long serialVersionUID = 1L; 36 37 37 38 /** 38 39 * <p> … … 41 42 */ 42 43 private ANDROIDGUIElementSpec specification; 43 44 44 45 /** 45 46 * <p> … … 54 55 */ 55 56 public ANDROIDGUIElement(ANDROIDGUIElementSpec specification, ANDROIDGUIElement parent) { 56 57 58 59 57 super(specification, parent); 58 this.specification = specification; 59 } 60 60 61 /* 61 62 * (non-Javadoc) … … 66 67 */ 67 68 @Override 68 69 //nothing do do here up to now. 70 69 public void updateSpecification(IGUIElementSpec furtherSpec) { 70 // nothing do do here up to now. 71 } 71 72 72 73 /* … … 75 76 * @see de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement#getDistanceTo(IGUIElement) 76 77 */ 77 78 79 80 81 82 78 @Override 79 public double getDistanceTo(IGUIElement otherElement) { 80 throw new UnsupportedOperationException("not implemented yet"); 81 } 82 83 /** 83 84 * <p> 84 85 * Returns the type of the GUI element, i.e., the name of its Java class. … … 90 91 return specification.getType(); 91 92 } 92 93 94 93 95 94 /* 96 95 * (non-Javadoc) 97 96 * 98 97 * @see de.ugoe.cs.autoquest.eventcore.IEventTarget#getPlatform() 99 98 */ 100 101 102 103 99 @Override 100 public String getPlatform() { 101 return "Android"; 102 } 104 103 105 104 /* 106 105 * (non-Javadoc) 107 106 * 108 107 * @see java.lang.Object#toString() 109 108 */ 110 111 112 109 @Override 110 public String getStringIdentifier() { 111 String str = this.toString(); 113 112 if (getParent() != null) { 114 113 return str + "<-" + getParent().getStringIdentifier(); 115 114 } 116 115 return str; 117 118 119 116 } 117 118 /** 120 119 * <p> 121 120 * A short string describing the GUI element, e.g., Button, Canvas, or ScrollBar. -
trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/guimodel/ANDROIDGUIElementSpec.java
r1815 r1819 12 12 // See the License for the specific language governing permissions and 13 13 // limitations under the License. 14 14 15 package de.ugoe.cs.autoquest.plugin.android.guimodel; 15 16 … … 20 21 /** 21 22 * <p> 22 * Implements the specification of {@link IGUIElement} for 23 * {@link ANDROIDGUIElement}s. 23 * Implements the specification of {@link IGUIElement} for {@link ANDROIDGUIElement}s. 24 24 * </p> 25 25 * … … 29 29 public class ANDROIDGUIElementSpec implements IGUIElementSpec { 30 30 31 32 33 34 35 36 31 /** 32 * <p> 33 * default serial version UID 34 * </p> 35 */ 36 private static final long serialVersionUID = 1L; 37 37 38 /* 39 * (non-Javadoc) see 40 * de.ugoe.cs.autoquest.androidmonitor.AndroidmonitorLogFile#logComponent() 41 */ 42 /** 43 * <p> 44 * Hash code of the GUI element. Used as unique identifier during parsing a 45 * log file. Note that it is possible that the hash code of an element 46 * changes over several log files even if they come from the same target. 47 * </p> 48 */ 49 private int hashCode; 38 /* 39 * (non-Javadoc) see de.ugoe.cs.autoquest.androidmonitor.AndroidmonitorLogFile#logComponent() 40 */ 41 /** 42 * <p> 43 * Hash code of the GUI element. Used as unique identifier during parsing a log file. Note that 44 * it is possible that the hash code of an element changes over several log files even if they 45 * come from the same target. 46 * </p> 47 */ 48 private int hashCode; 50 49 51 /** 52 * <p> 53 * Path to an element in an activity. e.g. a path of a button could look 54 * like MainActivity/DecorView/ActionBarOverlayLayout/FrameLayout/ 55 * RelativeLayout/Button 56 * </p> 57 */ 58 private String path; 59 60 /** 61 * <p> 62 * id of the object as it is returned by view.getId() 63 * </p> 64 */ 65 private int index; 50 /** 51 * <p> 52 * Path to an element in an activity. e.g. a path of a button could look like 53 * MainActivity/DecorView/ActionBarOverlayLayout/FrameLayout/ RelativeLayout/Button 54 * </p> 55 */ 56 private String path; 66 57 67 /** 68 * <p> 69 * the type of GUI element represented by this specification, which is 70 * usually the java class of the android GUI element 71 * </p> 72 */ 73 private String type; 74 75 /** 58 /** 59 * <p> 60 * id of the object as it is returned by view.getId() 61 * </p> 62 */ 63 private int index; 64 65 /** 66 * <p> 67 * the type of GUI element represented by this specification, which is usually the java class of 68 * the android GUI element 69 * </p> 70 */ 71 private String type; 72 73 /** 76 74 * <p> 77 75 * Type hierarchy of the class itself … … 80 78 private List<String> typeHierarchy = null; 81 79 82 83 84 85 86 87 88 89 90 80 /* 81 * (non-Javadoc) 82 * 83 * @see de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElementSpec#getType() 84 */ 85 @Override 86 public String getType() { 87 return type; 88 } 91 89 92 /* 93 * (non-Javadoc) 94 * 95 * @see 96 * de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElementSpec#getTypeHierarchy 97 * () 98 */ 99 @Override 100 public String[] getTypeHierarchy() { 101 if (typeHierarchy == null) { 90 /* 91 * (non-Javadoc) 92 * 93 * @see de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElementSpec#getTypeHierarchy () 94 */ 95 @Override 96 public String[] getTypeHierarchy() { 97 if (typeHierarchy == null) { 102 98 return new String[] 103 99 { (getType()) }; … … 105 101 else 106 102 return typeHierarchy.toArray(new String[typeHierarchy.size()]); 107 103 } 108 104 109 110 111 112 113 105 @Override 106 public boolean getSimilarity(IGUIElementSpec other) { 107 if (this == other) { 108 return true; 109 } 114 110 115 116 117 111 if (!(other instanceof ANDROIDGUIElementSpec)) { 112 return false; 113 } 118 114 119 120 121 122 123 124 125 115 // Check wheter view.id() keeps the same even if something in the 116 // structure changes. The hash in the JFCMonitor seems to be unique at 117 // all. In the Androidmonitore the hash of an element changes even from 118 // one start of the activity to another. 119 /* 120 * Maybe some other comparisons will be necessary in the future. 121 */ 126 122 127 128 123 return false; 124 } 129 125 130 131 132 133 134 135 136 137 138 126 /* 127 * (non-Javadoc) 128 * 129 * @see java.lang.Object#hashCode() 130 */ 131 @Override 132 public int hashCode() { 133 return hashCode; 134 } 139 135 140 /** 141 * <p> 142 * Returns the path associated with the specified GUI element. 143 * </p> 144 * @return the path to an element 145 */ 146 public String getPath() { 147 return path; 148 } 136 /** 137 * <p> 138 * Returns the path associated with the specified GUI element. 139 * </p> 140 * 141 * @return the path to an element 142 */ 143 public String getPath() { 144 return path; 145 } 149 146 150 151 152 147 public int getIndex() { 148 return index; 149 } 153 150 154 155 156 151 public void setIndex(int index) { 152 this.index = index; 153 } 157 154 158 /** 159 * Set the hash code associated with the GUI element. 160 * @param hash 161 * the hash of an element object 162 */ 163 public void setHashCode(int hash){ 164 this.hashCode = hash; 165 } 166 167 /** 168 * Set the path associated with the specified GUI element. 169 * @param path 170 * the path to an element 171 */ 172 public void setPath(String path) { 173 this.path = path; 174 } 175 176 /** 155 /** 156 * Set the hash code associated with the GUI element. 157 * 158 * @param hash 159 * the hash of an element object 160 */ 161 public void setHashCode(int hash) { 162 this.hashCode = hash; 163 } 164 165 /** 166 * Set the path associated with the specified GUI element. 167 * 168 * @param path 169 * the path to an element 170 */ 171 public void setPath(String path) { 172 this.path = path; 173 } 174 175 /** 177 176 * <p> 178 177 * Sets the type of the specified GUI element. … … 185 184 this.type = type; 186 185 } 187 186 188 187 /** 189 188 * <p> … … 196 195 this.typeHierarchy = typeHierarchy; 197 196 } 198 199 197 200 198 } -
trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/guimodel/ANDROIDPanel.java
r1813 r1819 25 25 * @author Florian Unger 26 26 */ 27 public class ANDROIDPanel extends ANDROIDGUIElement implements IPanel {27 public class ANDROIDPanel extends ANDROIDGUIElement implements IPanel { 28 28 29 29 /** 30 30 * <p> 31 31 * Id for object serialization. 32 32 * </p> 33 33 */ 34 private static final long serialVersionUID = 1L; 35 34 private static final long serialVersionUID = 1L; 35 36 36 /** 37 37 * <p> … … 45 45 * window 46 46 */ 47 public ANDROIDPanel(ANDROIDGUIElementSpec specification, 48 ANDROIDGUIElement parent) { 49 super(specification, parent); 50 51 } 47 public ANDROIDPanel(ANDROIDGUIElementSpec specification, ANDROIDGUIElement parent) { 48 super(specification, parent); 52 49 53 /* 50 } 51 52 /* 54 53 * (non-Javadoc) 55 54 * … … 60 59 return "Panel"; 61 60 } 62 61 63 62 } -
trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/guimodel/ANDROIDRadioButton.java
r1811 r1819 25 25 * @author Florian Unger 26 26 */ 27 public class ANDROIDRadioButton extends ANDROIDGUIElement implements IRadioButton {27 public class ANDROIDRadioButton extends ANDROIDGUIElement implements IRadioButton { 28 28 29 29 /** 30 30 * <p> 31 31 * Id for object serialization. … … 45 45 * window 46 46 */ 47 public ANDROIDRadioButton(ANDROIDGUIElementSpec specification, 48 ANDROIDGUIElement parent) { 49 super(specification, parent); 50 } 47 public ANDROIDRadioButton(ANDROIDGUIElementSpec specification, ANDROIDGUIElement parent) { 48 super(specification, parent); 49 } 51 50 52 51 /* 53 52 * (non-Javadoc) 54 53 * -
trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/guimodel/ANDROIDTextField.java
r1813 r1819 25 25 * @author Florian Unger 26 26 */ 27 public class ANDROIDTextField extends ANDROIDGUIElement implements ITextField {27 public class ANDROIDTextField extends ANDROIDGUIElement implements ITextField { 28 28 29 29 /** 30 30 * <p> 31 31 * Id for object serialization. … … 45 45 * window 46 46 */ 47 public ANDROIDTextField(ANDROIDGUIElementSpec specification, 48 ANDROIDGUIElement parent) { 49 super(specification, parent); 50 51 } 52 53 /* 47 public ANDROIDTextField(ANDROIDGUIElementSpec specification, ANDROIDGUIElement parent) { 48 super(specification, parent); 49 50 } 51 52 /* 54 53 * (non-Javadoc) 55 54 *
Note: See TracChangeset
for help on using the changeset viewer.