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_Baseline01Test extends LayoutTestCase { 32 33 public ALT_Baseline01Test(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 compBounds.put("jLabel1", new Rectangle (10, 14, 34, 14)); 50 baselinePosition.put("jLabel1-34-14", new Integer (11)); 51 compPrefSize.put("jLabel1", new Dimension (34, 14)); 52 compBounds.put("jTextField1", new Rectangle (48, 11, 59, 20)); 53 baselinePosition.put("jTextField1-59-20", new Integer (14)); 54 compPrefSize.put("jTextField1", new Dimension (59, 20)); 55 compBounds.put("jLabel2", new Rectangle (10, 40, 34, 14)); 56 baselinePosition.put("jLabel2-34-14", new Integer (11)); 57 compPrefSize.put("jLabel2", new Dimension (34, 14)); 58 compBounds.put("jTextField2", new Rectangle (48, 37, 59, 20)); 59 baselinePosition.put("jTextField2-59-20", new Integer (14)); 60 compPrefSize.put("jTextField2", new Dimension (59, 20)); 61 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 62 compBounds.put("jLabel1", new Rectangle (10, 14, 34, 14)); 63 baselinePosition.put("jLabel1-34-14", new Integer (11)); 64 compBounds.put("jTextField1", new Rectangle (48, 11, 59, 20)); 65 baselinePosition.put("jTextField1-59-20", new Integer (14)); 66 compBounds.put("jLabel2", new Rectangle (10, 40, 34, 14)); 67 baselinePosition.put("jLabel2-34-14", new Integer (11)); 68 compBounds.put("jTextField2", new Rectangle (48, 37, 59, 20)); 69 baselinePosition.put("jTextField2-59-20", new Integer (14)); 70 ld.updateCurrentState(); 71 baselinePosition.put("jTextField1-59-20", new Integer (14)); 74 compPrefSize.put("jTextField1", new Dimension (59, 20)); 75 { 76 String [] compIds = new String [] { 77 "jTextField1" 78 }; 79 Rectangle [] bounds = new Rectangle [] { 80 new Rectangle (48, 11, 59, 20) 81 }; 82 Point hotspot = new Point (77,29); 83 int[] resizeEdges = new int[] { 84 -1, 85 1 86 }; 87 boolean inLayout = true; 88 ld.startResizing(compIds, bounds, hotspot, resizeEdges, inLayout); 89 } 90 prefPadding.put("jTextField1-jLabel2-1-0-0", new Integer (6)); prefPadding.put("jTextField1-jTextField2-1-0-0", new Integer (6)); { 95 Point p = new Point (78,63); 96 String containerId= "Form"; 97 boolean autoPositioning = true; 98 boolean lockDimension = false; 99 Rectangle [] bounds = new Rectangle [] { 100 new Rectangle (48, 11, 59, 54) 101 }; 102 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 103 } 104 prefPadding.put("jTextField1-jLabel2-1-0-0", new Integer (6)); prefPadding.put("jTextField1-jTextField2-1-0-0", new Integer (6)); { 109 Point p = new Point (78,64); 110 String containerId= "Form"; 111 boolean autoPositioning = true; 112 boolean lockDimension = false; 113 Rectangle [] bounds = new Rectangle [] { 114 new Rectangle (48, 11, 59, 55) 115 }; 116 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 117 } 118 ld.endMoving(true); 121 ld.externalSizeChangeHappened(); 123 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 125 compBounds.put("jLabel1", new Rectangle (10, 31, 34, 14)); 126 baselinePosition.put("jLabel1-34-14", new Integer (11)); 127 compPrefSize.put("jLabel1", new Dimension (34, 14)); 128 compBounds.put("jLabel2", new Rectangle (10, 75, 34, 14)); 129 baselinePosition.put("jLabel2-34-14", new Integer (11)); 130 compPrefSize.put("jLabel2", new Dimension (34, 14)); 131 compBounds.put("jTextField2", new Rectangle (48, 72, 59, 20)); 132 baselinePosition.put("jTextField2-59-20", new Integer (14)); 133 compPrefSize.put("jTextField2", new Dimension (59, 20)); 134 compBounds.put("jTextField1", new Rectangle (48, 11, 59, 55)); 135 baselinePosition.put("jTextField1-59-55", new Integer (31)); 136 compPrefSize.put("jTextField1", new Dimension (59, 20)); 137 prefPaddingInParent.put("Form-jLabel2-1-1", new Integer (11)); prefPaddingInParent.put("Form-jTextField2-1-1", new Integer (11)); contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 140 compBounds.put("jLabel1", new Rectangle (10, 31, 34, 14)); 141 baselinePosition.put("jLabel1-34-14", new Integer (11)); 142 compBounds.put("jLabel2", new Rectangle (10, 75, 34, 14)); 143 baselinePosition.put("jLabel2-34-14", new Integer (11)); 144 compBounds.put("jTextField2", new Rectangle (48, 72, 59, 20)); 145 baselinePosition.put("jTextField2-59-20", new Integer (14)); 146 compBounds.put("jTextField1", new Rectangle (48, 11, 59, 55)); 147 baselinePosition.put("jTextField1-59-55", new Integer (31)); 148 ld.updateCurrentState(); 149 } 151 152 public void doChanges1() { 154 baselinePosition.put("jLabel2-34-14", new Integer (11)); 156 compPrefSize.put("jLabel2", new Dimension (34, 14)); 157 { 158 String [] compIds = new String [] { 159 "jLabel2" 160 }; 161 Rectangle [] bounds = new Rectangle [] { 162 new Rectangle (10, 75, 34, 14) 163 }; 164 Point hotspot = new Point (32,91); 165 int[] resizeEdges = new int[] { 166 -1, 167 1 168 }; 169 boolean inLayout = true; 170 ld.startResizing(compIds, bounds, hotspot, resizeEdges, inLayout); 171 } 172 prefPaddingInParent.put("Form-jLabel2-1-1", new Integer (11)); { 176 Point p = new Point (30,130); 177 String containerId= "Form"; 178 boolean autoPositioning = true; 179 boolean lockDimension = false; 180 Rectangle [] bounds = new Rectangle [] { 181 new Rectangle (10, 75, 34, 53) 182 }; 183 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 184 } 185 prefPaddingInParent.put("Form-jLabel2-1-1", new Integer (11)); { 189 Point p = new Point (30,131); 190 String containerId= "Form"; 191 boolean autoPositioning = true; 192 boolean lockDimension = false; 193 Rectangle [] bounds = new Rectangle [] { 194 new Rectangle (10, 75, 34, 54) 195 }; 196 ld.move(p, containerId, autoPositioning, lockDimension, bounds); 197 } 198 ld.endMoving(true); 201 ld.externalSizeChangeHappened(); 203 contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 205 compBounds.put("jLabel1", new Rectangle (10, 31, 34, 14)); 206 baselinePosition.put("jLabel1-34-14", new Integer (11)); 207 compPrefSize.put("jLabel1", new Dimension (34, 14)); 208 compBounds.put("jTextField2", new Rectangle (48, 89, 59, 20)); 209 baselinePosition.put("jTextField2-59-20", new Integer (14)); 210 compPrefSize.put("jTextField2", new Dimension (59, 20)); 211 compBounds.put("jTextField1", new Rectangle (48, 11, 59, 55)); 212 baselinePosition.put("jTextField1-59-55", new Integer (31)); 213 compPrefSize.put("jTextField1", new Dimension (59, 20)); 214 compBounds.put("jLabel2", new Rectangle (10, 72, 34, 54)); 215 baselinePosition.put("jLabel2-34-54", new Integer (31)); 216 compPrefSize.put("jLabel2", new Dimension (34, 14)); 217 prefPaddingInParent.put("Form-jTextField2-1-1", new Integer (11)); prefPaddingInParent.put("Form-jLabel2-1-1", new Integer (11)); contInterior.put("Form", new Rectangle (0, 0, 400, 300)); 220 compBounds.put("jLabel1", new Rectangle (10, 31, 34, 14)); 221 baselinePosition.put("jLabel1-34-14", new Integer (11)); 222 compBounds.put("jTextField2", new Rectangle (48, 89, 59, 20)); 223 baselinePosition.put("jTextField2-59-20", new Integer (14)); 224 compBounds.put("jTextField1", new Rectangle (48, 11, 59, 55)); 225 baselinePosition.put("jTextField1-59-55", new Integer (31)); 226 compBounds.put("jLabel2", new Rectangle (10, 72, 34, 54)); 227 baselinePosition.put("jLabel2-34-54", new Integer (31)); 228 ld.updateCurrentState(); 229 } 231 232 } 233 | Popular Tags |