Ignore:
Timestamp:
09/20/12 12:03:03 (12 years ago)
Author:
sherbold
Message:
  • code documentation and clean-up
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/WindowTree.java

    r655 r837  
     1 
    12package de.ugoe.cs.quest.plugin.mfc.guimodel; 
    23 
     
    1213import de.ugoe.cs.quest.eventcore.guimodel.GUIModelException; 
    1314import de.ugoe.cs.quest.eventcore.guimodel.IGUIElementFactory; 
    14  
    1515 
    1616/** 
     
    3030    /** 
    3131     * <p> 
    32      * Maintains a set of all the targets of all widgets that were at some point part of the 
    33      * window tree. 
     32     * Maintains a set of all the targets of all widgets that were at some point part of the window 
     33     * tree. 
    3434     * </p> 
    3535     */ 
     
    3838    /** 
    3939     * <p> 
    40      * Map of all GUI element specifications that are part of the tree for efficient searching. 
    41      * The keys of the map are the hwnd's of the GUI elements. 
     40     * Map of all GUI element specifications that are part of the tree for efficient searching. The 
     41     * keys of the map are the hwnd's of the GUI elements. 
    4242     * </p> 
    4343     */ 
     
    4646    /** 
    4747     * <p> 
    48      * Map of all children of GUI elements that are part of the tree. The keys of the map are 
    49      * the hwnd's of the parent GUI elements. 
     48     * Map of all children of GUI elements that are part of the tree. The keys of the map are the 
     49     * hwnd's of the parent GUI elements. 
    5050     * </p> 
    5151     */ 
     
    5454    /** 
    5555     * <p> 
    56      * Map of all parents of GUI elements that are part of the tree. The keys of the map are 
    57      * the hwnd's of the child GUI elements. 
     56     * Map of all parents of GUI elements that are part of the tree. The keys of the map are the 
     57     * hwnd's of the child GUI elements. 
    5858     * </p> 
    5959     */ 
     
    6666     */ 
    6767    private GUIModel guiModel = new GUIModel(); 
    68      
     68 
    6969    /** 
    7070     * <p> 
     
    114114     *            class name of the window to be created 
    115115     */ 
    116     public void add(long    parentHwnd, 
    117                     long    childHwnd, 
    118                     String  childWindowName, 
    119                     int     resourceId, 
    120                     String  className, 
     116    public void add(long parentHwnd, 
     117                    long childHwnd, 
     118                    String childWindowName, 
     119                    int resourceId, 
     120                    String className, 
    121121                    boolean isModal) 
    122122    { 
     
    128128            if (parent != null) { 
    129129                List<MFCGUIElementSpec> otherChildren = childRelations.get(parentHwnd); 
    130                  
     130 
    131131                if (otherChildren == null) { 
    132132                    otherChildren = new ArrayList<MFCGUIElementSpec>(); 
    133133                    childRelations.put(parentHwnd, otherChildren); 
    134134                } 
    135                  
     135 
    136136                otherChildren.add(child); 
    137                  
     137 
    138138                parentRelations.put(childHwnd, parent); 
    139139            } 
     
    145145    /** 
    146146     * <p> 
    147      * Searches the tree for a window with the specified hwnd and returns its {@link MFCGUIElementSpec} 
    148      * . 
     147     * Searches the tree for a window with the specified hwnd and returns its 
     148     * {@link MFCGUIElementSpec} . 
    149149     * </p> 
    150150     *  
     
    157157        if (guiElement == null) { 
    158158            List<MFCGUIElementSpec> guiElementPath = new ArrayList<MFCGUIElementSpec>(); 
    159              
     159 
    160160            MFCGUIElementSpec child = guiElementSpecs.get(hwnd); 
    161              
     161 
    162162            if (child == null) { 
    163163                throw new RuntimeException("no GUI element found with id " + hwnd); 
    164164            } 
    165              
     165 
    166166            while (child != null) { 
    167167                guiElementPath.add(0, child); 
    168168                child = parentRelations.get(child.getHwnd()); 
    169169            } 
    170              
     170 
    171171            try { 
    172                 guiElement = (MFCGUIElement) 
    173                     guiModel.integratePath(guiElementPath, guiElementFactory); 
     172                guiElement = 
     173                    (MFCGUIElement) guiModel.integratePath(guiElementPath, guiElementFactory); 
    174174            } 
    175175            catch (GUIModelException e) { 
     
    183183    /** 
    184184     * <p> 
    185      * TODO: comment 
    186      * </p> 
    187      * 
     185     * Sets the name of a GUI element given its HWND. 
     186     * </p> 
     187     *  
    188188     * @param hwnd 
     189     *            HWND of the GUI element 
    189190     * @param windowName 
     191     *            new name of the GUI element 
    190192     */ 
    191193    public void setName(long hwnd, String windowName) { 
     
    201203        } 
    202204    } 
    203      
     205 
    204206    /** 
    205207     * <p> 
     
    215217        MFCGUIElementSpec node = guiElementSpecs.remove(hwnd); 
    216218        int removedCounter = 1; 
    217          
     219 
    218220        if (node != null) { 
    219221            List<MFCGUIElementSpec> nodesToBeRemoved = childRelations.remove(hwnd); 
    220              
     222 
    221223            // remove all children and sub-children, if any 
    222224            if (nodesToBeRemoved != null) { 
     
    225227                    List<MFCGUIElementSpec> children = 
    226228                        childRelations.remove(nodeToBeRemoved.getHwnd()); 
    227                      
     229 
    228230                    if (children != null) { 
    229231                        nodesToBeRemoved.addAll(children); 
    230232                    } 
    231                      
     233 
    232234                    guiElementSpecs.remove(nodeToBeRemoved.getHwnd()); 
    233235                    parentRelations.remove(nodeToBeRemoved.getHwnd()); 
     
    248250                        } 
    249251                    } 
    250                      
     252 
    251253                    if (children.size() <= 0) { 
    252254                        childRelations.remove(parent.getHwnd()); 
Note: See TracChangeset for help on using the changeset viewer.