Changeset 1722 for trunk/autoquest-plugin-jfc
- Timestamp:
- 09/04/14 16:38:21 (10 years ago)
- Location:
- trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/guimodel/JFCGUIElement.java
r1691 r1722 157 157 // get the Java classname, ignore the package hierarchy if present 158 158 String[] parts = getSpecification().getType().split("\\."); 159 String name = parts[parts.length - 1];160 159 161 160 // find the correct Jacareto index 162 161 // jacareto indices start at 1 163 int jacIndex = getIndex() + 1; 164 165 // FIXME: some class specific hacks 166 if (name.equals("JFrame")) { 167 jacIndex++; 168 } 169 else if (name.equals("JLayeredPane")) { 170 jacIndex--; 171 } 172 else if (name.equals("JTextField")) { 173 jacIndex = 1; 174 } 175 162 int jacIndex = ((JFCGUIElementSpec) getSpecification()).getAltIndex() + 1; 176 163 str = parts[parts.length - 1] + "_(" + jacIndex + ")"; 177 164 -
trunk/autoquest-plugin-jfc/src/main/java/de/ugoe/cs/autoquest/plugin/jfc/guimodel/JFCGUIElementSpec.java
r1080 r1722 77 77 /** 78 78 * <p> 79 * An alternative index of the specified GUI element in its parent element. Each element type is 80 * counted separately. This index is used for replaying programs such as Jacareto. 81 * </p> 82 */ 83 private int altIndex = -1; 84 85 /** 86 * <p> 79 87 * Hash code of the GUI element. Used as unique identifier during its existence. 80 88 * </p> … … 88 96 */ 89 97 private List<Integer> formerElementHashes = new ArrayList<Integer>(); 90 98 91 99 /** 92 100 * <p> … … 203 211 JFCGUIElementSpec otherSpec = (JFCGUIElementSpec) other; 204 212 205 return 206 (name == null ? otherSpec.name == null : name.equals(otherSpec.name)) && 213 return (name == null ? otherSpec.name == null : name.equals(otherSpec.name)) && 207 214 (type == null ? otherSpec.type == null : type.equals(otherSpec.type)) && 208 215 (icon == null ? otherSpec.icon == null : icon.equals(otherSpec.icon)) && … … 294 301 /** 295 302 * <p> 303 * Returns an alternative index of the specified GUI element in its parent element. Each element 304 * type is counted separately. 305 * </p> 306 * 307 * @return the index 308 */ 309 public int getAltIndex() { 310 return altIndex; 311 } 312 313 /** 314 * <p> 296 315 * Returns the object hash of the specified GUI element. 297 316 * </p> … … 301 320 public int getElementHash() { 302 321 return elementHash; 322 } 323 324 /** 325 * <p> 326 * Sets the alternative index. 327 * </p> 328 * 329 * @param newAltIndex 330 * the index 331 */ 332 public void setAltIndex(int newAltIndex) { 333 altIndex = newAltIndex; 303 334 } 304 335 … … 372 403 this.elementHash = newElementHash; 373 404 } 374 405 375 406 /** 376 407 * <p> 377 408 * Sets the type hierarchy of the specified GUI element. 409 * 378 410 * @param typeHierarchy 379 * </p>380 */ 381 public void setTypeHierarchy(List<String> typeHierarchy) {382 411 * </p> 412 */ 413 public void setTypeHierarchy(List<String> typeHierarchy) { 414 this.typeHierarchy = typeHierarchy; 383 415 } 384 416 … … 423 455 @Override 424 456 public String[] getTypeHierarchy() { 425 if (typeHierarchy == null){ 426 return new String[]{(getType())}; 427 } 428 else 429 return typeHierarchy.toArray(new String[typeHierarchy.size()]); 457 if (typeHierarchy == null) { 458 return new String[] 459 { (getType()) }; 460 } 461 else 462 return typeHierarchy.toArray(new String[typeHierarchy.size()]); 430 463 } 431 464
Note: See TracChangeset
for help on using the changeset viewer.