KickJava   Java API By Example, From Geeks To Geeks.

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


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 simulating indented alignment when the whole group is aligned, but only
31
// one component (in the group) is indented. The whole gorup needs to be aligned
32
// (would be S-layout otherwise). As the group moves, the leading gap before it
33
// needs to be shortened.
34
public class ALT_Indent02Test extends LayoutTestCase {
35         
36     public ALT_Indent02Test(String JavaDoc name) {
37         super(name);
38         try {
39         className = this.getClass().getName();
40         className = className.substring(className.lastIndexOf('.') + 1, className.length());
41             startingFormFile = FileUtil.toFileObject(new File JavaDoc(url.getFile() + goldenFilesPath + className + "-StartingForm.form").getCanonicalFile());
42         } catch (IOException JavaDoc ioe) {
43             fail(ioe.toString());
44         }
45     }
46
47     // Move jLabel20 ("Show text in icons:") to indent it from the label above
48
// it (so virtually on the same place where it is).
49
public void doChanges0() {
50         ld.externalSizeChangeHappened();
51         // > UPDATE CURRENT STATE
52
contInterior.put("jPanel5", new Rectangle JavaDoc(0, 0, 400, 308));
53         compBounds.put("jLabel20", new Rectangle JavaDoc(30, 35, 91, 14));
54         baselinePosition.put("jLabel20-91-14", new Integer JavaDoc(11));
55         compPrefSize.put("jLabel20", new Dimension JavaDoc(91, 14));
56         compBounds.put("jLabel23", new Rectangle JavaDoc(30, 107, 84, 14));
57         baselinePosition.put("jLabel23-84-14", new Integer JavaDoc(11));
58         compPrefSize.put("jLabel23", new Dimension JavaDoc(84, 14));
59         compBounds.put("jLabel27", new Rectangle JavaDoc(30, 135, 126, 14));
60         baselinePosition.put("jLabel27-126-14", new Integer JavaDoc(11));
61         compPrefSize.put("jLabel27", new Dimension JavaDoc(126, 14));
62         compBounds.put("jComboBox9", new Rectangle JavaDoc(160, 31, 230, 22));
63         baselinePosition.put("jComboBox9-230-22", new Integer JavaDoc(15));
64         compPrefSize.put("jComboBox9", new Dimension JavaDoc(57, 22));
65         compBounds.put("jComboBox11", new Rectangle JavaDoc(160, 103, 230, 22));
66         baselinePosition.put("jComboBox11-230-22", new Integer JavaDoc(15));
67         compPrefSize.put("jComboBox11", new Dimension JavaDoc(57, 22));
68         compBounds.put("jComboBox13", new Rectangle JavaDoc(160, 131, 230, 22));
69         baselinePosition.put("jComboBox13-230-22", new Integer JavaDoc(15));
70         compPrefSize.put("jComboBox13", new Dimension JavaDoc(57, 22));
71         compBounds.put("jLabel22", new Rectangle JavaDoc(20, 83, 113, 14));
72         baselinePosition.put("jLabel22-113-14", new Integer JavaDoc(11));
73         compPrefSize.put("jLabel22", new Dimension JavaDoc(113, 14));
74         compBounds.put("jLabel19", new Rectangle JavaDoc(20, 11, 46, 14));
75         baselinePosition.put("jLabel19-46-14", new Integer JavaDoc(11));
76         compPrefSize.put("jLabel19", new Dimension JavaDoc(46, 14));
77         contInterior.put("jPanel5", new Rectangle JavaDoc(0, 0, 400, 308));
78         compBounds.put("jLabel20", new Rectangle JavaDoc(30, 35, 91, 14));
79         baselinePosition.put("jLabel20-91-14", new Integer JavaDoc(11));
80         compBounds.put("jLabel23", new Rectangle JavaDoc(30, 107, 84, 14));
81         baselinePosition.put("jLabel23-84-14", new Integer JavaDoc(11));
82         compBounds.put("jLabel27", new Rectangle JavaDoc(30, 135, 126, 14));
83         baselinePosition.put("jLabel27-126-14", new Integer JavaDoc(11));
84         compBounds.put("jComboBox9", new Rectangle JavaDoc(160, 31, 230, 22));
85         baselinePosition.put("jComboBox9-230-22", new Integer JavaDoc(15));
86         compBounds.put("jComboBox11", new Rectangle JavaDoc(160, 103, 230, 22));
87         baselinePosition.put("jComboBox11-230-22", new Integer JavaDoc(15));
88         compBounds.put("jComboBox13", new Rectangle JavaDoc(160, 131, 230, 22));
89         baselinePosition.put("jComboBox13-230-22", new Integer JavaDoc(15));
90         compBounds.put("jLabel22", new Rectangle JavaDoc(20, 83, 113, 14));
91         baselinePosition.put("jLabel22-113-14", new Integer JavaDoc(11));
92         compBounds.put("jLabel19", new Rectangle JavaDoc(20, 11, 46, 14));
93         baselinePosition.put("jLabel19-46-14", new Integer JavaDoc(11));
94         ld.updateCurrentState();
95         // < UPDATE CURRENT STATE
96
// > START MOVING
97
baselinePosition.put("jLabel20-91-14", new Integer JavaDoc(11));
98         {
99             String JavaDoc[] compIds = new String JavaDoc[] {
100                 "jLabel20"
101                 };
102             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
103                 new Rectangle JavaDoc(30, 35, 91, 14)
104                 };
105             Point JavaDoc hotspot = new Point JavaDoc(46,41);
106             ld.startMoving(compIds, bounds, hotspot);
107         }
108         // < START MOVING
109
prefPaddingInParent.put("jPanel5-jLabel20-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
110
prefPaddingInParent.put("jPanel5-jLabel20-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
111
prefPadding.put("jLabel19-jLabel20-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
112
prefPadding.put("jLabel20-jLabel19-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
113
prefPadding.put("jLabel22-jLabel20-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
114
prefPadding.put("jLabel20-jLabel22-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
115
prefPadding.put("jLabel23-jLabel20-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
116
prefPadding.put("jComboBox11-jLabel20-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
117
prefPadding.put("jLabel20-jLabel23-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
118
prefPadding.put("jLabel20-jComboBox11-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
119
prefPadding.put("jLabel27-jLabel20-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
120
prefPadding.put("jComboBox13-jLabel20-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
121
prefPadding.put("jLabel20-jLabel27-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
122
prefPadding.put("jLabel20-jComboBox13-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
123
prefPaddingInParent.put("jPanel5-jLabel20-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
124
prefPaddingInParent.put("jPanel5-jLabel20-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
125
prefPadding.put("jLabel20-jComboBox9-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
126
prefPadding.put("jLabel19-jLabel20-0-0-2", new Integer JavaDoc(10)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
127
// > MOVE
128
{
129             Point JavaDoc p = new Point JavaDoc(45,46);
130             String JavaDoc containerId= "jPanel5";
131             boolean autoPositioning = true;
132             boolean lockDimension = false;
133             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
134                 new Rectangle JavaDoc(30, 35, 91, 14)
135                 };
136             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
137         }
138         // < MOVE
139
prefPaddingInParent.put("jPanel5-jLabel20-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
140
prefPaddingInParent.put("jPanel5-jLabel20-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
141
prefPadding.put("jLabel19-jLabel20-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
142
prefPadding.put("jLabel20-jLabel19-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
143
prefPadding.put("jLabel22-jLabel20-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
144
prefPadding.put("jLabel20-jLabel22-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
145
prefPadding.put("jLabel23-jLabel20-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
146
prefPadding.put("jComboBox11-jLabel20-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
147
prefPadding.put("jLabel20-jLabel23-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
148
prefPadding.put("jLabel20-jComboBox11-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
149
prefPadding.put("jLabel27-jLabel20-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
150
prefPadding.put("jComboBox13-jLabel20-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
151
prefPadding.put("jLabel20-jLabel27-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
152
prefPadding.put("jLabel20-jComboBox13-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
153
prefPaddingInParent.put("jPanel5-jLabel20-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
154
prefPaddingInParent.put("jPanel5-jLabel20-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
155
prefPadding.put("jLabel20-jComboBox9-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
156
prefPadding.put("jLabel19-jLabel20-0-0-2", new Integer JavaDoc(10)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
157
// > MOVE
158
{
159             Point JavaDoc p = new Point JavaDoc(44,46);
160             String JavaDoc containerId= "jPanel5";
161             boolean autoPositioning = true;
162             boolean lockDimension = false;
163             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
164                 new Rectangle JavaDoc(30, 35, 91, 14)
165                 };
166             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
167         }
168         // < MOVE
169
// > END MOVING
170
prefPadding.put("jLabel23-jComboBox9-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
171
prefPadding.put("jLabel23-jComboBox11-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
172
prefPadding.put("jLabel23-jComboBox13-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
173
prefPadding.put("jLabel27-jComboBox9-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
174
prefPadding.put("jLabel27-jComboBox11-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
175
prefPadding.put("jLabel27-jComboBox13-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
176
prefPadding.put("jLabel20-jComboBox9-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
177
prefPadding.put("jLabel20-jComboBox11-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
178
prefPadding.put("jLabel20-jComboBox13-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
179
ld.endMoving(true);
180         // < END MOVING
181
ld.externalSizeChangeHappened();
182         // > UPDATE CURRENT STATE
183
contInterior.put("jPanel5", new Rectangle JavaDoc(0, 0, 400, 308));
184         compBounds.put("jLabel23", new Rectangle JavaDoc(30, 107, 84, 14));
185         baselinePosition.put("jLabel23-84-14", new Integer JavaDoc(11));
186         compPrefSize.put("jLabel23", new Dimension JavaDoc(84, 14));
187         compBounds.put("jLabel27", new Rectangle JavaDoc(30, 135, 126, 14));
188         baselinePosition.put("jLabel27-126-14", new Integer JavaDoc(11));
189         compPrefSize.put("jLabel27", new Dimension JavaDoc(126, 14));
190         compBounds.put("jComboBox9", new Rectangle JavaDoc(160, 31, 230, 22));
191         baselinePosition.put("jComboBox9-230-22", new Integer JavaDoc(15));
192         compPrefSize.put("jComboBox9", new Dimension JavaDoc(57, 22));
193         compBounds.put("jComboBox11", new Rectangle JavaDoc(160, 103, 230, 22));
194         baselinePosition.put("jComboBox11-230-22", new Integer JavaDoc(15));
195         compPrefSize.put("jComboBox11", new Dimension JavaDoc(57, 22));
196         compBounds.put("jComboBox13", new Rectangle JavaDoc(160, 131, 230, 22));
197         baselinePosition.put("jComboBox13-230-22", new Integer JavaDoc(15));
198         compPrefSize.put("jComboBox13", new Dimension JavaDoc(57, 22));
199         compBounds.put("jLabel22", new Rectangle JavaDoc(20, 83, 113, 14));
200         baselinePosition.put("jLabel22-113-14", new Integer JavaDoc(11));
201         compPrefSize.put("jLabel22", new Dimension JavaDoc(113, 14));
202         compBounds.put("jLabel19", new Rectangle JavaDoc(20, 11, 46, 14));
203         baselinePosition.put("jLabel19-46-14", new Integer JavaDoc(11));
204         compPrefSize.put("jLabel19", new Dimension JavaDoc(46, 14));
205         compBounds.put("jLabel20", new Rectangle JavaDoc(30, 35, 91, 14));
206         baselinePosition.put("jLabel20-91-14", new Integer JavaDoc(11));
207         compPrefSize.put("jLabel20", new Dimension JavaDoc(91, 14));
208         contInterior.put("jPanel5", new Rectangle JavaDoc(0, 0, 400, 308));
209         compBounds.put("jLabel23", new Rectangle JavaDoc(30, 107, 84, 14));
210         baselinePosition.put("jLabel23-84-14", new Integer JavaDoc(11));
211         compBounds.put("jLabel27", new Rectangle JavaDoc(30, 135, 126, 14));
212         baselinePosition.put("jLabel27-126-14", new Integer JavaDoc(11));
213         compBounds.put("jComboBox9", new Rectangle JavaDoc(160, 31, 230, 22));
214         baselinePosition.put("jComboBox9-230-22", new Integer JavaDoc(15));
215         compBounds.put("jComboBox11", new Rectangle JavaDoc(160, 103, 230, 22));
216         baselinePosition.put("jComboBox11-230-22", new Integer JavaDoc(15));
217         compBounds.put("jComboBox13", new Rectangle JavaDoc(160, 131, 230, 22));
218         baselinePosition.put("jComboBox13-230-22", new Integer JavaDoc(15));
219         compBounds.put("jLabel22", new Rectangle JavaDoc(20, 83, 113, 14));
220         baselinePosition.put("jLabel22-113-14", new Integer JavaDoc(11));
221         compBounds.put("jLabel19", new Rectangle JavaDoc(20, 11, 46, 14));
222         baselinePosition.put("jLabel19-46-14", new Integer JavaDoc(11));
223         compBounds.put("jLabel20", new Rectangle JavaDoc(30, 35, 91, 14));
224         baselinePosition.put("jLabel20-91-14", new Integer JavaDoc(11));
225         ld.updateCurrentState();
226         // < UPDATE CURRENT STATE
227
}
228     
229 }
230
Popular Tags