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_Indent01Test extends LayoutTestCase { 31 32 public ALT_Indent01Test(String name) { 33 super(name); 34 try { 35 className = this.getClass().getName(); 36 className = className.substring(className.lastIndexOf('.') + 1, className.length()); 37 startingFormFile = FileUtil.toFileObject(new File (url.getFile() + goldenFilesPath + className + "-StartingForm.form").getCanonicalFile()); 38 } catch (IOException ioe) { 39 fail(ioe.toString()); 40 } 41 } 42 43 public void doChanges0() { 45 ld.externalSizeChangeHappened(); 46 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 48 compBounds.put("jLabel1", new Rectangle (10, 11, 34, 14)); 49 baselinePosition.put("jLabel1-34-14", new Integer (11)); 50 compPrefSize.put("jLabel1", new Dimension (34, 14)); 51 compBounds.put("jLabel2", new Rectangle (50, 11, 34, 14)); 52 baselinePosition.put("jLabel2-34-14", new Integer (11)); 53 compPrefSize.put("jLabel2", new Dimension (34, 14)); 54 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 55 compBounds.put("jLabel1", new Rectangle (10, 11, 34, 14)); 56 baselinePosition.put("jLabel1-34-14", new Integer (11)); 57 compBounds.put("jLabel2", new Rectangle (50, 11, 34, 14)); 58 baselinePosition.put("jLabel2-34-14", new Integer (11)); 59 ld.updateCurrentState(); 60 lc = new LayoutComponent("jLabel3", false); 62 baselinePosition.put("jLabel3-34-14", new Integer (11)); 64 { 65 LayoutComponent[] comps = new LayoutComponent[] { lc }; 66 Rectangle [] bounds = new Rectangle [] { 67 new Rectangle (0, 0, 34, 14) 68 }; 69 String defaultContId = null; 70 Point hotspot = new Point (13,7); 71 ld.startAdding(comps, bounds, hotspot, defaultContId); 72 } 73 prefPaddingInParent.put("Form-jLabel3-1-0", new Integer (11)); prefPaddingInParent.put("Form-jLabel3-1-1", new Integer (11)); prefPadding.put("jLabel1-jLabel3-1-0-0", new Integer (6)); prefPadding.put("jLabel2-jLabel3-1-0-0", new Integer (6)); prefPadding.put("jLabel3-jLabel1-1-0-0", new Integer (6)); prefPadding.put("jLabel3-jLabel2-1-0-0", new Integer (6)); prefPaddingInParent.put("Form-jLabel3-0-0", new Integer (10)); prefPaddingInParent.put("Form-jLabel3-0-1", new Integer (10)); prefPadding.put("jLabel1-jLabel3-0-0-2", new Integer (10)); prefPadding.put("jLabel2-jLabel3-0-0-2", new Integer (10)); { 86 Point p = new Point (36,41); 87 String containerId= "Form"; 88 boolean autoPositioning = true; 89 boolean lockDimension = false; 90 Rectangle [] bounds = new Rectangle [] { 91 new Rectangle (20, 31, 34, 14) 92 }; 93 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 94 } 95 prefPaddingInParent.put("Form-jLabel3-1-0", new Integer (11)); prefPaddingInParent.put("Form-jLabel3-1-1", new Integer (11)); prefPadding.put("jLabel1-jLabel3-1-0-0", new Integer (6)); prefPadding.put("jLabel2-jLabel3-1-0-0", new Integer (6)); prefPadding.put("jLabel3-jLabel1-1-0-0", new Integer (6)); prefPadding.put("jLabel3-jLabel2-1-0-0", new Integer (6)); prefPaddingInParent.put("Form-jLabel3-0-0", new Integer (10)); prefPaddingInParent.put("Form-jLabel3-0-1", new Integer (10)); prefPadding.put("jLabel1-jLabel3-0-0-2", new Integer (10)); prefPadding.put("jLabel2-jLabel3-0-0-2", new Integer (10)); { 108 Point p = new Point (36,40); 109 String containerId= "Form"; 110 boolean autoPositioning = true; 111 boolean lockDimension = false; 112 Rectangle [] bounds = new Rectangle [] { 113 new Rectangle (20, 31, 34, 14) 114 }; 115 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 116 } 117 compPrefSize.put("jLabel3", new Dimension (34, 14)); 120 compPrefSize.put("jLabel3", new Dimension (34, 14)); 121 prefPaddingInParent.put("Form-jLabel3-0-1", new Integer (10)); prefPaddingInParent.put("Form-jLabel3-1-1", new Integer (10)); ld.endMoving(true); 124 ld.externalSizeChangeHappened(); 126 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 128 compBounds.put("jLabel1", new Rectangle (10, 11, 34, 14)); 129 baselinePosition.put("jLabel1-34-14", new Integer (11)); 130 compPrefSize.put("jLabel1", new Dimension (34, 14)); 131 compBounds.put("jLabel2", new Rectangle (50, 11, 34, 14)); 132 baselinePosition.put("jLabel2-34-14", new Integer (11)); 133 compPrefSize.put("jLabel2", new Dimension (34, 14)); 134 compBounds.put("jLabel3", new Rectangle (20, 31, 34, 14)); 135 baselinePosition.put("jLabel3-34-14", new Integer (11)); 136 compPrefSize.put("jLabel3", new Dimension (34, 14)); 137 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 138 compBounds.put("jLabel1", new Rectangle (10, 11, 34, 14)); 139 baselinePosition.put("jLabel1-34-14", new Integer (11)); 140 compBounds.put("jLabel2", new Rectangle (50, 11, 34, 14)); 141 baselinePosition.put("jLabel2-34-14", new Integer (11)); 142 compBounds.put("jLabel3", new Rectangle (20, 31, 34, 14)); 143 baselinePosition.put("jLabel3-34-14", new Integer (11)); 144 ld.updateCurrentState(); 145 } 147 148 public void doChanges1() { 152 ld.externalSizeChangeHappened(); 153 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 155 compBounds.put("jLabel1", new Rectangle (10, 11, 34, 14)); 156 baselinePosition.put("jLabel1-34-14", new Integer (11)); 157 compPrefSize.put("jLabel1", new Dimension (34, 14)); 158 compBounds.put("jLabel2", new Rectangle (50, 11, 34, 14)); 159 baselinePosition.put("jLabel2-34-14", new Integer (11)); 160 compPrefSize.put("jLabel2", new Dimension (34, 14)); 161 compBounds.put("jLabel3", new Rectangle (20, 31, 52, 14)); 162 baselinePosition.put("jLabel3-52-14", new Integer (11)); 163 compPrefSize.put("jLabel3", new Dimension (52, 14)); 164 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 165 compBounds.put("jLabel1", new Rectangle (10, 11, 34, 14)); 166 baselinePosition.put("jLabel1-34-14", new Integer (11)); 167 compBounds.put("jLabel2", new Rectangle (50, 11, 34, 14)); 168 baselinePosition.put("jLabel2-34-14", new Integer (11)); 169 compBounds.put("jLabel3", new Rectangle (20, 31, 52, 14)); 170 baselinePosition.put("jLabel3-52-14", new Integer (11)); 171 ld.updateCurrentState(); 172 lc = new LayoutComponent("jLabel4", false); 174 baselinePosition.put("jLabel4-34-14", new Integer (11)); 176 { 177 LayoutComponent[] comps = new LayoutComponent[] { lc }; 178 Rectangle [] bounds = new Rectangle [] { 179 new Rectangle (0, 0, 34, 14) 180 }; 181 String defaultContId = null; 182 Point hotspot = new Point (13,7); 183 ld.startAdding(comps, bounds, hotspot, defaultContId); 184 } 185 prefPaddingInParent.put("Form-jLabel4-1-0", new Integer (11)); prefPaddingInParent.put("Form-jLabel4-1-1", new Integer (11)); prefPadding.put("jLabel1-jLabel4-1-0-0", new Integer (6)); prefPadding.put("jLabel2-jLabel4-1-0-0", new Integer (6)); prefPadding.put("jLabel4-jLabel1-1-0-0", new Integer (6)); prefPadding.put("jLabel4-jLabel2-1-0-0", new Integer (6)); prefPadding.put("jLabel3-jLabel4-1-0-0", new Integer (6)); prefPadding.put("jLabel4-jLabel3-1-0-0", new Integer (6)); prefPaddingInParent.put("Form-jLabel4-0-0", new Integer (10)); prefPaddingInParent.put("Form-jLabel4-0-1", new Integer (10)); prefPadding.put("jLabel3-jLabel4-0-0-0", new Integer (6)); prefPadding.put("jLabel1-jLabel4-0-0-2", new Integer (10)); prefPadding.put("jLabel2-jLabel4-0-0-2", new Integer (10)); { 201 Point p = new Point (72,41); 202 String containerId= "Form"; 203 boolean autoPositioning = true; 204 boolean lockDimension = false; 205 Rectangle [] bounds = new Rectangle [] { 206 new Rectangle (59, 31, 34, 14) 207 }; 208 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 209 } 210 prefPaddingInParent.put("Form-jLabel4-1-0", new Integer (11)); prefPaddingInParent.put("Form-jLabel4-1-1", new Integer (11)); prefPadding.put("jLabel1-jLabel4-1-0-0", new Integer (6)); prefPadding.put("jLabel2-jLabel4-1-0-0", new Integer (6)); prefPadding.put("jLabel4-jLabel1-1-0-0", new Integer (6)); prefPadding.put("jLabel4-jLabel2-1-0-0", new Integer (6)); prefPadding.put("jLabel3-jLabel4-1-0-0", new Integer (6)); prefPadding.put("jLabel4-jLabel3-1-0-0", new Integer (6)); prefPaddingInParent.put("Form-jLabel4-0-0", new Integer (10)); prefPaddingInParent.put("Form-jLabel4-0-1", new Integer (10)); prefPadding.put("jLabel3-jLabel4-0-0-0", new Integer (6)); prefPadding.put("jLabel4-jLabel3-0-0-0", new Integer (6)); prefPadding.put("jLabel1-jLabel4-0-0-2", new Integer (10)); prefPadding.put("jLabel2-jLabel4-0-0-2", new Integer (10)); { 227 Point p = new Point (71,41); 228 String containerId= "Form"; 229 boolean autoPositioning = true; 230 boolean lockDimension = false; 231 Rectangle [] bounds = new Rectangle [] { 232 new Rectangle (58, 31, 34, 14) 233 }; 234 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 235 } 236 compPrefSize.put("jLabel4", new Dimension (34, 14)); 239 compPrefSize.put("jLabel4", new Dimension (34, 14)); 240 prefPaddingInParent.put("Form-jLabel4-0-1", new Integer (10)); prefPaddingInParent.put("Form-jLabel2-0-1", new Integer (10)); ld.endMoving(true); 243 ld.externalSizeChangeHappened(); 245 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 247 compBounds.put("jLabel1", new Rectangle (10, 11, 34, 14)); 248 baselinePosition.put("jLabel1-34-14", new Integer (11)); 249 compPrefSize.put("jLabel1", new Dimension (34, 14)); 250 compBounds.put("jLabel2", new Rectangle (50, 11, 34, 14)); 251 baselinePosition.put("jLabel2-34-14", new Integer (11)); 252 compPrefSize.put("jLabel2", new Dimension (34, 14)); 253 compBounds.put("jLabel3", new Rectangle (20, 31, 52, 14)); 254 baselinePosition.put("jLabel3-52-14", new Integer (11)); 255 compPrefSize.put("jLabel3", new Dimension (52, 14)); 256 compBounds.put("jLabel4", new Rectangle (78, 31, 34, 14)); 257 baselinePosition.put("jLabel4-34-14", new Integer (11)); 258 compPrefSize.put("jLabel4", new Dimension (34, 14)); 259 prefPaddingInParent.put("Form-jLabel4-0-1", new Integer (10)); prefPaddingInParent.put("Form-jLabel2-0-1", new Integer (10)); contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 262 compBounds.put("jLabel1", new Rectangle (10, 11, 34, 14)); 263 baselinePosition.put("jLabel1-34-14", new Integer (11)); 264 compBounds.put("jLabel2", new Rectangle (50, 11, 34, 14)); 265 baselinePosition.put("jLabel2-34-14", new Integer (11)); 266 compBounds.put("jLabel3", new Rectangle (20, 31, 52, 14)); 267 baselinePosition.put("jLabel3-52-14", new Integer (11)); 268 compBounds.put("jLabel4", new Rectangle (78, 31, 34, 14)); 269 baselinePosition.put("jLabel4-34-14", new Integer (11)); 270 ld.updateCurrentState(); 271 } 273 274 public void doChanges2() { 276 lc = new LayoutComponent("jLabel5", false); 277 baselinePosition.put("jLabel5-34-14", new Integer (11)); 279 { 280 LayoutComponent[] comps = new LayoutComponent[] { lc }; 281 Rectangle [] bounds = new Rectangle [] { 282 new Rectangle (0, 0, 34, 14) 283 }; 284 String defaultContId = null; 285 Point hotspot = new Point (13,7); 286 ld.startAdding(comps, bounds, hotspot, defaultContId); 287 } 288 prefPaddingInParent.put("Form-jLabel5-1-0", new Integer (11)); prefPaddingInParent.put("Form-jLabel5-1-1", new Integer (11)); prefPadding.put("jLabel1-jLabel5-1-0-0", new Integer (6)); prefPadding.put("jLabel2-jLabel5-1-0-0", new Integer (6)); prefPadding.put("jLabel5-jLabel1-1-0-0", new Integer (6)); prefPadding.put("jLabel5-jLabel2-1-0-0", new Integer (6)); prefPadding.put("jLabel3-jLabel5-1-0-0", new Integer (6)); prefPadding.put("jLabel4-jLabel5-1-0-0", new Integer (6)); prefPadding.put("jLabel5-jLabel3-1-0-0", new Integer (6)); prefPadding.put("jLabel5-jLabel4-1-0-0", new Integer (6)); prefPaddingInParent.put("Form-jLabel5-0-0", new Integer (10)); prefPaddingInParent.put("Form-jLabel5-0-1", new Integer (10)); prefPadding.put("jLabel3-jLabel5-0-0-2", new Integer (10)); prefPadding.put("jLabel4-jLabel5-0-0-2", new Integer (10)); { 305 Point p = new Point (45,57); 306 String containerId= "Form"; 307 boolean autoPositioning = true; 308 boolean lockDimension = false; 309 Rectangle [] bounds = new Rectangle [] { 310 new Rectangle (30, 51, 34, 14) 311 }; 312 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 313 } 314 prefPaddingInParent.put("Form-jLabel5-1-0", new Integer (11)); prefPaddingInParent.put("Form-jLabel5-1-1", new Integer (11)); prefPadding.put("jLabel1-jLabel5-1-0-0", new Integer (6)); prefPadding.put("jLabel2-jLabel5-1-0-0", new Integer (6)); prefPadding.put("jLabel5-jLabel1-1-0-0", new Integer (6)); prefPadding.put("jLabel5-jLabel2-1-0-0", new Integer (6)); prefPadding.put("jLabel3-jLabel5-1-0-0", new Integer (6)); prefPadding.put("jLabel4-jLabel5-1-0-0", new Integer (6)); prefPadding.put("jLabel5-jLabel3-1-0-0", new Integer (6)); prefPadding.put("jLabel5-jLabel4-1-0-0", new Integer (6)); prefPaddingInParent.put("Form-jLabel5-0-0", new Integer (10)); prefPaddingInParent.put("Form-jLabel5-0-1", new Integer (10)); prefPadding.put("jLabel3-jLabel5-0-0-2", new Integer (10)); prefPadding.put("jLabel4-jLabel5-0-0-2", new Integer (10)); { 331 Point p = new Point (44,57); 332 String containerId= "Form"; 333 boolean autoPositioning = true; 334 boolean lockDimension = false; 335 Rectangle [] bounds = new Rectangle [] { 336 new Rectangle (30, 51, 34, 14) 337 }; 338 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 339 } 340 compPrefSize.put("jLabel5", new Dimension (34, 14)); 343 compPrefSize.put("jLabel5", new Dimension (34, 14)); 344 prefPaddingInParent.put("Form-jLabel5-1-1", new Integer (10)); ld.endMoving(true); 346 ld.externalSizeChangeHappened(); 348 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 350 compBounds.put("jLabel1", new Rectangle (10, 11, 34, 14)); 351 baselinePosition.put("jLabel1-34-14", new Integer (11)); 352 compPrefSize.put("jLabel1", new Dimension (34, 14)); 353 compBounds.put("jLabel2", new Rectangle (50, 11, 34, 14)); 354 baselinePosition.put("jLabel2-34-14", new Integer (11)); 355 compPrefSize.put("jLabel2", new Dimension (34, 14)); 356 compBounds.put("jLabel3", new Rectangle (20, 31, 52, 14)); 357 baselinePosition.put("jLabel3-52-14", new Integer (11)); 358 compPrefSize.put("jLabel3", new Dimension (52, 14)); 359 compBounds.put("jLabel4", new Rectangle (78, 31, 34, 14)); 360 baselinePosition.put("jLabel4-34-14", new Integer (11)); 361 compPrefSize.put("jLabel4", new Dimension (34, 14)); 362 compBounds.put("jLabel5", new Rectangle (30, 51, 34, 14)); 363 baselinePosition.put("jLabel5-34-14", new Integer (11)); 364 compPrefSize.put("jLabel5", new Dimension (34, 14)); 365 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 366 compBounds.put("jLabel1", new Rectangle (10, 11, 34, 14)); 367 baselinePosition.put("jLabel1-34-14", new Integer (11)); 368 compBounds.put("jLabel2", new Rectangle (50, 11, 34, 14)); 369 baselinePosition.put("jLabel2-34-14", new Integer (11)); 370 compBounds.put("jLabel3", new Rectangle (20, 31, 52, 14)); 371 baselinePosition.put("jLabel3-52-14", new Integer (11)); 372 compBounds.put("jLabel4", new Rectangle (78, 31, 34, 14)); 373 baselinePosition.put("jLabel4-34-14", new Integer (11)); 374 compBounds.put("jLabel5", new Rectangle (30, 51, 34, 14)); 375 baselinePosition.put("jLabel5-34-14", new Integer (11)); 376 ld.updateCurrentState(); 377 } 379 380 } 381 | Popular Tags |