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_Positioning01Test extends LayoutTestCase { 32 33 public ALT_Positioning01Test(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() { 50 ld.externalSizeChangeHappened(); 51 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 53 compBounds.put("jLabel5", new Rectangle (10, 134, 34, 14)); 54 baselinePosition.put("jLabel5-34-14", new Integer (11)); 55 compPrefSize.put("jLabel5", new Dimension (34, 14)); 56 compBounds.put("jTextField4", new Rectangle (331, 133, 59, 20)); 57 baselinePosition.put("jTextField4-59-20", new Integer (14)); 58 compPrefSize.put("jTextField4", new Dimension (59, 20)); 59 compBounds.put("jLabel3", new Rectangle (10, 69, 34, 14)); 60 baselinePosition.put("jLabel3-34-14", new Integer (11)); 61 compPrefSize.put("jLabel3", new Dimension (34, 14)); 62 compBounds.put("jLabel4", new Rectangle (10, 98, 34, 14)); 63 baselinePosition.put("jLabel4-34-14", new Integer (11)); 64 compPrefSize.put("jLabel4", new Dimension (34, 14)); 65 compBounds.put("jTextField1", new Rectangle (331, 55, 59, 20)); 66 baselinePosition.put("jTextField1-59-20", new Integer (14)); 67 compPrefSize.put("jTextField1", new Dimension (59, 20)); 68 compBounds.put("jTextField2", new Rectangle (331, 81, 59, 20)); 69 baselinePosition.put("jTextField2-59-20", new Integer (14)); 70 compPrefSize.put("jTextField2", new Dimension (59, 20)); 71 compBounds.put("jTextField3", new Rectangle (331, 107, 59, 20)); 72 baselinePosition.put("jTextField3-59-20", new Integer (14)); 73 compPrefSize.put("jTextField3", new Dimension (59, 20)); 74 compBounds.put("jTextField5", new Rectangle (331, 159, 59, 20)); 75 baselinePosition.put("jTextField5-59-20", new Integer (14)); 76 compPrefSize.put("jTextField5", new Dimension (59, 20)); 77 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 78 compBounds.put("jLabel5", new Rectangle (10, 134, 34, 14)); 79 baselinePosition.put("jLabel5-34-14", new Integer (11)); 80 compBounds.put("jTextField4", new Rectangle (331, 133, 59, 20)); 81 baselinePosition.put("jTextField4-59-20", new Integer (14)); 82 compBounds.put("jLabel3", new Rectangle (10, 69, 34, 14)); 83 baselinePosition.put("jLabel3-34-14", new Integer (11)); 84 compBounds.put("jLabel4", new Rectangle (10, 98, 34, 14)); 85 baselinePosition.put("jLabel4-34-14", new Integer (11)); 86 compBounds.put("jTextField1", new Rectangle (331, 55, 59, 20)); 87 baselinePosition.put("jTextField1-59-20", new Integer (14)); 88 compBounds.put("jTextField2", new Rectangle (331, 81, 59, 20)); 89 baselinePosition.put("jTextField2-59-20", new Integer (14)); 90 compBounds.put("jTextField3", new Rectangle (331, 107, 59, 20)); 91 baselinePosition.put("jTextField3-59-20", new Integer (14)); 92 compBounds.put("jTextField5", new Rectangle (331, 159, 59, 20)); 93 baselinePosition.put("jTextField5-59-20", new Integer (14)); 94 ld.updateCurrentState(); 95 lc = new LayoutComponent("jButton1", false); 97 baselinePosition.put("jButton1-75-23", new Integer (15)); 99 { 100 LayoutComponent[] comps = new LayoutComponent[] { lc }; 101 Rectangle [] bounds = new Rectangle [] { 102 new Rectangle (0, 0, 75, 23) 103 }; 104 String defaultContId = null; 105 Point hotspot = new Point (33,11); 106 ld.startAdding(comps, bounds, hotspot, defaultContId); 107 } 108 prefPaddingInParent.put("Form-jButton1-1-0", new Integer (11)); prefPaddingInParent.put("Form-jButton1-1-1", new Integer (11)); prefPadding.put("jLabel3-jButton1-1-0-0", new Integer (6)); prefPadding.put("jLabel4-jButton1-1-0-0", new Integer (6)); prefPadding.put("jLabel5-jButton1-1-0-0", new Integer (6)); prefPaddingInParent.put("Form-jButton1-0-0", new Integer (10)); prefPaddingInParent.put("Form-jButton1-0-1", new Integer (10)); prefPadding.put("jTextField5-jButton1-0-0-0", new Integer (6)); prefPadding.put("jButton1-jTextField5-0-0-0", new Integer (6)); prefPadding.put("jLabel5-jButton1-0-0-2", new Integer (10)); prefPadding.put("jTextField4-jButton1-0-0-2", new Integer (10)); { 122 Point p = new Point (64,173); 123 String containerId= "Form"; 124 boolean autoPositioning = true; 125 boolean lockDimension = false; 126 Rectangle [] bounds = new Rectangle [] { 127 new Rectangle (31, 158, 75, 23) 128 }; 129 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 130 } 131 prefPaddingInParent.put("Form-jButton1-1-0", new Integer (11)); prefPaddingInParent.put("Form-jButton1-1-1", new Integer (11)); prefPadding.put("jLabel3-jButton1-1-0-0", new Integer (6)); prefPadding.put("jLabel4-jButton1-1-0-0", new Integer (6)); prefPadding.put("jLabel5-jButton1-1-0-0", new Integer (6)); prefPaddingInParent.put("Form-jButton1-0-0", new Integer (10)); prefPaddingInParent.put("Form-jButton1-0-1", new Integer (10)); prefPadding.put("jTextField5-jButton1-0-0-0", new Integer (6)); prefPadding.put("jButton1-jTextField5-0-0-0", new Integer (6)); prefPadding.put("jLabel5-jButton1-0-0-2", new Integer (10)); prefPadding.put("jTextField4-jButton1-0-0-2", new Integer (10)); { 145 Point p = new Point (64,172); 146 String containerId= "Form"; 147 boolean autoPositioning = true; 148 boolean lockDimension = false; 149 Rectangle [] bounds = new Rectangle [] { 150 new Rectangle (31, 154, 75, 23) 151 }; 152 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 153 } 154 compPrefSize.put("jButton1", new Dimension (75, 23)); 157 compPrefSize.put("jButton1", new Dimension (75, 23)); 158 prefPaddingInParent.put("Form-jButton1-0-0", new Integer (10)); prefPadding.put("jButton1-jTextField5-0-0-0", new Integer (10)); prefPaddingInParent.put("Form-jButton1-1-1", new Integer (10)); ld.endMoving(true); 162 ld.externalSizeChangeHappened(); 164 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 166 compBounds.put("jLabel5", new Rectangle (10, 134, 34, 14)); 167 baselinePosition.put("jLabel5-34-14", new Integer (11)); 168 compPrefSize.put("jLabel5", new Dimension (34, 14)); 169 compBounds.put("jTextField4", new Rectangle (331, 133, 59, 20)); 170 baselinePosition.put("jTextField4-59-20", new Integer (14)); 171 compPrefSize.put("jTextField4", new Dimension (59, 20)); 172 compBounds.put("jLabel3", new Rectangle (10, 69, 34, 14)); 173 baselinePosition.put("jLabel3-34-14", new Integer (11)); 174 compPrefSize.put("jLabel3", new Dimension (34, 14)); 175 compBounds.put("jLabel4", new Rectangle (10, 98, 34, 14)); 176 baselinePosition.put("jLabel4-34-14", new Integer (11)); 177 compPrefSize.put("jLabel4", new Dimension (34, 14)); 178 compBounds.put("jTextField1", new Rectangle (331, 55, 59, 20)); 179 baselinePosition.put("jTextField1-59-20", new Integer (14)); 180 compPrefSize.put("jTextField1", new Dimension (59, 20)); 181 compBounds.put("jTextField2", new Rectangle (331, 81, 59, 20)); 182 baselinePosition.put("jTextField2-59-20", new Integer (14)); 183 compPrefSize.put("jTextField2", new Dimension (59, 20)); 184 compBounds.put("jTextField3", new Rectangle (331, 107, 59, 20)); 185 baselinePosition.put("jTextField3-59-20", new Integer (14)); 186 compPrefSize.put("jTextField3", new Dimension (59, 20)); 187 compBounds.put("jTextField5", new Rectangle (331, 159, 59, 20)); 188 baselinePosition.put("jTextField5-59-20", new Integer (14)); 189 compPrefSize.put("jTextField5", new Dimension (59, 20)); 190 compBounds.put("jButton1", new Rectangle (31, 159, 75, 23)); 191 baselinePosition.put("jButton1-75-23", new Integer (15)); 192 compPrefSize.put("jButton1", new Dimension (75, 23)); 193 prefPaddingInParent.put("Form-jTextField5-1-1", new Integer (11)); prefPaddingInParent.put("Form-jButton1-1-1", new Integer (11)); contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 196 compBounds.put("jLabel5", new Rectangle (10, 134, 34, 14)); 197 baselinePosition.put("jLabel5-34-14", new Integer (11)); 198 compBounds.put("jTextField4", new Rectangle (331, 133, 59, 20)); 199 baselinePosition.put("jTextField4-59-20", new Integer (14)); 200 compBounds.put("jLabel3", new Rectangle (10, 69, 34, 14)); 201 baselinePosition.put("jLabel3-34-14", new Integer (11)); 202 compBounds.put("jLabel4", new Rectangle (10, 98, 34, 14)); 203 baselinePosition.put("jLabel4-34-14", new Integer (11)); 204 compBounds.put("jTextField1", new Rectangle (331, 55, 59, 20)); 205 baselinePosition.put("jTextField1-59-20", new Integer (14)); 206 compBounds.put("jTextField2", new Rectangle (331, 81, 59, 20)); 207 baselinePosition.put("jTextField2-59-20", new Integer (14)); 208 compBounds.put("jTextField3", new Rectangle (331, 107, 59, 20)); 209 baselinePosition.put("jTextField3-59-20", new Integer (14)); 210 compBounds.put("jTextField5", new Rectangle (331, 159, 59, 20)); 211 baselinePosition.put("jTextField5-59-20", new Integer (14)); 212 compBounds.put("jButton1", new Rectangle (31, 159, 75, 23)); 213 baselinePosition.put("jButton1-75-23", new Integer (15)); 214 ld.updateCurrentState(); 215 } 217 218 public void doChanges1() { 223 lc = new LayoutComponent("jButton2", false); 224 baselinePosition.put("jButton2-75-23", new Integer (15)); 226 { 227 LayoutComponent[] comps = new LayoutComponent[] { lc }; 228 Rectangle [] bounds = new Rectangle [] { 229 new Rectangle (0, 0, 75, 23) 230 }; 231 String defaultContId = null; 232 Point hotspot = new Point (33,11); 233 ld.startAdding(comps, bounds, hotspot, defaultContId); 234 } 235 prefPaddingInParent.put("Form-jButton2-1-0", new Integer (11)); prefPaddingInParent.put("Form-jButton2-1-1", new Integer (11)); prefPaddingInParent.put("Form-jButton2-0-0", new Integer (10)); prefPaddingInParent.put("Form-jButton2-0-1", new Integer (10)); prefPadding.put("jButton2-jTextField1-0-0-0", new Integer (6)); { 243 Point p = new Point (263,52); 244 String containerId= "Form"; 245 boolean autoPositioning = true; 246 boolean lockDimension = false; 247 Rectangle [] bounds = new Rectangle [] { 248 new Rectangle (230, 41, 75, 23) 249 }; 250 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 251 } 252 prefPaddingInParent.put("Form-jButton2-1-0", new Integer (11)); prefPaddingInParent.put("Form-jButton2-1-1", new Integer (11)); prefPaddingInParent.put("Form-jButton2-0-0", new Integer (10)); prefPaddingInParent.put("Form-jButton2-0-1", new Integer (10)); prefPadding.put("jButton2-jTextField1-0-0-0", new Integer (6)); { 260 Point p = new Point (263,53); 261 String containerId= "Form"; 262 boolean autoPositioning = true; 263 boolean lockDimension = false; 264 Rectangle [] bounds = new Rectangle [] { 265 new Rectangle (230, 42, 75, 23) 266 }; 267 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 268 } 269 compPrefSize.put("jButton2", new Dimension (75, 23)); 272 compPrefSize.put("jButton2", new Dimension (75, 23)); 273 prefPaddingInParent.put("Form-jButton2-1-0", new Integer (10)); prefPadding.put("jButton2-jLabel3-1-0-0", new Integer (10)); ld.endMoving(true); 276 ld.externalSizeChangeHappened(); 278 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 280 compBounds.put("jLabel5", new Rectangle (10, 134, 34, 14)); 281 baselinePosition.put("jLabel5-34-14", new Integer (11)); 282 compPrefSize.put("jLabel5", new Dimension (34, 14)); 283 compBounds.put("jTextField4", new Rectangle (331, 133, 59, 20)); 284 baselinePosition.put("jTextField4-59-20", new Integer (14)); 285 compPrefSize.put("jTextField4", new Dimension (59, 20)); 286 compBounds.put("jLabel3", new Rectangle (10, 69, 34, 14)); 287 baselinePosition.put("jLabel3-34-14", new Integer (11)); 288 compPrefSize.put("jLabel3", new Dimension (34, 14)); 289 compBounds.put("jLabel4", new Rectangle (10, 98, 34, 14)); 290 baselinePosition.put("jLabel4-34-14", new Integer (11)); 291 compPrefSize.put("jLabel4", new Dimension (34, 14)); 292 compBounds.put("jTextField1", new Rectangle (331, 55, 59, 20)); 293 baselinePosition.put("jTextField1-59-20", new Integer (14)); 294 compPrefSize.put("jTextField1", new Dimension (59, 20)); 295 compBounds.put("jTextField2", new Rectangle (331, 81, 59, 20)); 296 baselinePosition.put("jTextField2-59-20", new Integer (14)); 297 compPrefSize.put("jTextField2", new Dimension (59, 20)); 298 compBounds.put("jTextField3", new Rectangle (331, 107, 59, 20)); 299 baselinePosition.put("jTextField3-59-20", new Integer (14)); 300 compPrefSize.put("jTextField3", new Dimension (59, 20)); 301 compBounds.put("jTextField5", new Rectangle (331, 159, 59, 20)); 302 baselinePosition.put("jTextField5-59-20", new Integer (14)); 303 compPrefSize.put("jTextField5", new Dimension (59, 20)); 304 compBounds.put("jButton1", new Rectangle (31, 159, 75, 23)); 305 baselinePosition.put("jButton1-75-23", new Integer (15)); 306 compPrefSize.put("jButton1", new Dimension (75, 23)); 307 compBounds.put("jButton2", new Rectangle (230, 42, 75, 23)); 308 baselinePosition.put("jButton2-75-23", new Integer (15)); 309 compPrefSize.put("jButton2", new Dimension (75, 23)); 310 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 311 compBounds.put("jLabel5", new Rectangle (10, 134, 34, 14)); 312 baselinePosition.put("jLabel5-34-14", new Integer (11)); 313 compBounds.put("jTextField4", new Rectangle (331, 133, 59, 20)); 314 baselinePosition.put("jTextField4-59-20", new Integer (14)); 315 compBounds.put("jLabel3", new Rectangle (10, 69, 34, 14)); 316 baselinePosition.put("jLabel3-34-14", new Integer (11)); 317 compBounds.put("jLabel4", new Rectangle (10, 98, 34, 14)); 318 baselinePosition.put("jLabel4-34-14", new Integer (11)); 319 compBounds.put("jTextField1", new Rectangle (331, 55, 59, 20)); 320 baselinePosition.put("jTextField1-59-20", new Integer (14)); 321 compBounds.put("jTextField2", new Rectangle (331, 81, 59, 20)); 322 baselinePosition.put("jTextField2-59-20", new Integer (14)); 323 compBounds.put("jTextField3", new Rectangle (331, 107, 59, 20)); 324 baselinePosition.put("jTextField3-59-20", new Integer (14)); 325 compBounds.put("jTextField5", new Rectangle (331, 159, 59, 20)); 326 baselinePosition.put("jTextField5-59-20", new Integer (14)); 327 compBounds.put("jButton1", new Rectangle (31, 159, 75, 23)); 328 baselinePosition.put("jButton1-75-23", new Integer (15)); 329 compBounds.put("jButton2", new Rectangle (230, 42, 75, 23)); 330 baselinePosition.put("jButton2-75-23", new Integer (15)); 331 ld.updateCurrentState(); 332 } 334 335 } 336 | Popular Tags |