KickJava   Java API By Example, From Geeks To Geeks.

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


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 indent separated from aligning (component indented, whole group
31
// aligned).
32
public class ALT_Indent03Test extends LayoutTestCase {
33
34     public ALT_Indent03Test(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     // Move jLabel2 slightly to the right to indent under jLabel1. Other labels
46
// (which are in group with jLabel2) should not move.
47
public void doChanges0() {
48         ld.externalSizeChangeHappened();
49         // > UPDATE CURRENT STATE
50
contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
51         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 11, 68, 14));
52         baselinePosition.put("jLabel1-68-14", new Integer JavaDoc(11));
53         compPrefSize.put("jLabel1", new Dimension JavaDoc(68, 14));
54         compBounds.put("jLabel2", new Rectangle JavaDoc(10, 31, 34, 14));
55         baselinePosition.put("jLabel2-34-14", new Integer JavaDoc(11));
56         compPrefSize.put("jLabel2", new Dimension JavaDoc(34, 14));
57         compBounds.put("jLabel3", new Rectangle JavaDoc(10, 51, 34, 14));
58         baselinePosition.put("jLabel3-34-14", new Integer JavaDoc(11));
59         compPrefSize.put("jLabel3", new Dimension JavaDoc(34, 14));
60         compBounds.put("jLabel4", new Rectangle JavaDoc(10, 71, 34, 14));
61         baselinePosition.put("jLabel4-34-14", new Integer JavaDoc(11));
62         compPrefSize.put("jLabel4", new Dimension JavaDoc(34, 14));
63         compBounds.put("jScrollPane1", new Rectangle JavaDoc(48, 31, 37, 132));
64         baselinePosition.put("jScrollPane1-37-132", new Integer JavaDoc(0));
65         compPrefSize.put("jScrollPane1", new Dimension JavaDoc(37, 132));
66         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
67         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 11, 68, 14));
68         baselinePosition.put("jLabel1-68-14", new Integer JavaDoc(11));
69         compBounds.put("jLabel2", new Rectangle JavaDoc(10, 31, 34, 14));
70         baselinePosition.put("jLabel2-34-14", new Integer JavaDoc(11));
71         compBounds.put("jLabel3", new Rectangle JavaDoc(10, 51, 34, 14));
72         baselinePosition.put("jLabel3-34-14", new Integer JavaDoc(11));
73         compBounds.put("jLabel4", new Rectangle JavaDoc(10, 71, 34, 14));
74         baselinePosition.put("jLabel4-34-14", new Integer JavaDoc(11));
75         compBounds.put("jScrollPane1", new Rectangle JavaDoc(48, 31, 37, 132));
76         baselinePosition.put("jScrollPane1-37-132", new Integer JavaDoc(0));
77         ld.updateCurrentState();
78         // < UPDATE CURRENT STATE
79
// > START MOVING
80
baselinePosition.put("jLabel2-34-14", new Integer JavaDoc(11));
81         {
82             String JavaDoc[] compIds = new String JavaDoc[] {
83                 "jLabel2"
84                 };
85             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
86                 new Rectangle JavaDoc(10, 31, 34, 14)
87                 };
88             Point JavaDoc hotspot = new Point JavaDoc(28,37);
89             ld.startMoving(compIds, bounds, hotspot);
90         }
91         // < START MOVING
92
prefPaddingInParent.put("Form-jLabel2-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
93
prefPaddingInParent.put("Form-jLabel2-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
94
prefPadding.put("jLabel1-jLabel2-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
95
prefPadding.put("jLabel2-jLabel1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
96
prefPadding.put("jScrollPane1-jLabel2-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
97
prefPadding.put("jLabel2-jScrollPane1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
98
prefPadding.put("jLabel3-jLabel2-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
99
prefPadding.put("jLabel2-jLabel3-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
100
prefPadding.put("jLabel4-jLabel2-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
101
prefPadding.put("jLabel2-jLabel4-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
102
prefPaddingInParent.put("Form-jLabel2-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
103
prefPaddingInParent.put("Form-jLabel2-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
104
prefPadding.put("jScrollPane1-jLabel2-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
105
prefPadding.put("jLabel2-jScrollPane1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
106
prefPadding.put("jLabel1-jLabel2-0-0-2", new Integer JavaDoc(10)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
107
// > MOVE
108
{
109             Point JavaDoc p = new Point JavaDoc(35,37);
110             String JavaDoc containerId= "Form";
111             boolean autoPositioning = true;
112             boolean lockDimension = false;
113             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
114                 new Rectangle JavaDoc(20, 31, 34, 14)
115                 };
116             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
117         }
118         // < MOVE
119
prefPaddingInParent.put("Form-jLabel2-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
120
prefPaddingInParent.put("Form-jLabel2-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
121
prefPadding.put("jLabel1-jLabel2-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
122
prefPadding.put("jLabel2-jLabel1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
123
prefPadding.put("jScrollPane1-jLabel2-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
124
prefPadding.put("jLabel2-jScrollPane1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
125
prefPadding.put("jLabel3-jLabel2-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
126
prefPadding.put("jLabel2-jLabel3-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
127
prefPadding.put("jLabel4-jLabel2-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
128
prefPadding.put("jLabel2-jLabel4-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
129
prefPaddingInParent.put("Form-jLabel2-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
130
prefPaddingInParent.put("Form-jLabel2-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
131
prefPadding.put("jScrollPane1-jLabel2-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
132
prefPadding.put("jLabel2-jScrollPane1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
133
prefPadding.put("jLabel1-jLabel2-0-0-2", new Integer JavaDoc(10)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
134
// > MOVE
135
{
136             Point JavaDoc p = new Point JavaDoc(37,37);
137             String JavaDoc containerId= "Form";
138             boolean autoPositioning = true;
139             boolean lockDimension = false;
140             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
141                 new Rectangle JavaDoc(20, 31, 34, 14)
142                 };
143             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
144         }
145         // < MOVE
146
// > END MOVING
147
prefPadding.put("jLabel3-jScrollPane1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
148
prefPadding.put("jLabel4-jScrollPane1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
149
prefPadding.put("jLabel2-jScrollPane1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
150
prefPadding.put("jLabel2-jLabel3-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
151
ld.endMoving(true);
152         // < END MOVING
153
ld.externalSizeChangeHappened();
154         // > UPDATE CURRENT STATE
155
contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
156         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 11, 68, 14));
157         baselinePosition.put("jLabel1-68-14", new Integer JavaDoc(11));
158         compPrefSize.put("jLabel1", new Dimension JavaDoc(68, 14));
159         compBounds.put("jLabel3", new Rectangle JavaDoc(10, 51, 34, 14));
160         baselinePosition.put("jLabel3-34-14", new Integer JavaDoc(11));
161         compPrefSize.put("jLabel3", new Dimension JavaDoc(34, 14));
162         compBounds.put("jLabel4", new Rectangle JavaDoc(10, 71, 34, 14));
163         baselinePosition.put("jLabel4-34-14", new Integer JavaDoc(11));
164         compPrefSize.put("jLabel4", new Dimension JavaDoc(34, 14));
165         compBounds.put("jScrollPane1", new Rectangle JavaDoc(58, 31, 37, 132));
166         baselinePosition.put("jScrollPane1-37-132", new Integer JavaDoc(0));
167         compPrefSize.put("jScrollPane1", new Dimension JavaDoc(37, 132));
168         compBounds.put("jLabel2", new Rectangle JavaDoc(20, 31, 34, 14));
169         baselinePosition.put("jLabel2-34-14", new Integer JavaDoc(11));
170         compPrefSize.put("jLabel2", new Dimension JavaDoc(34, 14));
171         prefPaddingInParent.put("Form-jLabel1-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
172
prefPaddingInParent.put("Form-jScrollPane1-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
173
contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
174         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 11, 68, 14));
175         baselinePosition.put("jLabel1-68-14", new Integer JavaDoc(11));
176         compBounds.put("jLabel3", new Rectangle JavaDoc(10, 51, 34, 14));
177         baselinePosition.put("jLabel3-34-14", new Integer JavaDoc(11));
178         compBounds.put("jLabel4", new Rectangle JavaDoc(10, 71, 34, 14));
179         baselinePosition.put("jLabel4-34-14", new Integer JavaDoc(11));
180         compBounds.put("jScrollPane1", new Rectangle JavaDoc(58, 31, 37, 132));
181         baselinePosition.put("jScrollPane1-37-132", new Integer JavaDoc(0));
182         compBounds.put("jLabel2", new Rectangle JavaDoc(20, 31, 34, 14));
183         baselinePosition.put("jLabel2-34-14", new Integer JavaDoc(11));
184         ld.updateCurrentState();
185         // < UPDATE CURRENT STATE
186
}
187     
188 }
189
Popular Tags