Changeset 837 for trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/WindowTree.java
- Timestamp:
- 09/20/12 12:03:03 (12 years ago)
- 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 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 12 13 import de.ugoe.cs.quest.eventcore.guimodel.GUIModelException; 13 14 import de.ugoe.cs.quest.eventcore.guimodel.IGUIElementFactory; 14 15 15 16 16 /** … … 30 30 /** 31 31 * <p> 32 * Maintains a set of all the targets of all widgets that were at some point part of the 33 * windowtree.32 * Maintains a set of all the targets of all widgets that were at some point part of the window 33 * tree. 34 34 * </p> 35 35 */ … … 38 38 /** 39 39 * <p> 40 * Map of all GUI element specifications that are part of the tree for efficient searching. 41 * Thekeys 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. 42 42 * </p> 43 43 */ … … 46 46 /** 47 47 * <p> 48 * Map of all children of GUI elements that are part of the tree. The keys of the map are 49 * thehwnd'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. 50 50 * </p> 51 51 */ … … 54 54 /** 55 55 * <p> 56 * Map of all parents of GUI elements that are part of the tree. The keys of the map are 57 * thehwnd'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. 58 58 * </p> 59 59 */ … … 66 66 */ 67 67 private GUIModel guiModel = new GUIModel(); 68 68 69 69 /** 70 70 * <p> … … 114 114 * class name of the window to be created 115 115 */ 116 public void add(long 117 long 118 String 119 int 120 String 116 public void add(long parentHwnd, 117 long childHwnd, 118 String childWindowName, 119 int resourceId, 120 String className, 121 121 boolean isModal) 122 122 { … … 128 128 if (parent != null) { 129 129 List<MFCGUIElementSpec> otherChildren = childRelations.get(parentHwnd); 130 130 131 131 if (otherChildren == null) { 132 132 otherChildren = new ArrayList<MFCGUIElementSpec>(); 133 133 childRelations.put(parentHwnd, otherChildren); 134 134 } 135 135 136 136 otherChildren.add(child); 137 137 138 138 parentRelations.put(childHwnd, parent); 139 139 } … … 145 145 /** 146 146 * <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} . 149 149 * </p> 150 150 * … … 157 157 if (guiElement == null) { 158 158 List<MFCGUIElementSpec> guiElementPath = new ArrayList<MFCGUIElementSpec>(); 159 159 160 160 MFCGUIElementSpec child = guiElementSpecs.get(hwnd); 161 161 162 162 if (child == null) { 163 163 throw new RuntimeException("no GUI element found with id " + hwnd); 164 164 } 165 165 166 166 while (child != null) { 167 167 guiElementPath.add(0, child); 168 168 child = parentRelations.get(child.getHwnd()); 169 169 } 170 170 171 171 try { 172 guiElement = (MFCGUIElement)173 guiModel.integratePath(guiElementPath, guiElementFactory);172 guiElement = 173 (MFCGUIElement) guiModel.integratePath(guiElementPath, guiElementFactory); 174 174 } 175 175 catch (GUIModelException e) { … … 183 183 /** 184 184 * <p> 185 * TODO: comment186 * </p> 187 * 185 * Sets the name of a GUI element given its HWND. 186 * </p> 187 * 188 188 * @param hwnd 189 * HWND of the GUI element 189 190 * @param windowName 191 * new name of the GUI element 190 192 */ 191 193 public void setName(long hwnd, String windowName) { … … 201 203 } 202 204 } 203 205 204 206 /** 205 207 * <p> … … 215 217 MFCGUIElementSpec node = guiElementSpecs.remove(hwnd); 216 218 int removedCounter = 1; 217 219 218 220 if (node != null) { 219 221 List<MFCGUIElementSpec> nodesToBeRemoved = childRelations.remove(hwnd); 220 222 221 223 // remove all children and sub-children, if any 222 224 if (nodesToBeRemoved != null) { … … 225 227 List<MFCGUIElementSpec> children = 226 228 childRelations.remove(nodeToBeRemoved.getHwnd()); 227 229 228 230 if (children != null) { 229 231 nodesToBeRemoved.addAll(children); 230 232 } 231 233 232 234 guiElementSpecs.remove(nodeToBeRemoved.getHwnd()); 233 235 parentRelations.remove(nodeToBeRemoved.getHwnd()); … … 248 250 } 249 251 } 250 252 251 253 if (children.size() <= 0) { 252 254 childRelations.remove(parent.getHwnd());
Note: See TracChangeset
for help on using the changeset viewer.