KickJava   Java API By Example, From Geeks To Geeks.

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


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 // Test for subordinate resizing interval (creating fixed parallel group).
31
// Both components (making the resizing sequence) put on "next to" positions.
32
public class ALT_ParallelPosition07Test extends LayoutTestCase {
33
34     public ALT_ParallelPosition07Test(String JavaDoc 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 JavaDoc(url.getFile() + goldenFilesPath + className + "-StartingForm.form").getCanonicalFile());
40         } catch (IOException JavaDoc ioe) {
41             fail(ioe.toString());
42         }
43     }
44
45     // Add two labels - left (first) and right-aligned with the button.
46
public void doChanges0() {
47         ld.externalSizeChangeHappened();
48         // > UPDATE CURRENT STATE
49
contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
50         compBounds.put("jScrollPane1", new Rectangle JavaDoc(10, 11, 104, 64));
51         baselinePosition.put("jScrollPane1-104-64", new Integer JavaDoc(0));
52         compPrefSize.put("jScrollPane1", new Dimension JavaDoc(104, 64));
53         compBounds.put("jToggleButton1", new Rectangle JavaDoc(120, 11, 105, 23));
54         baselinePosition.put("jToggleButton1-105-23", new Integer JavaDoc(15));
55         compPrefSize.put("jToggleButton1", new Dimension JavaDoc(105, 23));
56         compBounds.put("jScrollPane2", new Rectangle JavaDoc(231, 11, 104, 64));
57         baselinePosition.put("jScrollPane2-104-64", new Integer JavaDoc(0));
58         compPrefSize.put("jScrollPane2", new Dimension JavaDoc(104, 64));
59         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
60         compBounds.put("jScrollPane1", new Rectangle JavaDoc(10, 11, 104, 64));
61         baselinePosition.put("jScrollPane1-104-64", new Integer JavaDoc(0));
62         compBounds.put("jToggleButton1", new Rectangle JavaDoc(120, 11, 105, 23));
63         baselinePosition.put("jToggleButton1-105-23", new Integer JavaDoc(15));
64         compBounds.put("jScrollPane2", new Rectangle JavaDoc(231, 11, 104, 64));
65         baselinePosition.put("jScrollPane2-104-64", new Integer JavaDoc(0));
66         ld.updateCurrentState();
67         // < UPDATE CURRENT STATE
68
lc = new LayoutComponent("jLabel1", false);
69         // > START ADDING
70
baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
71         {
72             LayoutComponent[] comps = new LayoutComponent[] { lc };
73             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
74                 new Rectangle JavaDoc(0, 0, 34, 14)
75                 };
76             String JavaDoc defaultContId = null;
77             Point JavaDoc hotspot = new Point JavaDoc(13,7);
78             ld.startAdding(comps, bounds, hotspot, defaultContId);
79         }
80         // < START ADDING
81
prefPaddingInParent.put("Form-jLabel1-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
82
prefPaddingInParent.put("Form-jLabel1-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
83
prefPadding.put("jToggleButton1-jLabel1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
84
prefPadding.put("jLabel1-jToggleButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
85
prefPaddingInParent.put("Form-jLabel1-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
86
prefPaddingInParent.put("Form-jLabel1-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
87
prefPadding.put("jScrollPane1-jLabel1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
88
prefPadding.put("jLabel1-jScrollPane1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
89
prefPadding.put("jScrollPane2-jLabel1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
90
prefPadding.put("jLabel1-jScrollPane2-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
91
prefPadding.put("jToggleButton1-jLabel1-0-0-2", new Integer JavaDoc(10)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
92
// > MOVE
93
{
94             Point JavaDoc p = new Point JavaDoc(137,52);
95             String JavaDoc containerId= "Form";
96             boolean autoPositioning = true;
97             boolean lockDimension = false;
98             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
99                 new Rectangle JavaDoc(118, 40, 34, 14)
100                 };
101             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
102         }
103         // < MOVE
104
prefPaddingInParent.put("Form-jLabel1-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
105
prefPaddingInParent.put("Form-jLabel1-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
106
prefPadding.put("jToggleButton1-jLabel1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
107
prefPadding.put("jLabel1-jToggleButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
108
prefPaddingInParent.put("Form-jLabel1-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
109
prefPaddingInParent.put("Form-jLabel1-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
110
prefPadding.put("jScrollPane1-jLabel1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
111
prefPadding.put("jLabel1-jScrollPane1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
112
prefPadding.put("jScrollPane2-jLabel1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
113
prefPadding.put("jLabel1-jScrollPane2-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
114
prefPadding.put("jToggleButton1-jLabel1-0-0-2", new Integer JavaDoc(10)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
115
// > MOVE
116
{
117             Point JavaDoc p = new Point JavaDoc(136,52);
118             String JavaDoc containerId= "Form";
119             boolean autoPositioning = true;
120             boolean lockDimension = false;
121             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
122                 new Rectangle JavaDoc(118, 40, 34, 14)
123                 };
124             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
125         }
126         // < MOVE
127
// > END MOVING
128
compPrefSize.put("jLabel1", new Dimension JavaDoc(34, 14));
129         compPrefSize.put("jLabel1", new Dimension JavaDoc(34, 14));
130         prefPadding.put("jToggleButton1-jScrollPane2-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
131
prefPadding.put("jLabel1-jScrollPane2-0-0-0", new Integer JavaDoc(10)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
132
ld.endMoving(true);
133         // < END MOVING
134
ld.externalSizeChangeHappened();
135         // > UPDATE CURRENT STATE
136
contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
137         compBounds.put("jScrollPane1", new Rectangle JavaDoc(10, 11, 104, 64));
138         baselinePosition.put("jScrollPane1-104-64", new Integer JavaDoc(0));
139         compPrefSize.put("jScrollPane1", new Dimension JavaDoc(104, 64));
140         compBounds.put("jToggleButton1", new Rectangle JavaDoc(120, 11, 105, 23));
141         baselinePosition.put("jToggleButton1-105-23", new Integer JavaDoc(15));
142         compPrefSize.put("jToggleButton1", new Dimension JavaDoc(105, 23));
143         compBounds.put("jScrollPane2", new Rectangle JavaDoc(231, 11, 104, 64));
144         baselinePosition.put("jScrollPane2-104-64", new Integer JavaDoc(0));
145         compPrefSize.put("jScrollPane2", new Dimension JavaDoc(104, 64));
146         compBounds.put("jLabel1", new Rectangle JavaDoc(120, 40, 34, 14));
147         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
148         compPrefSize.put("jLabel1", new Dimension JavaDoc(34, 14));
149         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
150         compBounds.put("jScrollPane1", new Rectangle JavaDoc(10, 11, 104, 64));
151         baselinePosition.put("jScrollPane1-104-64", new Integer JavaDoc(0));
152         compBounds.put("jToggleButton1", new Rectangle JavaDoc(120, 11, 105, 23));
153         baselinePosition.put("jToggleButton1-105-23", new Integer JavaDoc(15));
154         compBounds.put("jScrollPane2", new Rectangle JavaDoc(231, 11, 104, 64));
155         baselinePosition.put("jScrollPane2-104-64", new Integer JavaDoc(0));
156         compBounds.put("jLabel1", new Rectangle JavaDoc(120, 40, 34, 14));
157         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
158         ld.updateCurrentState();
159         // < UPDATE CURRENT STATE
160
lc = new LayoutComponent("jLabel2", false);
161         // > START ADDING
162
baselinePosition.put("jLabel2-34-14", new Integer JavaDoc(11));
163         {
164             LayoutComponent[] comps = new LayoutComponent[] { lc };
165             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
166                 new Rectangle JavaDoc(118, 40, 34, 14)
167                 };
168             String JavaDoc defaultContId= "Form";
169             Point JavaDoc hotspot = new Point JavaDoc(131,47);
170             ld.startAdding(comps, bounds, hotspot, defaultContId);
171         }
172         // < START ADDING
173
prefPaddingInParent.put("Form-jLabel2-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
174
prefPaddingInParent.put("Form-jLabel2-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
175
prefPadding.put("jToggleButton1-jLabel2-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
176
prefPadding.put("jLabel2-jToggleButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
177
prefPaddingInParent.put("Form-jLabel2-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
178
prefPaddingInParent.put("Form-jLabel2-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
179
prefPadding.put("jScrollPane1-jLabel2-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
180
prefPadding.put("jLabel2-jScrollPane1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
181
prefPadding.put("jLabel1-jLabel2-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
182
prefPadding.put("jLabel2-jLabel1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
183
prefPadding.put("jScrollPane2-jLabel2-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
184
prefPadding.put("jLabel2-jScrollPane2-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
185
prefPadding.put("jToggleButton1-jLabel2-0-0-2", new Integer JavaDoc(10)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
186
// > MOVE
187
{
188             Point JavaDoc p = new Point JavaDoc(197,53);
189             String JavaDoc containerId= "Form";
190             boolean autoPositioning = true;
191             boolean lockDimension = false;
192             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
193                 new Rectangle JavaDoc(191, 40, 34, 14)
194                 };
195             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
196         }
197         // < MOVE
198
prefPaddingInParent.put("Form-jLabel2-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
199
prefPaddingInParent.put("Form-jLabel2-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
200
prefPadding.put("jToggleButton1-jLabel2-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
201
prefPadding.put("jLabel2-jToggleButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
202
prefPaddingInParent.put("Form-jLabel2-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
203
prefPaddingInParent.put("Form-jLabel2-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
204
prefPadding.put("jScrollPane1-jLabel2-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
205
prefPadding.put("jLabel2-jScrollPane1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
206
prefPadding.put("jLabel1-jLabel2-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
207
prefPadding.put("jLabel2-jLabel1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
208
prefPadding.put("jScrollPane2-jLabel2-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
209
prefPadding.put("jLabel2-jScrollPane2-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
210
prefPadding.put("jToggleButton1-jLabel2-0-0-2", new Integer JavaDoc(10)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
211
// > MOVE
212
{
213             Point JavaDoc p = new Point JavaDoc(198,53);
214             String JavaDoc containerId= "Form";
215             boolean autoPositioning = true;
216             boolean lockDimension = false;
217             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
218                 new Rectangle JavaDoc(191, 40, 34, 14)
219                 };
220             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
221         }
222         // < MOVE
223
// > END MOVING
224
compPrefSize.put("jLabel2", new Dimension JavaDoc(34, 14));
225         compPrefSize.put("jLabel2", new Dimension JavaDoc(34, 14));
226         prefPadding.put("jLabel1-jLabel2-0-0-0", new Integer JavaDoc(10)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
227
ld.endMoving(true);
228         // < END MOVING
229
ld.externalSizeChangeHappened();
230         // > UPDATE CURRENT STATE
231
contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
232         compBounds.put("jScrollPane1", new Rectangle JavaDoc(10, 11, 104, 64));
233         baselinePosition.put("jScrollPane1-104-64", new Integer JavaDoc(0));
234         compPrefSize.put("jScrollPane1", new Dimension JavaDoc(104, 64));
235         compBounds.put("jToggleButton1", new Rectangle JavaDoc(120, 11, 105, 23));
236         baselinePosition.put("jToggleButton1-105-23", new Integer JavaDoc(15));
237         compPrefSize.put("jToggleButton1", new Dimension JavaDoc(105, 23));
238         compBounds.put("jScrollPane2", new Rectangle JavaDoc(231, 11, 104, 64));
239         baselinePosition.put("jScrollPane2-104-64", new Integer JavaDoc(0));
240         compPrefSize.put("jScrollPane2", new Dimension JavaDoc(104, 64));
241         compBounds.put("jLabel1", new Rectangle JavaDoc(120, 40, 34, 14));
242         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
243         compPrefSize.put("jLabel1", new Dimension JavaDoc(34, 14));
244         compBounds.put("jLabel2", new Rectangle JavaDoc(191, 40, 34, 14));
245         baselinePosition.put("jLabel2-34-14", new Integer JavaDoc(11));
246         compPrefSize.put("jLabel2", new Dimension JavaDoc(34, 14));
247         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
248         compBounds.put("jScrollPane1", new Rectangle JavaDoc(10, 11, 104, 64));
249         baselinePosition.put("jScrollPane1-104-64", new Integer JavaDoc(0));
250         compBounds.put("jToggleButton1", new Rectangle JavaDoc(120, 11, 105, 23));
251         baselinePosition.put("jToggleButton1-105-23", new Integer JavaDoc(15));
252         compBounds.put("jScrollPane2", new Rectangle JavaDoc(231, 11, 104, 64));
253         baselinePosition.put("jScrollPane2-104-64", new Integer JavaDoc(0));
254         compBounds.put("jLabel1", new Rectangle JavaDoc(120, 40, 34, 14));
255         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
256         compBounds.put("jLabel2", new Rectangle JavaDoc(191, 40, 34, 14));
257         baselinePosition.put("jLabel2-34-14", new Integer JavaDoc(11));
258         ld.updateCurrentState();
259         // < UPDATE CURRENT STATE
260
}
261     
262 }
263
Popular Tags