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_Bug70904Test extends LayoutTestCase { 33 34 public ALT_Bug70904Test(String name) { 35 super(name); 36 try { 37 className = this.getClass().getName(); 38 className = className.substring(className.lastIndexOf('.') + 1, className.length()); 39 startingFormFile = FileUtil.toFileObject(new File (url.getFile() + goldenFilesPath + className + "-StartingForm.form").getCanonicalFile()); 40 } catch (IOException ioe) { 41 fail(ioe.toString()); 42 } 43 } 44 45 public void doChanges0() { 48 ld.externalSizeChangeHappened(); 49 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 51 compBounds.put("jLabel1", new Rectangle (0, 3, 34, 14)); 52 baselinePosition.put("jLabel1-34-14", new Integer (11)); 53 compPrefSize.put("jLabel1", new Dimension (34, 14)); 54 compBounds.put("jTextField1", new Rectangle (38, 0, 59, 20)); 55 baselinePosition.put("jTextField1-59-20", new Integer (14)); 56 compPrefSize.put("jTextField1", new Dimension (59, 20)); 57 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 58 compBounds.put("jLabel1", new Rectangle (0, 3, 34, 14)); 59 baselinePosition.put("jLabel1-34-14", new Integer (11)); 60 compBounds.put("jTextField1", new Rectangle (38, 0, 59, 20)); 61 baselinePosition.put("jTextField1-59-20", new Integer (14)); 62 ld.updateCurrentState(); 63 baselinePosition.put("Form-400-300", new Integer (-1)); 66 prefPaddingInParent.put("Form-jTextField1-0-1", new Integer (10)); prefPaddingInParent.put("Form-jLabel1-1-1", new Integer (11)); prefPaddingInParent.put("Form-jTextField1-1-1", new Integer (11)); { 70 String [] compIds = new String [] { 71 "Form" 72 }; 73 Rectangle [] bounds = new Rectangle [] { 74 new Rectangle (0, 0, 400, 300) 75 }; 76 Point hotspot = new Point (400,301); 77 int[] resizeEdges = new int[] { 78 1, 79 1 80 }; 81 boolean inLayout = false; 82 ld.startResizing(compIds, bounds, hotspot, resizeEdges, inLayout); 83 } 84 { 87 Point p = new Point (92,24); 88 String containerId = null; 89 boolean autoPositioning = true; 90 boolean lockDimension = false; 91 Rectangle [] bounds = new Rectangle [] { 92 new Rectangle (0, 0, 97, 20) 93 }; 94 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 95 } 96 { 99 Point p = new Point (92,23); 100 String containerId = null; 101 boolean autoPositioning = true; 102 boolean lockDimension = false; 103 Rectangle [] bounds = new Rectangle [] { 104 new Rectangle (0, 0, 97, 20) 105 }; 106 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 107 } 108 contInterior.put("Form", new Rectangle (0, 0, 97, 20)); 111 compBounds.put("jLabel1", new Rectangle (0, 3, 34, 14)); 112 baselinePosition.put("jLabel1-34-14", new Integer (11)); 113 compPrefSize.put("jLabel1", new Dimension (34, 14)); 114 compBounds.put("jTextField1", new Rectangle (38, 0, 59, 20)); 115 baselinePosition.put("jTextField1-59-20", new Integer (14)); 116 compPrefSize.put("jTextField1", new Dimension (59, 20)); 117 compPrefSize.put("jLabel1", new Dimension (34, 14)); 118 prefPadding.put("jLabel1-jTextField1-0-0-0", new Integer (4)); compPrefSize.put("jTextField1", new Dimension (59, 20)); 120 compPrefSize.put("jLabel1", new Dimension (34, 14)); 121 compPrefSize.put("jTextField1", new Dimension (59, 20)); 122 ld.endMoving(true); 123 ld.externalSizeChangeHappened(); 125 contInterior.put("Form", new Rectangle (0, 0, 97, 20)); 127 compBounds.put("jLabel1", new Rectangle (0, 3, 34, 14)); 128 baselinePosition.put("jLabel1-34-14", new Integer (11)); 129 compPrefSize.put("jLabel1", new Dimension (34, 14)); 130 compBounds.put("jTextField1", new Rectangle (38, 0, 59, 20)); 131 baselinePosition.put("jTextField1-59-20", new Integer (14)); 132 compPrefSize.put("jTextField1", new Dimension (59, 20)); 133 compPrefSize.put("jLabel1", new Dimension (34, 14)); 134 prefPadding.put("jLabel1-jTextField1-0-0-0", new Integer (4)); compPrefSize.put("jTextField1", new Dimension (59, 20)); 136 compPrefSize.put("jLabel1", new Dimension (34, 14)); 137 compPrefSize.put("jTextField1", new Dimension (59, 20)); 138 contInterior.put("Form", new Rectangle (0, 0, 97, 20)); 139 compBounds.put("jLabel1", new Rectangle (0, 3, 34, 14)); 140 baselinePosition.put("jLabel1-34-14", new Integer (11)); 141 compBounds.put("jTextField1", new Rectangle (38, 0, 59, 20)); 142 baselinePosition.put("jTextField1-59-20", new Integer (14)); 143 ld.updateCurrentState(); 144 } 146 147 public void doChanges1() { 150 baselinePosition.put("jTextField1-59-20", new Integer (14)); 152 compPrefSize.put("jTextField1", new Dimension (59, 20)); 153 { 154 String [] compIds = new String [] { 155 "jTextField1" 156 }; 157 Rectangle [] bounds = new Rectangle [] { 158 new Rectangle (38, 0, 59, 20) 159 }; 160 Point hotspot = new Point (99,10); 161 int[] resizeEdges = new int[] { 162 1, 163 -1 164 }; 165 boolean inLayout = true; 166 ld.startResizing(compIds, bounds, hotspot, resizeEdges, inLayout); 167 } 168 prefPaddingInParent.put("Form-jTextField1-0-1", new Integer (10)); { 172 Point p = new Point (128,12); 173 String containerId= "Form"; 174 boolean autoPositioning = true; 175 boolean lockDimension = false; 176 Rectangle [] bounds = new Rectangle [] { 177 new Rectangle (38, 0, 88, 20) 178 }; 179 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 180 } 181 prefPaddingInParent.put("Form-jTextField1-0-1", new Integer (10)); { 185 Point p = new Point (129,12); 186 String containerId= "Form"; 187 boolean autoPositioning = true; 188 boolean lockDimension = false; 189 Rectangle [] bounds = new Rectangle [] { 190 new Rectangle (38, 0, 89, 20) 191 }; 192 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 193 } 194 compPrefSize.put("jLabel1", new Dimension (34, 14)); 197 prefPadding.put("jLabel1-jTextField1-0-0-0", new Integer (4)); prefPaddingInParent.put("Form-jTextField1-0-1", new Integer (10)); compPrefSize.put("jLabel1", new Dimension (34, 14)); 200 compPrefSize.put("jTextField1", new Dimension (59, 20)); 201 ld.endMoving(true); 202 ld.externalSizeChangeHappened(); 204 contInterior.put("Form", new Rectangle (0, 0, 137, 20)); 206 compBounds.put("jLabel1", new Rectangle (0, 3, 34, 14)); 207 baselinePosition.put("jLabel1-34-14", new Integer (11)); 208 compPrefSize.put("jLabel1", new Dimension (34, 14)); 209 compBounds.put("jTextField1", new Rectangle (38, 0, 89, 20)); 210 baselinePosition.put("jTextField1-89-20", new Integer (14)); 211 compPrefSize.put("jTextField1", new Dimension (59, 20)); 212 compPrefSize.put("jLabel1", new Dimension (34, 14)); 213 prefPadding.put("jLabel1-jTextField1-0-0-0", new Integer (4)); prefPaddingInParent.put("Form-jTextField1-0-1", new Integer (10)); compPrefSize.put("jLabel1", new Dimension (34, 14)); 216 compPrefSize.put("jTextField1", new Dimension (59, 20)); 217 contInterior.put("Form", new Rectangle (0, 0, 137, 20)); 218 compBounds.put("jLabel1", new Rectangle (0, 3, 34, 14)); 219 baselinePosition.put("jLabel1-34-14", new Integer (11)); 220 compBounds.put("jTextField1", new Rectangle (38, 0, 89, 20)); 221 baselinePosition.put("jTextField1-89-20", new Integer (14)); 222 ld.updateCurrentState(); 223 baselinePosition.put("jTextField1-89-20", new Integer (14)); 226 compPrefSize.put("jTextField1", new Dimension (59, 20)); 227 { 228 String [] compIds = new String [] { 229 "jTextField1" 230 }; 231 Rectangle [] bounds = new Rectangle [] { 232 new Rectangle (38, 0, 89, 20) 233 }; 234 Point hotspot = new Point (80,20); 235 int[] resizeEdges = new int[] { 236 -1, 237 1 238 }; 239 boolean inLayout = true; 240 ld.startResizing(compIds, bounds, hotspot, resizeEdges, inLayout); 241 } 242 prefPaddingInParent.put("Form-jTextField1-1-1", new Integer (11)); { 246 Point p = new Point (80,38); 247 String containerId= "Form"; 248 boolean autoPositioning = true; 249 boolean lockDimension = false; 250 Rectangle [] bounds = new Rectangle [] { 251 new Rectangle (38, 0, 89, 38) 252 }; 253 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 254 } 255 prefPaddingInParent.put("Form-jTextField1-1-1", new Integer (11)); { 259 Point p = new Point (80,39); 260 String containerId= "Form"; 261 boolean autoPositioning = true; 262 boolean lockDimension = false; 263 Rectangle [] bounds = new Rectangle [] { 264 new Rectangle (38, 0, 89, 39) 265 }; 266 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 267 } 268 compPrefSize.put("jLabel1", new Dimension (34, 14)); 271 prefPadding.put("jLabel1-jTextField1-0-0-0", new Integer (4)); prefPaddingInParent.put("Form-jTextField1-0-1", new Integer (10)); compPrefSize.put("jLabel1", new Dimension (34, 14)); 274 ld.endMoving(true); 275 ld.externalSizeChangeHappened(); 277 contInterior.put("Form", new Rectangle (0, 0, 137, 39)); 279 compBounds.put("jLabel1", new Rectangle (0, 12, 34, 14)); 280 baselinePosition.put("jLabel1-34-14", new Integer (11)); 281 compPrefSize.put("jLabel1", new Dimension (34, 14)); 282 compBounds.put("jTextField1", new Rectangle (38, 0, 89, 39)); 283 baselinePosition.put("jTextField1-89-39", new Integer (23)); 284 compPrefSize.put("jTextField1", new Dimension (59, 20)); 285 compPrefSize.put("jLabel1", new Dimension (34, 14)); 286 prefPadding.put("jLabel1-jTextField1-0-0-0", new Integer (4)); prefPaddingInParent.put("Form-jTextField1-0-1", new Integer (10)); compPrefSize.put("jLabel1", new Dimension (34, 14)); 289 contInterior.put("Form", new Rectangle (0, 0, 137, 39)); 290 compBounds.put("jLabel1", new Rectangle (0, 12, 34, 14)); 291 baselinePosition.put("jLabel1-34-14", new Integer (11)); 292 compBounds.put("jTextField1", new Rectangle (38, 0, 89, 39)); 293 baselinePosition.put("jTextField1-89-39", new Integer (23)); 294 ld.updateCurrentState(); 295 baselinePosition.put("jTextField1-89-39", new Integer (23)); 298 compPrefSize.put("jTextField1", new Dimension (59, 20)); 299 { 300 String [] compIds = new String [] { 301 "jTextField1" 302 }; 303 Rectangle [] bounds = new Rectangle [] { 304 new Rectangle (38, 0, 89, 39) 305 }; 306 Point hotspot = new Point (126,22); 307 int[] resizeEdges = new int[] { 308 1, 309 -1 310 }; 311 boolean inLayout = true; 312 ld.startResizing(compIds, bounds, hotspot, resizeEdges, inLayout); 313 } 314 prefPaddingInParent.put("Form-jTextField1-0-1", new Integer (10)); { 318 Point p = new Point (133,23); 319 String containerId= "Form"; 320 boolean autoPositioning = true; 321 boolean lockDimension = false; 322 Rectangle [] bounds = new Rectangle [] { 323 new Rectangle (38, 0, 99, 39) 324 }; 325 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 326 } 327 prefPaddingInParent.put("Form-jTextField1-0-1", new Integer (10)); { 331 Point p = new Point (134,23); 332 String containerId= "Form"; 333 boolean autoPositioning = true; 334 boolean lockDimension = false; 335 Rectangle [] bounds = new Rectangle [] { 336 new Rectangle (38, 0, 99, 39) 337 }; 338 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 339 } 340 compPrefSize.put("jLabel1", new Dimension (34, 14)); 343 ld.endMoving(true); 344 ld.externalSizeChangeHappened(); 346 contInterior.put("Form", new Rectangle (0, 0, 137, 39)); 348 compBounds.put("jLabel1", new Rectangle (0, 12, 34, 14)); 349 baselinePosition.put("jLabel1-34-14", new Integer (11)); 350 compPrefSize.put("jLabel1", new Dimension (34, 14)); 351 compBounds.put("jTextField1", new Rectangle (38, 0, 99, 39)); 352 baselinePosition.put("jTextField1-99-39", new Integer (23)); 353 compPrefSize.put("jTextField1", new Dimension (59, 20)); 354 compPrefSize.put("jLabel1", new Dimension (34, 14)); 355 contInterior.put("Form", new Rectangle (0, 0, 137, 39)); 356 compBounds.put("jLabel1", new Rectangle (0, 12, 34, 14)); 357 baselinePosition.put("jLabel1-34-14", new Integer (11)); 358 compBounds.put("jTextField1", new Rectangle (38, 0, 99, 39)); 359 baselinePosition.put("jTextField1-99-39", new Integer (23)); 360 ld.updateCurrentState(); 361 } 363 364 } 365 | Popular Tags |