- Timestamp:
- 09/20/12 12:03:03 (12 years ago)
- Location:
- trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCButton.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment8 * Class that represents buttons in MFC GUIs. 8 9 * </p> 9 10 * 10 * @version $Revision: $ $Date: 21.08.2012$11 * @author 2012, last modified by $Author: pharms$11 * @version 1.0 12 * @author Patrick Harms 12 13 */ 13 14 public class MFCButton extends MFCGUIElement implements IButton { 14 15 15 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 16 21 private static final long serialVersionUID = 1L; 17 22 18 23 /** 19 24 * <p> 20 * TODO: comment25 * Constructor. Creates a new MFCButton. 21 26 * </p> 22 * 27 * 23 28 * @param specification 29 * specification of created GUI element 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 24 33 */ 25 34 public MFCButton(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCCanvas.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment8 * Class that represents canvas' in MFC GUIs. 8 9 * </p> 9 10 * 10 * @version $Revision: $ $Date: 23.08.2012$11 * @author 2012, last modified by $Author: pharms$11 * @version 1.0 12 * @author Patrick Harms 12 13 */ 13 14 public class MFCCanvas extends MFCGUIElement implements ICanvas { 14 15 15 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 16 21 private static final long serialVersionUID = 1L; 17 22 18 23 /** 19 24 * <p> 20 * TODO: comment25 * Constructor. Creates a new MFCCanvas. 21 26 * </p> 22 * 27 * 23 28 * @param specification 29 * specification of created GUI element 24 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 25 33 */ 26 34 public MFCCanvas(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCComboBox.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment8 * Class that represents combo boxes in MFC GUIs. 8 9 * </p> 9 10 * 10 * @version $Revision: $ $Date: 23.08.2012$11 * @author 2012, last modified by $Author: pharms$11 * @version 1.0 12 * @author Patrick Harms 12 13 */ 13 14 public class MFCComboBox extends MFCGUIElement implements IComboBox { 14 15 15 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 16 21 private static final long serialVersionUID = 1L; 17 22 18 23 /** 19 24 * <p> 20 * TODO: comment25 * Constructor. Creates a new MFCComboBox. 21 26 * </p> 22 * 27 * 23 28 * @param specification 29 * specification of created GUI element 24 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 25 33 */ 26 34 public MFCComboBox(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCDialog.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment8 * Class that represents dialogs in MFC GUIs. 8 9 * </p> 9 10 * 10 * @version $Revision: $ $Date: 21.08.2012$11 * @author 2012, last modified by $Author: pharms$11 * @version 1.0 12 * @author Patrick Harms 12 13 */ 13 14 public class MFCDialog extends MFCWindow implements IDialog { 14 15 15 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 16 21 private static final long serialVersionUID = 1L; 17 22 18 23 /** 19 24 * <p> 20 * TODO: comment25 * Constructor. Creates a new MFCDialog. 21 26 * </p> 22 * 27 * 23 28 * @param specification 29 * specification of created GUI element 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 24 33 */ 25 34 public MFCDialog(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCGUIElement.java
r681 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 6 7 /** 7 * TODO comment 8 * <p> 9 * Base class that represents GUI element in MFC GUIs. 10 * </p> 8 11 * 9 * @version $Revision: $ $Date: $10 * @author 2011, last modified by $Author: $12 * @version 1.0 13 * @author Patrick Harms 11 14 */ 12 15 public abstract class MFCGUIElement extends AbstractDefaultGUIElement { 13 14 /** */ 16 17 /** 18 * <p> 19 * Id for object serialization. 20 * </p> 21 */ 15 22 private static final long serialVersionUID = 1L; 16 23 17 24 /** 18 * @param name 19 * @param id 20 * @param isModal 25 * <p> 26 * Constructor. Creates a new MFCGUIElement. 27 * </p> 28 * 29 * @param specification 30 * specification of created GUI element 31 * @param parent 32 * parent of the created GUI element; null means that the element is a top-level 33 * window 21 34 */ 22 35 public MFCGUIElement(MFCGUIElementSpec specification, MFCGUIElement parent) { … … 24 37 } 25 38 26 /* (non-Javadoc) 39 /* 40 * (non-Javadoc) 41 * 27 42 * @see de.ugoe.cs.quest.eventcore.IEventTarget#getPlatform() 28 43 */ … … 33 48 34 49 /** 35 * @return Returns the id. 50 * <p> 51 * Returns the HWND (Id) of the GUI element. 52 * </p> 53 * 54 * @return the HWND (Id) 36 55 */ 37 56 public String getId() { … … 40 59 41 60 /** 42 * @return Returns the name. 61 * <p> 62 * Returns the type of the GUI element. 63 * </p> 64 * 65 * @return the type 43 66 */ 44 67 public String getType() { … … 47 70 48 71 /** 49 * @return Returns the name. 72 * <p> 73 * Returns the name of the GUI element. 74 * </p> 75 * 76 * @return the name 50 77 */ 51 78 public String getName() { … … 54 81 55 82 /** 56 * @return Returns the isModal. 83 * <p> 84 * Returns the modality of the GUI element. 85 * </p> 86 * 87 * @return the modality 57 88 */ 58 89 public boolean isModal() { … … 62 93 /** 63 94 * <p> 64 * TODO: comment95 * Returns the resource Id of the GUI element. 65 96 * </p> 66 * 67 * @return 97 * 98 * @return the resource Id 68 99 */ 69 100 public int getResourceId() { … … 71 102 } 72 103 73 /* (non-Javadoc) 74 * @see de.ugoe.cs.quest.eventcore.guimodel.IGUIElement#updateSpecification(de.ugoe.cs.quest.eventcore.guimodel.IGUIElementSpec) 104 /* 105 * (non-Javadoc) 106 * 107 * @see 108 * de.ugoe.cs.quest.eventcore.guimodel.IGUIElement#updateSpecification(de.ugoe.cs.quest.eventcore 109 * .guimodel.IGUIElementSpec) 75 110 */ 76 111 @Override … … 78 113 ((MFCGUIElementSpec) super.getSpecification()).update(furtherSpec); 79 114 } 80 115 116 /* 117 * (non-Javadoc) 118 * 119 * @see de.ugoe.cs.quest.eventcore.IEventTarget#getStringIdentifier() 120 */ 81 121 @Override 82 122 public String getStringIdentifier() { 83 123 String str = this.toString(); 84 if ( getParent()!=null) {124 if (getParent() != null) { 85 125 return getParent().getStringIdentifier() + "->" + str; 86 126 } … … 88 128 } 89 129 90 /* (non-Javadoc) 130 /* 131 * (non-Javadoc) 132 * 91 133 * @see java.lang.Object#toString() 92 134 */ … … 98 140 /** 99 141 * <p> 100 * TODO: comment142 * Returns the XML representation of the GUI element. 101 143 * </p> 144 * 145 * @return the XML representation 102 146 */ 103 147 public String toXML() { 104 148 if (getParent() != null) { 105 return 106 ((MFCGUIElement) getParent()).toXML() + 149 return ((MFCGUIElement) getParent()).toXML() + 107 150 ((MFCGUIElementSpec) super.getSpecification()).toXML(); 108 151 } -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCGUIElementSpec.java
r832 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 99 100 * modality of the window 100 101 */ 101 protected MFCGUIElementSpec(long hwnd, 102 String name, 103 int resourceId, 104 String type, 105 boolean isModal) 102 protected MFCGUIElementSpec(long hwnd, String name, int resourceId, String type, boolean isModal) 106 103 { 107 104 this.hwnd = hwnd; … … 121 118 public String getName() { 122 119 StringBuffer names = new StringBuffer(); 123 120 124 121 if (name != null) { 125 122 names.append('"'); … … 130 127 names.append("NOT_SET"); 131 128 } 132 129 133 130 if (formerNames.size() > 0) { 134 131 135 132 names.append(" (aka "); 136 133 137 134 for (int i = 0; i < formerNames.size(); i++) { 138 135 if (i > 0) { … … 144 141 names.append('"'); 145 142 } 146 143 147 144 names.append(")"); 148 145 } 149 146 150 147 return names.toString(); 151 148 } … … 173 170 } 174 171 175 /* (non-Javadoc) 172 /* 173 * (non-Javadoc) 174 * 176 175 * @see de.ugoe.cs.quest.eventcore.guimodel.IGUIElementSpec#getType() 177 176 */ … … 183 182 /** 184 183 * <p> 185 * TODO: comment186 * </p> 187 * 188 * @return 184 * Returns the modality of the specified GUI element. 185 * </p> 186 * 187 * @return the modality 189 188 */ 190 189 public boolean isModal() { … … 201 200 */ 202 201 public void setName(String newName) { 203 if ((this.name != null) && 204 (!this.name.equals(newName)) && 202 if ((this.name != null) && (!this.name.equals(newName)) && 205 203 (!this.formerNames.contains(this.name))) 206 204 { 207 205 this.formerNames.add(this.name); 208 206 } 209 207 210 208 this.name = newName; 211 209 } … … 223 221 this.formerHwnds.add(this.hwnd); 224 222 } 225 223 226 224 this.hwnd = newHwnd; 227 225 } 228 226 229 /* (non-Javadoc) 230 * @see de.ugoe.cs.quest.eventcore.guimodel.IGUIElementSpec#getSimilarity(de.ugoe.cs.quest.eventcore.guimodel.IGUIElementSpec) 227 /* 228 * (non-Javadoc) 229 * 230 * @see 231 * de.ugoe.cs.quest.eventcore.guimodel.IGUIElementSpec#getSimilarity(de.ugoe.cs.quest.eventcore 232 * .guimodel.IGUIElementSpec) 231 233 */ 232 234 @Override 233 235 public boolean getSimilarity(IGUIElementSpec other) { 234 236 235 237 if (this == other) { 236 238 return true; 237 239 } 238 240 239 241 if (!(other instanceof MFCGUIElementSpec)) { 240 242 return false; 241 243 } 242 244 243 245 MFCGUIElementSpec otherSpec = (MFCGUIElementSpec) other; 244 246 … … 260 262 // and reopend, i.e. a new instance is created. If one of them stays the same, then 261 263 // similarity is given. Therefore these are the first two comparisons 262 264 263 265 if (hwnd == otherSpec.hwnd) { 264 266 return true; 265 267 } 266 268 267 269 if ((name != null) && (name.equals(otherSpec.name))) { 268 270 return true; 269 271 } 270 271 if ((((name == null) && (otherSpec.name == null)) || 272 (("".equals(name)) && ("".equals(otherSpec.name)))) && 273 (formerNames.size() == 0) && (otherSpec.formerNames.size() == 0)) 272 273 if ((((name == null) && (otherSpec.name == null)) || (("".equals(name)) && ("" 274 .equals(otherSpec.name)))) && 275 (formerNames.size() == 0) && 276 (otherSpec.formerNames.size() == 0)) 274 277 { 275 278 return true; 276 279 } 277 280 278 281 // if the hwnd and the name did not stay the same, then the name should be checked first. 279 282 // The current name of one of the specs must be contained in the former names of the … … 291 294 return true; 292 295 } 293 296 294 297 // ok. Even the names do not match. This is usually a clear indication, that the elements 295 298 // are distinct. However, we check, if the former handles matched. This is very unlikely … … 302 305 303 306 // now we can be really sure, that the GUI elements differ 304 307 305 308 return false; 306 309 } 307 310 308 /* (non-Javadoc) 311 /* 312 * (non-Javadoc) 313 * 309 314 * @see de.ugoe.cs.quest.eventcore.guimodel.IGUIElementSpec#equals(IGUIElementSpec) 310 315 */ 311 316 @Override 312 317 public boolean equals(Object other) { 313 318 314 319 if (this == other) { 315 320 return true; 316 321 } 317 322 318 323 if (!(other instanceof MFCGUIElementSpec)) { 319 324 return false; 320 325 } 321 326 322 327 MFCGUIElementSpec otherSpec = (MFCGUIElementSpec) other; 323 324 return 325 (hwnd == otherSpec.hwnd) && (isModal == otherSpec.isModal) && 328 329 return (hwnd == otherSpec.hwnd) && (isModal == otherSpec.isModal) && 326 330 (resourceId == otherSpec.resourceId) && 327 331 ((type == otherSpec.type) || ((type != null) && (type.equals(otherSpec.type)))) && … … 329 333 } 330 334 331 /* (non-Javadoc) 335 /* 336 * (non-Javadoc) 337 * 332 338 * @see java.lang.Object#hashCode() 333 339 */ … … 340 346 /** 341 347 * <p> 342 * Returns a string ident fier of the window:<br>348 * Returns a string identifier of the window:<br> 343 349 * {@code [resourceId;"windowName";"className";modality]} 344 350 * </p> … … 348 354 @Override 349 355 public String toString() { 350 return "[" + resourceId + ";" + getName() + ";\"" + type + "\";" + isModal + ";" + 351 hwnd + "]"; 352 } 353 354 /** 355 * <p> 356 * TODO: comment 357 * </p> 356 return "[" + resourceId + ";" + getName() + ";\"" + type + "\";" + isModal + ";" + hwnd + 357 "]"; 358 } 359 360 /** 361 * <p> 362 * Returns the XML representation of this specification. 363 * </p> 364 * 365 * @return the XML representation 358 366 */ 359 367 String toXML() { 360 return 361 "<window name=\"" + (name != null ? StringTools.xmlEntityReplacement(name) : "") + 362 "\" class=\"" + StringTools.xmlEntityReplacement(type) + 363 "\" resourceId=\"" + resourceId + "\" isModal=\"" + 364 isModal + "\"/>"; 365 } 366 367 /** 368 * <p> 369 * TODO: comment 370 * </p> 371 * 368 return "<window name=\"" + (name != null ? StringTools.xmlEntityReplacement(name) : "") + 369 "\" class=\"" + StringTools.xmlEntityReplacement(type) + "\" resourceId=\"" + 370 resourceId + "\" isModal=\"" + isModal + "\"/>"; 371 } 372 373 /** 374 * <p> 375 * Updates the specification with another specification. 376 * </p> 377 * 372 378 * @param furtherSpec 379 * specification used to update the current specification 373 380 */ 374 381 void update(IGUIElementSpec furtherSpec) { 375 382 MFCGUIElementSpec other = (MFCGUIElementSpec) furtherSpec; 376 383 377 384 if (other != this) { 378 385 for (long formerHwnd : other.formerHwnds) { … … 388 395 } 389 396 390 if ((name != other.name) && (name != null) && (!name.equals(other.name))) 391 { 397 if ((name != other.name) && (name != null) && (!name.equals(other.name))) { 392 398 setName(other.name); 393 399 } -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCListBox.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment8 * Class that represents list boxes in MFC GUIs. 8 9 * </p> 9 10 * 10 * @version $Revision: $ $Date: 23.08.2012$11 * @author 2012, last modified by $Author: pharms$11 * @version 1.0 12 * @author Patrick Harms 12 13 */ 13 14 public class MFCListBox extends MFCGUIElement implements IListBox { 14 15 15 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 16 21 private static final long serialVersionUID = 1L; 17 22 18 23 /** 19 24 * <p> 20 * TODO: comment25 * Constructor. Creates a new MFCListBox. 21 26 * </p> 22 * 27 * 23 28 * @param specification 29 * specification of created GUI element 24 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 25 33 */ 26 34 public MFCListBox(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCPanel.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment8 * Class that represents panels in MFC GUIs. 8 9 * </p> 9 10 * 10 * @version $Revision: $ $Date: 23.08.2012$11 * @author 2012, last modified by $Author: pharms$11 * @version 1.0 12 * @author Patrick Harms 12 13 */ 13 14 public class MFCPanel extends MFCGUIElement implements IPanel { 14 15 15 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 16 21 private static final long serialVersionUID = 1L; 17 22 18 23 /** 19 24 * <p> 20 * TODO: comment25 * Constructor. Creates a new MFCPanel. 21 26 * </p> 22 * 27 * 23 28 * @param specification 29 * specification of created GUI element 24 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 25 33 */ 26 34 public MFCPanel(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCTabbedPane.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment8 * Class that represents tabbed panes in MFC GUIs. 8 9 * </p> 9 10 * 10 * @version $Revision: $ $Date: 23.08.2012$11 * @author 2012, last modified by $Author: pharms$11 * @version 1.0 12 * @author Patrick Harms 12 13 */ 13 14 public class MFCTabbedPane extends MFCGUIElement implements ITabbedPane { 14 15 15 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 16 21 private static final long serialVersionUID = 1L; 17 22 18 23 /** 19 24 * <p> 20 * TODO: comment25 * Constructor. Creates a new TabbedPane. 21 26 * </p> 22 * 27 * 23 28 * @param specification 29 * specification of created GUI element 24 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 25 33 */ 26 34 public MFCTabbedPane(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCTextArea.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment8 * Class that represents text areas in MFC GUIs. 8 9 * </p> 9 10 * 10 * @version $Revision: $ $Date: 21.08.2012$11 * @author 2012, last modified by $Author: pharms$11 * @version 1.0 12 * @author Patrick Harms 12 13 */ 13 14 public class MFCTextArea extends MFCGUIElement implements ITextArea { 14 15 15 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 16 21 private static final long serialVersionUID = 1L; 17 22 18 23 /** 19 24 * <p> 20 * TODO: comment25 * Constructor. Creates a new MFCTextArea. 21 26 * </p> 22 * 27 * 23 28 * @param specification 29 * specification of created GUI element 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 24 33 */ 25 34 public MFCTextArea(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCToolBar.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment8 * Class that represents tool bars in MFC GUIs. 8 9 * </p> 9 10 * 10 * @version $Revision: $ $Date: 23.08.2012$11 * @author 2012, last modified by $Author: pharms$11 * @version 1.0 12 * @author Patrick Harms 12 13 */ 13 14 public class MFCToolBar extends MFCGUIElement implements IToolBar { 14 15 15 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 16 21 private static final long serialVersionUID = 1L; 17 22 18 23 /** 19 24 * <p> 20 * TODO: comment25 * Constructor. Creates a new MFCToolBar. 21 26 * </p> 22 * 27 * 23 28 * @param specification 29 * specification of created GUI element 24 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 25 33 */ 26 34 public MFCToolBar(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCTrackBar.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 5 6 /** 6 7 * <p> 7 * TODO comment8 * Class that represents track bars in MFC GUIs. 8 9 * </p> 9 10 * 10 * @version $Revision: $ $Date: 23.08.2012$11 * @author 2012, last modified by $Author: pharms$11 * @version 1.0 12 * @author Patrick Harms 12 13 */ 13 14 public class MFCTrackBar extends MFCGUIElement implements ITrackBar { 14 15 15 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 16 21 private static final long serialVersionUID = 1L; 17 22 18 23 /** 19 24 * <p> 20 * TODO: comment25 * Constructor. Creates a new MFCTrackBar. 21 26 * </p> 22 * 27 * 23 28 * @param specification 29 * specification of created GUI element 24 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 25 33 */ 26 34 public MFCTrackBar(MFCGUIElementSpec specification, MFCGUIElement parent) { -
trunk/quest-plugin-mfc/src/main/java/de/ugoe/cs/quest/plugin/mfc/guimodel/MFCWindow.java
r655 r837 1 1 2 package de.ugoe.cs.quest.plugin.mfc.guimodel; 2 3 … … 4 5 5 6 /** 6 * TODO comment 7 * <p> 8 * Class that represents windows in MFC GUIs. 9 * </p> 7 10 * 8 * @version $Revision: $ $Date: $9 * @author 2011, last modified by $Author: $11 * @version 1.0 12 * @author Patrick Harms 10 13 */ 11 14 public class MFCWindow extends MFCGUIElement implements IFrame { 12 15 13 /** */ 16 /** 17 * <p> 18 * Id for object serialization. 19 * </p> 20 */ 14 21 private static final long serialVersionUID = 1L; 15 22 16 23 /** 17 * @param name 18 * @param id 19 * @param isModal 24 * <p> 25 * Constructor. Creates a new MFCWindow. 26 * </p> 27 * 28 * @param specification 29 * specification of created GUI element 30 * @param parent 31 * parent of the created GUI element; null means that the element is a top-level 32 * window 20 33 */ 21 34 public MFCWindow(MFCGUIElementSpec specification, MFCGUIElement parent) { -
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.