Ignore:
Timestamp:
04/07/14 08:42:08 (10 years ago)
Author:
pharms
Message:
  • added support and initial implementation of a platform specific distance measure between GUI elements
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/guimodel/HTMLDocument.java

    r1276 r1490  
    1616 
    1717import de.ugoe.cs.autoquest.eventcore.guimodel.IDialog; 
     18import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement; 
    1819 
    1920/** 
     
    6970    } 
    7071 
     72    /* (non-Javadoc) 
     73     * @see de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElement#getDistanceTo(IGUIElement) 
     74     */ 
     75    @Override 
     76    public double getDistanceTo(IGUIElement otherElement) { 
     77        if (otherElement instanceof HTMLServer) { 
     78            // use the implementation provided by the server 
     79            return otherElement.getDistanceTo(this); 
     80        } 
     81        else if (otherElement instanceof HTMLDocument) { 
     82            if (this.getSpecification().getSimilarity(otherElement.getSpecification())) { 
     83                return DISTANCE_NONE; 
     84            } 
     85            else { 
     86                // use the implementation provided by the server to check if the document resists 
     87                // at least on the same server 
     88                return getServer().getDistanceTo(otherElement); 
     89            } 
     90        } 
     91        else if (otherElement instanceof HTMLPageElement) { 
     92            HTMLDocumentSpec documentSpec = 
     93                ((HTMLPageElementSpec) otherElement.getSpecification()).getPage(); 
     94             
     95            if (this.getSpecification().getSimilarity(documentSpec)) { 
     96                return DISTANCE_SAME_DOCUMENT; 
     97            } 
     98            else { 
     99                // use the implementation provided by the server to check if the document resists 
     100                // at least on the same server 
     101                return getServer().getDistanceTo(otherElement); 
     102            } 
     103        } 
     104         
     105        return DISTANCE_DISTINCT_SERVER; 
     106    } 
     107 
    71108    /** 
    72109     * <p> 
Note: See TracChangeset for help on using the changeset viewer.