KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > form > layoutdesign > ALT_ParallelPosition19Test


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.form.layoutdesign;
21
22 import java.awt.Dimension JavaDoc;
23 import java.awt.Point JavaDoc;
24 import java.awt.Rectangle JavaDoc;
25 import java.io.File JavaDoc;
26 import java.io.IOException JavaDoc;
27 import java.util.*;
28 import org.openide.filesystems.FileUtil;
29
30 // Testing situation when resizing of ceraetd parallel group should be preserved.
31
public class ALT_ParallelPosition19Test extends LayoutTestCase {
32
33     public ALT_ParallelPosition19Test(String JavaDoc 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 JavaDoc(url.getFile() + goldenFilesPath + className + "-StartingForm.form").getCanonicalFile());
39         } catch (IOException JavaDoc ioe) {
40             fail(ioe.toString());
41         }
42     }
43
44     // One by one, resize the textfields to the right to snap next to the list.
45
public void doChanges0() {
46         ld.externalSizeChangeHappened();
47         // > UPDATE CURRENT STATE
48
contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
49         compBounds.put("jTextField1", new Rectangle JavaDoc(10, 11, 59, 20));
50         baselinePosition.put("jTextField1-59-20", new Integer JavaDoc(14));
51         compPrefSize.put("jTextField1", new Dimension JavaDoc(59, 20));
52         compBounds.put("jTextField2", new Rectangle JavaDoc(10, 37, 59, 20));
53         baselinePosition.put("jTextField2-59-20", new Integer JavaDoc(14));
54         compPrefSize.put("jTextField2", new Dimension JavaDoc(59, 20));
55         compBounds.put("jTextField3", new Rectangle JavaDoc(10, 63, 59, 20));
56         baselinePosition.put("jTextField3-59-20", new Integer JavaDoc(14));
57         compPrefSize.put("jTextField3", new Dimension JavaDoc(59, 20));
58         compBounds.put("jScrollPane1", new Rectangle JavaDoc(353, 11, 37, 132));
59         baselinePosition.put("jScrollPane1-37-132", new Integer JavaDoc(0));
60         compPrefSize.put("jScrollPane1", new Dimension JavaDoc(37, 132));
61         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
62         compBounds.put("jTextField1", new Rectangle JavaDoc(10, 11, 59, 20));
63         baselinePosition.put("jTextField1-59-20", new Integer JavaDoc(14));
64         compBounds.put("jTextField2", new Rectangle JavaDoc(10, 37, 59, 20));
65         baselinePosition.put("jTextField2-59-20", new Integer JavaDoc(14));
66         compBounds.put("jTextField3", new Rectangle JavaDoc(10, 63, 59, 20));
67         baselinePosition.put("jTextField3-59-20", new Integer JavaDoc(14));
68         compBounds.put("jScrollPane1", new Rectangle JavaDoc(353, 11, 37, 132));
69         baselinePosition.put("jScrollPane1-37-132", new Integer JavaDoc(0));
70         ld.updateCurrentState();
71         // < UPDATE CURRENT STATE
72
// > START RESIZING
73
baselinePosition.put("jTextField1-59-20", new Integer JavaDoc(14));
74         compPrefSize.put("jTextField1", new Dimension JavaDoc(59, 20));
75         {
76             String JavaDoc[] compIds = new String JavaDoc[] {
77                 "jTextField1"
78                 };
79             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
80                 new Rectangle JavaDoc(10, 11, 59, 20)
81                 };
82             Point JavaDoc hotspot = new Point JavaDoc(69,19);
83             int[] resizeEdges = new int[] {
84                 1,
85                     -1
86                 };
87             boolean inLayout = true;
88             ld.startResizing(compIds, bounds, hotspot, resizeEdges, inLayout);
89         }
90         // < START RESIZING
91
prefPadding.put("jTextField1-jScrollPane1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
92
// > MOVE
93
{
94             Point JavaDoc p = new Point JavaDoc(340,36);
95             String JavaDoc containerId= "Form";
96             boolean autoPositioning = true;
97             boolean lockDimension = false;
98             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
99                 new Rectangle JavaDoc(10, 11, 337, 20)
100                 };
101             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
102         }
103         // < MOVE
104
prefPadding.put("jTextField1-jScrollPane1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
105
// > MOVE
106
{
107             Point JavaDoc p = new Point JavaDoc(341,36);
108             String JavaDoc containerId= "Form";
109             boolean autoPositioning = true;
110             boolean lockDimension = false;
111             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
112                 new Rectangle JavaDoc(10, 11, 337, 20)
113                 };
114             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
115         }
116         // < MOVE
117
// > END MOVING
118
prefPadding.put("jTextField2-jScrollPane1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
119
prefPadding.put("jTextField3-jScrollPane1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
120
prefPadding.put("jTextField1-jScrollPane1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
121
ld.endMoving(true);
122         // < END MOVING
123
ld.externalSizeChangeHappened();
124         // > UPDATE CURRENT STATE
125
contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
126         compBounds.put("jTextField2", new Rectangle JavaDoc(10, 37, 59, 20));
127         baselinePosition.put("jTextField2-59-20", new Integer JavaDoc(14));
128         compPrefSize.put("jTextField2", new Dimension JavaDoc(59, 20));
129         compBounds.put("jTextField3", new Rectangle JavaDoc(10, 63, 59, 20));
130         baselinePosition.put("jTextField3-59-20", new Integer JavaDoc(14));
131         compPrefSize.put("jTextField3", new Dimension JavaDoc(59, 20));
132         compBounds.put("jScrollPane1", new Rectangle JavaDoc(353, 11, 37, 132));
133         baselinePosition.put("jScrollPane1-37-132", new Integer JavaDoc(0));
134         compPrefSize.put("jScrollPane1", new Dimension JavaDoc(37, 132));
135         compBounds.put("jTextField1", new Rectangle JavaDoc(10, 11, 337, 20));
136         baselinePosition.put("jTextField1-337-20", new Integer JavaDoc(14));
137         compPrefSize.put("jTextField1", new Dimension JavaDoc(59, 20));
138         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
139         compBounds.put("jTextField2", new Rectangle JavaDoc(10, 37, 59, 20));
140         baselinePosition.put("jTextField2-59-20", new Integer JavaDoc(14));
141         compBounds.put("jTextField3", new Rectangle JavaDoc(10, 63, 59, 20));
142         baselinePosition.put("jTextField3-59-20", new Integer JavaDoc(14));
143         compBounds.put("jScrollPane1", new Rectangle JavaDoc(353, 11, 37, 132));
144         baselinePosition.put("jScrollPane1-37-132", new Integer JavaDoc(0));
145         compBounds.put("jTextField1", new Rectangle JavaDoc(10, 11, 337, 20));
146         baselinePosition.put("jTextField1-337-20", new Integer JavaDoc(14));
147         ld.updateCurrentState();
148         // < UPDATE CURRENT STATE
149
// > START RESIZING
150
baselinePosition.put("jTextField2-59-20", new Integer JavaDoc(14));
151         compPrefSize.put("jTextField2", new Dimension JavaDoc(59, 20));
152         {
153             String JavaDoc[] compIds = new String JavaDoc[] {
154                 "jTextField2"
155                 };
156             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
157                 new Rectangle JavaDoc(10, 37, 59, 20)
158                 };
159             Point JavaDoc hotspot = new Point JavaDoc(70,48);
160             int[] resizeEdges = new int[] {
161                 1,
162                     -1
163                 };
164             boolean inLayout = true;
165             ld.startResizing(compIds, bounds, hotspot, resizeEdges, inLayout);
166         }
167         // < START RESIZING
168
prefPadding.put("jTextField2-jScrollPane1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
169
// > MOVE
170
{
171             Point JavaDoc p = new Point JavaDoc(343,53);
172             String JavaDoc containerId= "Form";
173             boolean autoPositioning = true;
174             boolean lockDimension = false;
175             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
176                 new Rectangle JavaDoc(10, 37, 337, 20)
177                 };
178             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
179         }
180         // < MOVE
181
prefPadding.put("jTextField2-jScrollPane1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
182
// > MOVE
183
{
184             Point JavaDoc p = new Point JavaDoc(344,53);
185             String JavaDoc containerId= "Form";
186             boolean autoPositioning = true;
187             boolean lockDimension = false;
188             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
189                 new Rectangle JavaDoc(10, 37, 337, 20)
190                 };
191             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
192         }
193         // < MOVE
194
// > END MOVING
195
ld.endMoving(true);
196         // < END MOVING
197
ld.externalSizeChangeHappened();
198         // > UPDATE CURRENT STATE
199
contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
200         compBounds.put("jTextField3", new Rectangle JavaDoc(10, 63, 59, 20));
201         baselinePosition.put("jTextField3-59-20", new Integer JavaDoc(14));
202         compPrefSize.put("jTextField3", new Dimension JavaDoc(59, 20));
203         compBounds.put("jScrollPane1", new Rectangle JavaDoc(353, 11, 37, 132));
204         baselinePosition.put("jScrollPane1-37-132", new Integer JavaDoc(0));
205         compPrefSize.put("jScrollPane1", new Dimension JavaDoc(37, 132));
206         compBounds.put("jTextField1", new Rectangle JavaDoc(10, 11, 337, 20));
207         baselinePosition.put("jTextField1-337-20", new Integer JavaDoc(14));
208         compPrefSize.put("jTextField1", new Dimension JavaDoc(59, 20));
209         compBounds.put("jTextField2", new Rectangle JavaDoc(10, 37, 337, 20));
210         baselinePosition.put("jTextField2-337-20", new Integer JavaDoc(14));
211         compPrefSize.put("jTextField2", new Dimension JavaDoc(59, 20));
212         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
213         compBounds.put("jTextField3", new Rectangle JavaDoc(10, 63, 59, 20));
214         baselinePosition.put("jTextField3-59-20", new Integer JavaDoc(14));
215         compBounds.put("jScrollPane1", new Rectangle JavaDoc(353, 11, 37, 132));
216         baselinePosition.put("jScrollPane1-37-132", new Integer JavaDoc(0));
217         compBounds.put("jTextField1", new Rectangle JavaDoc(10, 11, 337, 20));
218         baselinePosition.put("jTextField1-337-20", new Integer JavaDoc(14));
219         compBounds.put("jTextField2", new Rectangle JavaDoc(10, 37, 337, 20));
220         baselinePosition.put("jTextField2-337-20", new Integer JavaDoc(14));
221         ld.updateCurrentState();
222         // < UPDATE CURRENT STATE
223
// > START RESIZING
224
baselinePosition.put("jTextField3-59-20", new Integer JavaDoc(14));
225         compPrefSize.put("jTextField3", new Dimension JavaDoc(59, 20));
226         {
227             String JavaDoc[] compIds = new String JavaDoc[] {
228                 "jTextField3"
229                 };
230             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
231                 new Rectangle JavaDoc(10, 63, 59, 20)
232                 };
233             Point JavaDoc hotspot = new Point JavaDoc(69,74);
234             int[] resizeEdges = new int[] {
235                 1,
236                     -1
237                 };
238             boolean inLayout = true;
239             ld.startResizing(compIds, bounds, hotspot, resizeEdges, inLayout);
240         }
241         // < START RESIZING
242
prefPadding.put("jTextField3-jScrollPane1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
243
// > MOVE
244
{
245             Point JavaDoc p = new Point JavaDoc(341,82);
246             String JavaDoc containerId= "Form";
247             boolean autoPositioning = true;
248             boolean lockDimension = false;
249             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
250                 new Rectangle JavaDoc(10, 63, 337, 20)
251                 };
252             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
253         }
254         // < MOVE
255
prefPadding.put("jTextField3-jScrollPane1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
256
// > MOVE
257
{
258             Point JavaDoc p = new Point JavaDoc(342,82);
259             String JavaDoc containerId= "Form";
260             boolean autoPositioning = true;
261             boolean lockDimension = false;
262             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
263                 new Rectangle JavaDoc(10, 63, 337, 20)
264                 };
265             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
266         }
267         // < MOVE
268
// > END MOVING
269
ld.endMoving(true);
270         // < END MOVING
271
ld.externalSizeChangeHappened();
272         // > UPDATE CURRENT STATE
273
contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
274         compBounds.put("jScrollPane1", new Rectangle JavaDoc(353, 11, 37, 132));
275         baselinePosition.put("jScrollPane1-37-132", new Integer JavaDoc(0));
276         compPrefSize.put("jScrollPane1", new Dimension JavaDoc(37, 132));
277         compBounds.put("jTextField1", new Rectangle JavaDoc(10, 11, 337, 20));
278         baselinePosition.put("jTextField1-337-20", new Integer JavaDoc(14));
279         compPrefSize.put("jTextField1", new Dimension JavaDoc(59, 20));
280         compBounds.put("jTextField2", new Rectangle JavaDoc(10, 37, 337, 20));
281         baselinePosition.put("jTextField2-337-20", new Integer JavaDoc(14));
282         compPrefSize.put("jTextField2", new Dimension JavaDoc(59, 20));
283         compBounds.put("jTextField3", new Rectangle JavaDoc(10, 63, 337, 20));
284         baselinePosition.put("jTextField3-337-20", new Integer JavaDoc(14));
285         compPrefSize.put("jTextField3", new Dimension JavaDoc(59, 20));
286         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
287         compBounds.put("jScrollPane1", new Rectangle JavaDoc(353, 11, 37, 132));
288         baselinePosition.put("jScrollPane1-37-132", new Integer JavaDoc(0));
289         compBounds.put("jTextField1", new Rectangle JavaDoc(10, 11, 337, 20));
290         baselinePosition.put("jTextField1-337-20", new Integer JavaDoc(14));
291         compBounds.put("jTextField2", new Rectangle JavaDoc(10, 37, 337, 20));
292         baselinePosition.put("jTextField2-337-20", new Integer JavaDoc(14));
293         compBounds.put("jTextField3", new Rectangle JavaDoc(10, 63, 337, 20));
294         baselinePosition.put("jTextField3-337-20", new Integer JavaDoc(14));
295         ld.updateCurrentState();
296         // < UPDATE CURRENT STATE
297
}
298     
299 }
300
Popular Tags