Ignore:
Timestamp:
11/11/14 13:38:39 (10 years ago)
Author:
funger
Message:
  • add eventcore parts to handle touch events and type events to android-plugin
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  
    1212//   See the License for the specific language governing permissions and 
    1313//   limitations under the License. 
     14 
    1415package de.ugoe.cs.autoquest.plugin.android.guimodel; 
    1516 
     
    2425 * @author Florian Unger 
    2526 */ 
    26 public class ANDROIDButton extends ANDROIDGUIElement implements IButton{ 
    27         /** 
     27public class ANDROIDButton extends ANDROIDGUIElement implements IButton { 
     28    /** 
    2829     * <p> 
    2930     * Id for object serialization. 
     
    3132     */ 
    3233    private static final long serialVersionUID = 1L; 
    33      
     34 
    3435    /** 
    3536     * <p> 
     
    4344     *            window 
    4445     */ 
    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 
    5151    /* 
    5252     * (non-Javadoc) 
  • trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/guimodel/ANDROIDFrame.java

    r1813 r1819  
    1212//   See the License for the specific language governing permissions and 
    1313//   limitations under the License. 
     14 
    1415package de.ugoe.cs.autoquest.plugin.android.guimodel; 
    1516 
    1617import de.ugoe.cs.autoquest.eventcore.guimodel.IFrame; 
     18 
    1719/** 
    1820 * <p> 
     
    2325 * @author Florian Unger 
    2426 */ 
    25 public class ANDROIDFrame extends ANDROIDGUIElement implements IFrame{ 
    26         /** 
     27public class ANDROIDFrame extends ANDROIDGUIElement implements IFrame { 
     28    /** 
    2729     * <p> 
    2830     * Id for object serialization. 
     
    3032     */ 
    3133    private static final long serialVersionUID = 1L; 
    32          
     34 
    3335    /** 
    3436     * <p> 
     
    4244     *            window 
    4345     */ 
    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    } 
    4849 
    49         /* 
     50    /* 
    5051     * (non-Javadoc) 
    5152     *  
  • trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/guimodel/ANDROIDGUIElement.java

    r1790 r1819  
    1212//   See the License for the specific language governing permissions and 
    1313//   limitations under the License. 
     14 
    1415package de.ugoe.cs.autoquest.plugin.android.guimodel; 
    1516 
     
    2627 * @author Florian Unger 
    2728 */ 
    28 public class ANDROIDGUIElement extends AbstractDefaultGUIElement{ 
     29public class ANDROIDGUIElement extends AbstractDefaultGUIElement { 
    2930 
    30         /** 
     31    /** 
    3132     * <p> 
    3233     * Id for object serialization. 
     
    3435     */ 
    3536    private static final long serialVersionUID = 1L; 
    36      
     37 
    3738    /** 
    3839     * <p> 
     
    4142     */ 
    4243    private ANDROIDGUIElementSpec specification; 
    43      
     44 
    4445    /** 
    4546     * <p> 
     
    5455     */ 
    5556    public ANDROIDGUIElement(ANDROIDGUIElementSpec specification, ANDROIDGUIElement parent) { 
    56                 super(specification, parent); 
    57                 this.specification = specification; 
    58         } 
    59          
     57        super(specification, parent); 
     58        this.specification = specification; 
     59    } 
     60 
    6061    /* 
    6162     * (non-Javadoc) 
     
    6667     */ 
    6768    @Override 
    68         public void updateSpecification(IGUIElementSpec furtherSpec) { 
    69                 //nothing do do here up to now.          
    70         } 
     69    public void updateSpecification(IGUIElementSpec furtherSpec) { 
     70        // nothing do do here up to now. 
     71    } 
    7172 
    7273    /* 
     
    7576     * @see de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement#getDistanceTo(IGUIElement) 
    7677     */ 
    77         @Override 
    78         public double getDistanceTo(IGUIElement otherElement) { 
    79                 throw new UnsupportedOperationException("not implemented yet"); 
    80         } 
    81          
    82         /** 
     78    @Override 
     79    public double getDistanceTo(IGUIElement otherElement) { 
     80        throw new UnsupportedOperationException("not implemented yet"); 
     81    } 
     82 
     83    /** 
    8384     * <p> 
    8485     * Returns the type of the GUI element, i.e., the name of its Java class. 
     
    9091        return specification.getType(); 
    9192    } 
    92      
    93      
    9493 
    95         /* 
     94    /* 
    9695     * (non-Javadoc) 
    9796     *  
    9897     * @see de.ugoe.cs.autoquest.eventcore.IEventTarget#getPlatform() 
    9998     */ 
    100         @Override 
    101         public String getPlatform() { 
    102                 return "Android"; 
    103         } 
     99    @Override 
     100    public String getPlatform() { 
     101        return "Android"; 
     102    } 
    104103 
    105         /* 
     104    /* 
    106105     * (non-Javadoc) 
    107106     *  
    108107     * @see java.lang.Object#toString() 
    109108     */ 
    110         @Override 
    111         public String getStringIdentifier() { 
    112                 String str = this.toString(); 
     109    @Override 
     110    public String getStringIdentifier() { 
     111        String str = this.toString(); 
    113112        if (getParent() != null) { 
    114113            return str + "<-" + getParent().getStringIdentifier(); 
    115114        } 
    116115        return str; 
    117         } 
    118          
    119         /** 
     116    } 
     117 
     118    /** 
    120119     * <p> 
    121120     * 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  
    1212//   See the License for the specific language governing permissions and 
    1313//   limitations under the License. 
     14 
    1415package de.ugoe.cs.autoquest.plugin.android.guimodel; 
    1516 
     
    2021/** 
    2122 * <p> 
    22  * Implements the specification of {@link IGUIElement} for 
    23  * {@link ANDROIDGUIElement}s. 
     23 * Implements the specification of {@link IGUIElement} for {@link ANDROIDGUIElement}s. 
    2424 * </p> 
    2525 *  
     
    2929public class ANDROIDGUIElementSpec implements IGUIElementSpec { 
    3030 
    31         /** 
    32         * <p> 
    33         * default serial version UID 
    34         * </p> 
    35         */ 
    36         private static final long serialVersionUID = 1L; 
     31    /** 
     32    * <p> 
     33    * default serial version UID 
     34    * </p> 
     35    */ 
     36    private static final long serialVersionUID = 1L; 
    3737 
    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; 
    5049 
    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; 
    6657 
    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    /** 
    7674     * <p> 
    7775     * Type hierarchy of the class itself 
     
    8078    private List<String> typeHierarchy = null; 
    8179 
    82         /* 
    83         * (non-Javadoc) 
    84         *  
    85         * @see de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElementSpec#getType() 
    86         */ 
    87         @Override 
    88         public String getType() { 
    89                 return type; 
    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    } 
    9189 
    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) { 
    10298            return new String[] 
    10399                { (getType()) }; 
     
    105101        else 
    106102            return typeHierarchy.toArray(new String[typeHierarchy.size()]); 
    107         } 
     103    } 
    108104 
    109         @Override 
    110         public boolean getSimilarity(IGUIElementSpec other) { 
    111                 if (this == other) { 
    112                         return true; 
    113                 } 
     105    @Override 
     106    public boolean getSimilarity(IGUIElementSpec other) { 
     107        if (this == other) { 
     108            return true; 
     109        } 
    114110 
    115                 if (!(other instanceof ANDROIDGUIElementSpec)) { 
    116                         return false; 
    117                 } 
     111        if (!(other instanceof ANDROIDGUIElementSpec)) { 
     112            return false; 
     113        } 
    118114 
    119                 // Check wheter view.id() keeps the same even if something in the 
    120                 // structure changes. The hash in the JFCMonitor seems to be unique at 
    121                 // all. In the Androidmonitore the hash of an element changes even from 
    122                 // one start of the activity to another. 
    123                 /* 
    124                 * Maybe some other comparisons will be necessary in the future. 
    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        */ 
    126122 
    127                 return false; 
    128         } 
     123        return false; 
     124    } 
    129125 
    130         /* 
    131         * (non-Javadoc) 
    132         *  
    133         * @see java.lang.Object#hashCode() 
    134         */ 
    135         @Override 
    136         public int hashCode() { 
    137                 return hashCode; 
    138         } 
     126    /* 
     127    * (non-Javadoc) 
     128    *  
     129    * @see java.lang.Object#hashCode() 
     130    */ 
     131    @Override 
     132    public int hashCode() { 
     133        return hashCode; 
     134    } 
    139135 
    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    } 
    149146 
    150         public int getIndex() { 
    151                 return index; 
    152         } 
     147    public int getIndex() { 
     148        return index; 
     149    } 
    153150 
    154         public void setIndex(int index) { 
    155                 this.index = index; 
    156         } 
     151    public void setIndex(int index) { 
     152        this.index = index; 
     153    } 
    157154 
    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    /** 
    177176     * <p> 
    178177     * Sets the type of the specified GUI element. 
     
    185184        this.type = type; 
    186185    } 
    187      
     186 
    188187    /** 
    189188     * <p> 
     
    196195        this.typeHierarchy = typeHierarchy; 
    197196    } 
    198      
    199197 
    200198} 
  • trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/guimodel/ANDROIDPanel.java

    r1813 r1819  
    2525 * @author Florian Unger 
    2626 */ 
    27 public class ANDROIDPanel extends ANDROIDGUIElement implements IPanel{ 
     27public class ANDROIDPanel extends ANDROIDGUIElement implements IPanel { 
    2828 
    29         /** 
     29    /** 
    3030     * <p> 
    3131     * Id for object serialization. 
    3232     * </p> 
    3333     */ 
    34     private static final long serialVersionUID = 1L;  
    35          
     34    private static final long serialVersionUID = 1L; 
     35 
    3636    /** 
    3737     * <p> 
     
    4545     *            window 
    4646     */ 
    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); 
    5249 
    53         /* 
     50    } 
     51 
     52    /* 
    5453     * (non-Javadoc) 
    5554     *  
     
    6059        return "Panel"; 
    6160    } 
    62          
     61 
    6362} 
  • trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/guimodel/ANDROIDRadioButton.java

    r1811 r1819  
    2525 * @author Florian Unger 
    2626 */ 
    27 public class ANDROIDRadioButton extends ANDROIDGUIElement implements IRadioButton{ 
     27public class ANDROIDRadioButton extends ANDROIDGUIElement implements IRadioButton { 
    2828 
    29         /** 
     29    /** 
    3030     * <p> 
    3131     * Id for object serialization. 
     
    4545     *            window 
    4646     */ 
    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    } 
    5150 
    52         /* 
     51    /* 
    5352     * (non-Javadoc) 
    5453     *  
  • trunk/autoquest-plugin-android/src/main/java/de/ugoe/cs/autoquest/plugin/android/guimodel/ANDROIDTextField.java

    r1813 r1819  
    2525 * @author Florian Unger 
    2626 */ 
    27 public class ANDROIDTextField extends ANDROIDGUIElement implements ITextField{ 
     27public class ANDROIDTextField extends ANDROIDGUIElement implements ITextField { 
    2828 
    29         /** 
     29    /** 
    3030     * <p> 
    3131     * Id for object serialization. 
     
    4545     *            window 
    4646     */ 
    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    /* 
    5453     * (non-Javadoc) 
    5554     *  
Note: See TracChangeset for help on using the changeset viewer.