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_Move01Test extends LayoutTestCase { 32 33 public ALT_Move01Test(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() { 48 ld.externalSizeChangeHappened(); 49 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 51 compBounds.put("jLabel1", new Rectangle (10, 14, 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 (48, 11, 59, 20)); 55 baselinePosition.put("jTextField1-59-20", new Integer (14)); 56 compPrefSize.put("jTextField1", new Dimension (59, 20)); 57 compBounds.put("jLabel2", new Rectangle (32, 40, 34, 14)); 58 baselinePosition.put("jLabel2-34-14", new Integer (11)); 59 compPrefSize.put("jLabel2", new Dimension (34, 14)); 60 compBounds.put("jTextField2", new Rectangle (70, 37, 59, 20)); 61 baselinePosition.put("jTextField2-59-20", new Integer (14)); 62 compPrefSize.put("jTextField2", new Dimension (59, 20)); 63 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 64 compBounds.put("jLabel1", new Rectangle (10, 14, 34, 14)); 65 baselinePosition.put("jLabel1-34-14", new Integer (11)); 66 compBounds.put("jTextField1", new Rectangle (48, 11, 59, 20)); 67 baselinePosition.put("jTextField1-59-20", new Integer (14)); 68 compBounds.put("jLabel2", new Rectangle (32, 40, 34, 14)); 69 baselinePosition.put("jLabel2-34-14", new Integer (11)); 70 compBounds.put("jTextField2", new Rectangle (70, 37, 59, 20)); 71 baselinePosition.put("jTextField2-59-20", new Integer (14)); 72 ld.updateCurrentState(); 73 baselinePosition.put("jTextField2-59-20", new Integer (14)); 76 { 77 String [] compIds = new String [] { 78 "jTextField2" 79 }; 80 Rectangle [] bounds = new Rectangle [] { 81 new Rectangle (70, 37, 59, 20) 82 }; 83 Point hotspot = new Point (100,44); 84 ld.startMoving(compIds, bounds, hotspot); 85 } 86 prefPaddingInParent.put("Form-jTextField2-1-0", new Integer (11)); prefPaddingInParent.put("Form-jTextField2-1-1", new Integer (11)); prefPaddingInParent.put("Form-jTextField2-0-0", new Integer (10)); prefPaddingInParent.put("Form-jTextField2-0-1", new Integer (10)); prefPadding.put("jLabel2-jTextField2-0-0-0", new Integer (4)); prefPadding.put("jLabel1-jTextField2-0-0-2", new Integer (10)); prefPadding.put("jTextField1-jTextField2-0-0-2", new Integer (10)); { 96 Point p = new Point (138,40); 97 String containerId= "Form"; 98 boolean autoPositioning = true; 99 boolean lockDimension = false; 100 Rectangle [] bounds = new Rectangle [] { 101 new Rectangle (108, 37, 59, 20) 102 }; 103 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 104 } 105 prefPaddingInParent.put("Form-jTextField2-1-0", new Integer (11)); prefPaddingInParent.put("Form-jTextField2-1-1", new Integer (11)); prefPaddingInParent.put("Form-jTextField2-0-0", new Integer (10)); prefPaddingInParent.put("Form-jTextField2-0-1", new Integer (10)); prefPadding.put("jLabel2-jTextField2-0-0-0", new Integer (4)); prefPadding.put("jLabel1-jTextField2-0-0-2", new Integer (10)); prefPadding.put("jTextField1-jTextField2-0-0-2", new Integer (10)); { 115 Point p = new Point (139,40); 116 String containerId= "Form"; 117 boolean autoPositioning = true; 118 boolean lockDimension = false; 119 Rectangle [] bounds = new Rectangle [] { 120 new Rectangle (109, 37, 59, 20) 121 }; 122 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 123 } 124 prefPadding.put("jTextField1-jTextField2-0-0-0", new Integer (6)); prefPadding.put("jLabel2-jTextField2-0-0-0", new Integer (4)); prefPaddingInParent.put("Form-jTextField2-0-1", new Integer (10)); ld.endMoving(true); 130 ld.externalSizeChangeHappened(); 132 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 134 compBounds.put("jLabel1", new Rectangle (10, 14, 34, 14)); 135 baselinePosition.put("jLabel1-34-14", new Integer (11)); 136 compPrefSize.put("jLabel1", new Dimension (34, 14)); 137 compBounds.put("jTextField1", new Rectangle (48, 11, 59, 20)); 138 baselinePosition.put("jTextField1-59-20", new Integer (14)); 139 compPrefSize.put("jTextField1", new Dimension (59, 20)); 140 compBounds.put("jLabel2", new Rectangle (32, 40, 34, 14)); 141 baselinePosition.put("jLabel2-34-14", new Integer (11)); 142 compPrefSize.put("jLabel2", new Dimension (34, 14)); 143 compBounds.put("jTextField2", new Rectangle (109, 37, 59, 20)); 144 baselinePosition.put("jTextField2-59-20", new Integer (14)); 145 compPrefSize.put("jTextField2", new Dimension (59, 20)); 146 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 147 compBounds.put("jLabel1", new Rectangle (10, 14, 34, 14)); 148 baselinePosition.put("jLabel1-34-14", new Integer (11)); 149 compBounds.put("jTextField1", new Rectangle (48, 11, 59, 20)); 150 baselinePosition.put("jTextField1-59-20", new Integer (14)); 151 compBounds.put("jLabel2", new Rectangle (32, 40, 34, 14)); 152 baselinePosition.put("jLabel2-34-14", new Integer (11)); 153 compBounds.put("jTextField2", new Rectangle (109, 37, 59, 20)); 154 baselinePosition.put("jTextField2-59-20", new Integer (14)); 155 ld.updateCurrentState(); 156 } 158 159 public void doChanges1() { 162 baselinePosition.put("jTextField2-59-20", new Integer (14)); 164 { 165 String [] compIds = new String [] { 166 "jTextField2" 167 }; 168 Rectangle [] bounds = new Rectangle [] { 169 new Rectangle (109, 37, 59, 20) 170 }; 171 Point hotspot = new Point (138,46); 172 ld.startMoving(compIds, bounds, hotspot); 173 } 174 prefPaddingInParent.put("Form-jTextField2-1-0", new Integer (11)); prefPaddingInParent.put("Form-jTextField2-1-1", new Integer (11)); prefPaddingInParent.put("Form-jTextField2-0-0", new Integer (10)); prefPaddingInParent.put("Form-jTextField2-0-1", new Integer (10)); prefPadding.put("jLabel2-jTextField2-0-0-0", new Integer (4)); { 182 Point p = new Point (224,47); 183 String containerId= "Form"; 184 boolean autoPositioning = true; 185 boolean lockDimension = false; 186 Rectangle [] bounds = new Rectangle [] { 187 new Rectangle (195, 37, 59, 20) 188 }; 189 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 190 } 191 prefPaddingInParent.put("Form-jTextField2-1-0", new Integer (11)); prefPaddingInParent.put("Form-jTextField2-1-1", new Integer (11)); prefPaddingInParent.put("Form-jTextField2-0-0", new Integer (10)); prefPaddingInParent.put("Form-jTextField2-0-1", new Integer (10)); prefPadding.put("jLabel2-jTextField2-0-0-0", new Integer (4)); { 199 Point p = new Point (225,47); 200 String containerId= "Form"; 201 boolean autoPositioning = true; 202 boolean lockDimension = false; 203 Rectangle [] bounds = new Rectangle [] { 204 new Rectangle (196, 37, 59, 20) 205 }; 206 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 207 } 208 prefPadding.put("jTextField1-jTextField2-0-0-0", new Integer (6)); prefPadding.put("jLabel2-jTextField2-0-0-0", new Integer (4)); prefPaddingInParent.put("Form-jTextField2-0-1", new Integer (10)); ld.endMoving(true); 214 ld.externalSizeChangeHappened(); 216 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 218 compBounds.put("jLabel1", new Rectangle (10, 14, 34, 14)); 219 baselinePosition.put("jLabel1-34-14", new Integer (11)); 220 compPrefSize.put("jLabel1", new Dimension (34, 14)); 221 compBounds.put("jTextField1", new Rectangle (48, 11, 59, 20)); 222 baselinePosition.put("jTextField1-59-20", new Integer (14)); 223 compPrefSize.put("jTextField1", new Dimension (59, 20)); 224 compBounds.put("jLabel2", new Rectangle (32, 40, 34, 14)); 225 baselinePosition.put("jLabel2-34-14", new Integer (11)); 226 compPrefSize.put("jLabel2", new Dimension (34, 14)); 227 compBounds.put("jTextField2", new Rectangle (196, 37, 59, 20)); 228 baselinePosition.put("jTextField2-59-20", new Integer (14)); 229 compPrefSize.put("jTextField2", new Dimension (59, 20)); 230 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 231 compBounds.put("jLabel1", new Rectangle (10, 14, 34, 14)); 232 baselinePosition.put("jLabel1-34-14", new Integer (11)); 233 compBounds.put("jTextField1", new Rectangle (48, 11, 59, 20)); 234 baselinePosition.put("jTextField1-59-20", new Integer (14)); 235 compBounds.put("jLabel2", new Rectangle (32, 40, 34, 14)); 236 baselinePosition.put("jLabel2-34-14", new Integer (11)); 237 compBounds.put("jTextField2", new Rectangle (196, 37, 59, 20)); 238 baselinePosition.put("jTextField2-59-20", new Integer (14)); 239 ld.updateCurrentState(); 240 } 242 243 public void doChanges2() { 246 baselinePosition.put("jTextField2-59-20", new Integer (14)); 248 { 249 String [] compIds = new String [] { 250 "jTextField2" 251 }; 252 Rectangle [] bounds = new Rectangle [] { 253 new Rectangle (196, 37, 59, 20) 254 }; 255 Point hotspot = new Point (214,49); 256 ld.startMoving(compIds, bounds, hotspot); 257 } 258 prefPaddingInParent.put("Form-jTextField2-1-0", new Integer (11)); prefPaddingInParent.put("Form-jTextField2-1-1", new Integer (11)); prefPaddingInParent.put("Form-jTextField2-0-0", new Integer (10)); prefPaddingInParent.put("Form-jTextField2-0-1", new Integer (10)); prefPadding.put("jLabel2-jTextField2-0-0-0", new Integer (4)); { 266 Point p = new Point (340,50); 267 String containerId= "Form"; 268 boolean autoPositioning = true; 269 boolean lockDimension = false; 270 Rectangle [] bounds = new Rectangle [] { 271 new Rectangle (322, 37, 59, 20) 272 }; 273 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 274 } 275 prefPaddingInParent.put("Form-jTextField2-1-0", new Integer (11)); prefPaddingInParent.put("Form-jTextField2-1-1", new Integer (11)); prefPaddingInParent.put("Form-jTextField2-0-0", new Integer (10)); prefPaddingInParent.put("Form-jTextField2-0-1", new Integer (10)); prefPadding.put("jLabel2-jTextField2-0-0-0", new Integer (4)); { 283 Point p = new Point (339,50); 284 String containerId= "Form"; 285 boolean autoPositioning = true; 286 boolean lockDimension = false; 287 Rectangle [] bounds = new Rectangle [] { 288 new Rectangle (321, 37, 59, 20) 289 }; 290 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 291 } 292 prefPadding.put("jTextField1-jTextField2-0-0-0", new Integer (6)); prefPadding.put("jLabel2-jTextField2-0-0-0", new Integer (4)); prefPaddingInParent.put("Form-jTextField2-0-1", new Integer (10)); ld.endMoving(true); 298 ld.externalSizeChangeHappened(); 300 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 302 compBounds.put("jLabel1", new Rectangle (10, 14, 34, 14)); 303 baselinePosition.put("jLabel1-34-14", new Integer (11)); 304 compPrefSize.put("jLabel1", new Dimension (34, 14)); 305 compBounds.put("jTextField1", new Rectangle (48, 11, 59, 20)); 306 baselinePosition.put("jTextField1-59-20", new Integer (14)); 307 compPrefSize.put("jTextField1", new Dimension (59, 20)); 308 compBounds.put("jLabel2", new Rectangle (32, 40, 34, 14)); 309 baselinePosition.put("jLabel2-34-14", new Integer (11)); 310 compPrefSize.put("jLabel2", new Dimension (34, 14)); 311 compBounds.put("jTextField2", new Rectangle (321, 37, 59, 20)); 312 baselinePosition.put("jTextField2-59-20", new Integer (14)); 313 compPrefSize.put("jTextField2", new Dimension (59, 20)); 314 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 315 compBounds.put("jLabel1", new Rectangle (10, 14, 34, 14)); 316 baselinePosition.put("jLabel1-34-14", new Integer (11)); 317 compBounds.put("jTextField1", new Rectangle (48, 11, 59, 20)); 318 baselinePosition.put("jTextField1-59-20", new Integer (14)); 319 compBounds.put("jLabel2", new Rectangle (32, 40, 34, 14)); 320 baselinePosition.put("jLabel2-34-14", new Integer (11)); 321 compBounds.put("jTextField2", new Rectangle (321, 37, 59, 20)); 322 baselinePosition.put("jTextField2-59-20", new Integer (14)); 323 ld.updateCurrentState(); 324 } 326 327 } 328 | Popular Tags |