1 19 20 package org.netbeans.modules.form.layoutdesign; 21 22 import java.awt.Dimension ; 23 import java.awt.Point ; 24 import java.awt.Rectangle ; 25 import java.io.File ; 26 import java.io.IOException ; 27 import java.util.*; 28 import org.openide.filesystems.FileUtil; 29 30 public class ALT_BorderPositions01Test extends LayoutTestCase { 32 33 public ALT_BorderPositions01Test(String name) { 34 super(name); 35 try { 36 className = this.getClass().getName(); 37 className = className.substring(className.lastIndexOf('.') + 1, className.length()); 38 startingFormFile = FileUtil.toFileObject(new File (url.getFile() + goldenFilesPath + className + "-StartingForm.form").getCanonicalFile()); 39 } catch (IOException ioe) { 40 fail(ioe.toString()); 41 } 42 } 43 44 public void doChanges0() { 46 ld.externalSizeChangeHappened(); 47 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 49 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 50 ld.updateCurrentState(); 51 lc = new LayoutComponent("jPanel1", true, 100, 100); 53 baselinePosition.put("jPanel1-100-100", new Integer (0)); 55 { 56 LayoutComponent[] comps = new LayoutComponent[] { lc }; 57 Rectangle [] bounds = new Rectangle [] { 58 new Rectangle (0, 0, 100, 100) 59 }; 60 String defaultContId = null; 61 Point hotspot = new Point (46,50); 62 ld.startAdding(comps, bounds, hotspot, defaultContId); 63 } 64 prefPaddingInParent.put("Form-jPanel1-1-0", new Integer (11)); prefPaddingInParent.put("Form-jPanel1-1-1", new Integer (11)); prefPaddingInParent.put("Form-jPanel1-0-0", new Integer (10)); prefPaddingInParent.put("Form-jPanel1-0-1", new Integer (10)); { 71 Point p = new Point (45,51); 72 String containerId= "Form"; 73 boolean autoPositioning = true; 74 boolean lockDimension = false; 75 Rectangle [] bounds = new Rectangle [] { 76 new Rectangle (0, 0, 100, 100) 77 }; 78 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 79 } 80 prefPaddingInParent.put("Form-jPanel1-1-0", new Integer (11)); prefPaddingInParent.put("Form-jPanel1-1-1", new Integer (11)); prefPaddingInParent.put("Form-jPanel1-0-0", new Integer (10)); prefPaddingInParent.put("Form-jPanel1-0-1", new Integer (10)); { 87 Point p = new Point (44,51); 88 String containerId= "Form"; 89 boolean autoPositioning = true; 90 boolean lockDimension = false; 91 Rectangle [] bounds = new Rectangle [] { 92 new Rectangle (0, 0, 100, 100) 93 }; 94 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 95 } 96 compPrefSize.put("jPanel1", new Dimension (100, 100)); 99 compPrefSize.put("jPanel1", new Dimension (100, 100)); 100 prefPaddingInParent.put("Form-jPanel1-1-1", new Integer (10)); prefPaddingInParent.put("Form-jPanel1-0-1", new Integer (10)); ld.endMoving(true); 103 ld.externalSizeChangeHappened(); 105 contInterior.put("jPanel1", new Rectangle (0, 0, 100, 100)); 107 compBounds.put("jPanel1", new Rectangle (0, 0, 100, 100)); 108 baselinePosition.put("jPanel1-100-100", new Integer (0)); 109 compMinSize.put("jPanel1", new Dimension (0, 0)); 110 compPrefSize.put("jPanel1", new Dimension (100, 100)); 111 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 112 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 113 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 114 compBounds.put("jPanel1", new Rectangle (0, 0, 100, 100)); 115 baselinePosition.put("jPanel1-100-100", new Integer (0)); 116 contInterior.put("jPanel1", new Rectangle (0, 0, 100, 100)); 117 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 118 compBounds.put("jPanel1", new Rectangle (0, 0, 100, 100)); 119 baselinePosition.put("jPanel1-100-100", new Integer (0)); 120 ld.updateCurrentState(); 121 } 123 124 public void doChanges1() { 126 baselinePosition.put("jPanel1-100-100", new Integer (0)); 128 compMinSize.put("jPanel1", new Dimension (0, 0)); 129 { 130 String [] compIds = new String [] { 131 "jPanel1" 132 }; 133 Rectangle [] bounds = new Rectangle [] { 134 new Rectangle (0, 0, 100, 100) 135 }; 136 Point hotspot = new Point (100,50); 137 int[] resizeEdges = new int[] { 138 1, 139 -1 140 }; 141 boolean inLayout = true; 142 ld.startResizing(compIds, bounds, hotspot, resizeEdges, inLayout); 143 } 144 prefPaddingInParent.put("Form-jPanel1-0-1", new Integer (10)); { 148 Point p = new Point (115,52); 149 String containerId= "Form"; 150 boolean autoPositioning = true; 151 boolean lockDimension = false; 152 Rectangle [] bounds = new Rectangle [] { 153 new Rectangle (0, 0, 115, 100) 154 }; 155 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 156 } 157 prefPaddingInParent.put("Form-jPanel1-0-1", new Integer (10)); { 161 Point p = new Point (116,52); 162 String containerId= "Form"; 163 boolean autoPositioning = true; 164 boolean lockDimension = false; 165 Rectangle [] bounds = new Rectangle [] { 166 new Rectangle (0, 0, 116, 100) 167 }; 168 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 169 } 170 prefPaddingInParent.put("Form-jPanel1-0-1", new Integer (10)); prefPaddingInParent.put("Form-jPanel1-1-1", new Integer (11)); contInterior.put("jPanel1", new Rectangle (-32768, -32768, 116, 100)); 175 compBounds.put("jPanel1", new Rectangle (-32768, -32768, 116, 100)); 176 baselinePosition.put("jPanel1-116-100", new Integer (0)); 177 compMinSize.put("jPanel1", new Dimension (0, 0)); 178 compPrefSize.put("jPanel1", new Dimension (100, 100)); 179 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 180 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 181 ld.endMoving(true); 182 ld.externalSizeChangeHappened(); 184 contInterior.put("jPanel1", new Rectangle (0, 0, 116, 100)); 186 compBounds.put("jPanel1", new Rectangle (0, 0, 116, 100)); 187 baselinePosition.put("jPanel1-116-100", new Integer (0)); 188 compMinSize.put("jPanel1", new Dimension (0, 0)); 189 compPrefSize.put("jPanel1", new Dimension (116, 100)); 190 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 191 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 192 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 193 compBounds.put("jPanel1", new Rectangle (0, 0, 116, 100)); 194 baselinePosition.put("jPanel1-116-100", new Integer (0)); 195 contInterior.put("jPanel1", new Rectangle (0, 0, 116, 100)); 196 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 197 compBounds.put("jPanel1", new Rectangle (0, 0, 116, 100)); 198 baselinePosition.put("jPanel1-116-100", new Integer (0)); 199 ld.updateCurrentState(); 200 baselinePosition.put("jPanel1-116-100", new Integer (0)); 203 compMinSize.put("jPanel1", new Dimension (0, 0)); 204 { 205 String [] compIds = new String [] { 206 "jPanel1" 207 }; 208 Rectangle [] bounds = new Rectangle [] { 209 new Rectangle (0, 0, 116, 100) 210 }; 211 Point hotspot = new Point (54,103); 212 int[] resizeEdges = new int[] { 213 -1, 214 1 215 }; 216 boolean inLayout = true; 217 ld.startResizing(compIds, bounds, hotspot, resizeEdges, inLayout); 218 } 219 prefPaddingInParent.put("Form-jPanel1-1-1", new Integer (11)); { 223 Point p = new Point (54,123); 224 String containerId= "Form"; 225 boolean autoPositioning = true; 226 boolean lockDimension = false; 227 Rectangle [] bounds = new Rectangle [] { 228 new Rectangle (0, 0, 116, 120) 229 }; 230 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 231 } 232 prefPaddingInParent.put("Form-jPanel1-1-1", new Integer (11)); { 236 Point p = new Point (54,124); 237 String containerId= "Form"; 238 boolean autoPositioning = true; 239 boolean lockDimension = false; 240 Rectangle [] bounds = new Rectangle [] { 241 new Rectangle (0, 0, 116, 121) 242 }; 243 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 244 } 245 prefPaddingInParent.put("Form-jPanel1-1-1", new Integer (11)); prefPaddingInParent.put("Form-jPanel1-0-1", new Integer (10)); contInterior.put("jPanel1", new Rectangle (-32768, -32768, 116, 121)); 250 compBounds.put("jPanel1", new Rectangle (-32768, -32768, 116, 121)); 251 baselinePosition.put("jPanel1-116-121", new Integer (0)); 252 compMinSize.put("jPanel1", new Dimension (0, 0)); 253 compPrefSize.put("jPanel1", new Dimension (116, 100)); 254 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 255 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 256 ld.endMoving(true); 257 ld.externalSizeChangeHappened(); 259 contInterior.put("jPanel1", new Rectangle (0, 0, 116, 121)); 261 compBounds.put("jPanel1", new Rectangle (0, 0, 116, 121)); 262 baselinePosition.put("jPanel1-116-121", new Integer (0)); 263 compMinSize.put("jPanel1", new Dimension (0, 0)); 264 compPrefSize.put("jPanel1", new Dimension (116, 121)); 265 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 266 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 267 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 268 compBounds.put("jPanel1", new Rectangle (0, 0, 116, 121)); 269 baselinePosition.put("jPanel1-116-121", new Integer (0)); 270 contInterior.put("jPanel1", new Rectangle (0, 0, 116, 121)); 271 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 272 compBounds.put("jPanel1", new Rectangle (0, 0, 116, 121)); 273 baselinePosition.put("jPanel1-116-121", new Integer (0)); 274 ld.updateCurrentState(); 275 } 277 278 public void doChanges2() { 280 baselinePosition.put("jPanel1-116-121", new Integer (0)); 282 compMinSize.put("jPanel1", new Dimension (0, 0)); 283 { 284 String [] compIds = new String [] { 285 "jPanel1" 286 }; 287 Rectangle [] bounds = new Rectangle [] { 288 new Rectangle (0, 0, 116, 121) 289 }; 290 Point hotspot = new Point (115,120); 291 int[] resizeEdges = new int[] { 292 1, 293 1 294 }; 295 boolean inLayout = true; 296 ld.startResizing(compIds, bounds, hotspot, resizeEdges, inLayout); 297 } 298 prefPaddingInParent.put("Form-jPanel1-1-1", new Integer (11)); prefPaddingInParent.put("Form-jPanel1-0-1", new Integer (10)); { 303 Point p = new Point (394,296); 304 String containerId= "Form"; 305 boolean autoPositioning = true; 306 boolean lockDimension = false; 307 Rectangle [] bounds = new Rectangle [] { 308 new Rectangle (0, 0, 400, 300) 309 }; 310 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 311 } 312 prefPaddingInParent.put("Form-jPanel1-1-1", new Integer (11)); prefPaddingInParent.put("Form-jPanel1-0-1", new Integer (10)); { 317 Point p = new Point (395,296); 318 String containerId= "Form"; 319 boolean autoPositioning = true; 320 boolean lockDimension = false; 321 Rectangle [] bounds = new Rectangle [] { 322 new Rectangle (0, 0, 400, 300) 323 }; 324 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 325 } 326 contInterior.put("jPanel1", new Rectangle (-32768, -32768, 400, 300)); 329 compBounds.put("jPanel1", new Rectangle (-32768, -32768, 400, 300)); 330 baselinePosition.put("jPanel1-400-300", new Integer (0)); 331 compMinSize.put("jPanel1", new Dimension (0, 0)); 332 compPrefSize.put("jPanel1", new Dimension (116, 121)); 333 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 334 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 335 ld.endMoving(true); 336 ld.externalSizeChangeHappened(); 338 contInterior.put("jPanel1", new Rectangle (0, 0, 400, 300)); 340 compBounds.put("jPanel1", new Rectangle (0, 0, 400, 300)); 341 baselinePosition.put("jPanel1-400-300", new Integer (0)); 342 compMinSize.put("jPanel1", new Dimension (0, 0)); 343 compPrefSize.put("jPanel1", new Dimension (400, 300)); 344 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 345 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 346 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 347 compBounds.put("jPanel1", new Rectangle (0, 0, 400, 300)); 348 baselinePosition.put("jPanel1-400-300", new Integer (0)); 349 contInterior.put("jPanel1", new Rectangle (0, 0, 400, 300)); 350 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 351 compBounds.put("jPanel1", new Rectangle (0, 0, 400, 300)); 352 baselinePosition.put("jPanel1-400-300", new Integer (0)); 353 ld.updateCurrentState(); 354 } 356 357 public void doChanges3() { 359 baselinePosition.put("jPanel1-400-300", new Integer (0)); 361 compMinSize.put("jPanel1", new Dimension (0, 0)); 362 { 363 String [] compIds = new String [] { 364 "jPanel1" 365 }; 366 Rectangle [] bounds = new Rectangle [] { 367 new Rectangle (0, 0, 400, 300) 368 }; 369 Point hotspot = new Point (-3,-2); 370 int[] resizeEdges = new int[] { 371 0, 372 0 373 }; 374 boolean inLayout = true; 375 ld.startResizing(compIds, bounds, hotspot, resizeEdges, inLayout); 376 } 377 prefPaddingInParent.put("Form-jPanel1-1-0", new Integer (11)); prefPaddingInParent.put("Form-jPanel1-0-0", new Integer (10)); { 382 Point p = new Point (279,206); 383 String containerId= "Form"; 384 boolean autoPositioning = true; 385 boolean lockDimension = false; 386 Rectangle [] bounds = new Rectangle [] { 387 new Rectangle (282, 208, 118, 92) 388 }; 389 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 390 } 391 prefPaddingInParent.put("Form-jPanel1-1-0", new Integer (11)); prefPaddingInParent.put("Form-jPanel1-0-0", new Integer (10)); { 396 Point p = new Point (280,206); 397 String containerId= "Form"; 398 boolean autoPositioning = true; 399 boolean lockDimension = false; 400 Rectangle [] bounds = new Rectangle [] { 401 new Rectangle (283, 208, 117, 92) 402 }; 403 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 404 } 405 prefPaddingInParent.put("Form-jPanel1-0-0", new Integer (10)); prefPaddingInParent.put("Form-jPanel1-1-0", new Integer (11)); contInterior.put("jPanel1", new Rectangle (-32485, -32560, 117, 92)); 410 compBounds.put("jPanel1", new Rectangle (-32485, -32560, 117, 92)); 411 baselinePosition.put("jPanel1-117-92", new Integer (0)); 412 compMinSize.put("jPanel1", new Dimension (0, 0)); 413 compPrefSize.put("jPanel1", new Dimension (400, 300)); 414 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 415 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 416 ld.endMoving(true); 417 ld.externalSizeChangeHappened(); 419 contInterior.put("jPanel1", new Rectangle (283, 208, 117, 92)); 421 compBounds.put("jPanel1", new Rectangle (283, 208, 117, 92)); 422 baselinePosition.put("jPanel1-117-92", new Integer (0)); 423 compMinSize.put("jPanel1", new Dimension (0, 0)); 424 compPrefSize.put("jPanel1", new Dimension (117, 92)); 425 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 426 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 427 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 428 compBounds.put("jPanel1", new Rectangle (283, 208, 117, 92)); 429 baselinePosition.put("jPanel1-117-92", new Integer (0)); 430 contInterior.put("jPanel1", new Rectangle (283, 208, 117, 92)); 431 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 432 compBounds.put("jPanel1", new Rectangle (283, 208, 117, 92)); 433 baselinePosition.put("jPanel1-117-92", new Integer (0)); 434 ld.updateCurrentState(); 435 } 437 438 public void doChanges4() { 440 baselinePosition.put("jPanel1-117-92", new Integer (0)); 442 compMinSize.put("jPanel1", new Dimension (0, 0)); 443 { 444 String [] compIds = new String [] { 445 "jPanel1" 446 }; 447 Rectangle [] bounds = new Rectangle [] { 448 new Rectangle (283, 208, 117, 92) 449 }; 450 Point hotspot = new Point (401,302); 451 int[] resizeEdges = new int[] { 452 1, 453 1 454 }; 455 boolean inLayout = true; 456 ld.startResizing(compIds, bounds, hotspot, resizeEdges, inLayout); 457 } 458 prefPaddingInParent.put("Form-jPanel1-1-1", new Integer (11)); prefPaddingInParent.put("Form-jPanel1-0-1", new Integer (10)); { 463 Point p = new Point (392,291); 464 String containerId= "Form"; 465 boolean autoPositioning = true; 466 boolean lockDimension = false; 467 Rectangle [] bounds = new Rectangle [] { 468 new Rectangle (283, 208, 107, 81) 469 }; 470 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 471 } 472 prefPaddingInParent.put("Form-jPanel1-1-1", new Integer (11)); prefPaddingInParent.put("Form-jPanel1-0-1", new Integer (10)); { 477 Point p = new Point (391,291); 478 String containerId= "Form"; 479 boolean autoPositioning = true; 480 boolean lockDimension = false; 481 Rectangle [] bounds = new Rectangle [] { 482 new Rectangle (283, 208, 107, 81) 483 }; 484 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 485 } 486 prefPaddingInParent.put("Form-jPanel1-0-0", new Integer (10)); prefPaddingInParent.put("Form-jPanel1-1-0", new Integer (11)); contInterior.put("jPanel1", new Rectangle (-32485, -32560, 107, 81)); 491 compBounds.put("jPanel1", new Rectangle (-32485, -32560, 107, 81)); 492 baselinePosition.put("jPanel1-107-81", new Integer (0)); 493 compMinSize.put("jPanel1", new Dimension (0, 0)); 494 compPrefSize.put("jPanel1", new Dimension (117, 92)); 495 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 496 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 497 ld.endMoving(true); 498 ld.externalSizeChangeHappened(); 500 contInterior.put("jPanel1", new Rectangle (283, 208, 107, 81)); 502 compBounds.put("jPanel1", new Rectangle (283, 208, 107, 81)); 503 baselinePosition.put("jPanel1-107-81", new Integer (0)); 504 compMinSize.put("jPanel1", new Dimension (0, 0)); 505 compPrefSize.put("jPanel1", new Dimension (107, 81)); 506 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 507 hasExplicitPrefSize.put("jPanel1", new Boolean (false)); 508 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 509 compBounds.put("jPanel1", new Rectangle (283, 208, 107, 81)); 510 baselinePosition.put("jPanel1-107-81", new Integer (0)); 511 contInterior.put("jPanel1", new Rectangle (283, 208, 107, 81)); 512 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 513 compBounds.put("jPanel1", new Rectangle (283, 208, 107, 81)); 514 baselinePosition.put("jPanel1-107-81", new Integer (0)); 515 ld.updateCurrentState(); 516 } 518 519 } 520 | Popular Tags |