Ignore:
Timestamp:
12/31/12 17:06:37 (12 years ago)
Author:
fglaser
Message:
  • Removed an inconsistency in GUIElementTree: find(...) does not throw exceptions if element was not found, but instead returns null.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-events/src/main/java/de/ugoe/cs/autoquest/eventcore/guimodel/GUIElementTree.java

    r1005 r1025  
    173173     * <p> 
    174174     * Searches the tree for a GUI element with the specified id and returns its 
    175      * {@link IGUIElementSpec} . 
     175     * {@link IGUIElement} . 
    176176     * </p> 
    177177     *  
     
    181181     */ 
    182182    public IGUIElement find(long id) { 
    183         IGUIElement guiElement = guiElements.get(id); 
    184         if (guiElement == null) { 
    185             List<IGUIElementSpec> guiElementPath = new ArrayList<IGUIElementSpec>(); 
    186  
    187             IGUIElementSpec elementSpec = guiElementSpecs.get(id); 
    188  
    189             if (elementSpec == null) { 
    190                 throw new RuntimeException("no GUI element found with hash " + id); 
    191             } 
    192  
    193             Long currentElementID = id; 
    194             while (elementSpec != null) { 
    195                 guiElementPath.add(0, elementSpec); 
    196                 currentElementID = parentRelations.get(currentElementID); 
    197                 elementSpec = guiElementSpecs.get(currentElementID); 
    198             } 
    199  
    200             try { 
    201                 guiElement = guiModel.integratePath(guiElementPath, guiElementFactory); 
    202             } 
    203             catch (GUIModelException e) { 
    204                 throw new RuntimeException("could not instantiate GUI element with id " + id, e); 
    205             } 
    206             guiElements.put(id, guiElement); 
    207         } 
    208         return guiElement; 
     183        return guiElements.get(id); 
    209184    } 
    210185 
Note: See TracChangeset for help on using the changeset viewer.