KickJava   Java API By Example, From Geeks To Geeks.

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


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
// Second component put on aligned position.
32
public class ALT_ParallelPosition05Test extends LayoutTestCase {
33
34     public ALT_ParallelPosition05Test(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("jToggleButton1", new Rectangle JavaDoc(10, 11, 105, 23));
51         baselinePosition.put("jToggleButton1-105-23", new Integer JavaDoc(15));
52         compPrefSize.put("jToggleButton1", new Dimension JavaDoc(105, 23));
53         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
54         compBounds.put("jToggleButton1", new Rectangle JavaDoc(10, 11, 105, 23));
55         baselinePosition.put("jToggleButton1-105-23", new Integer JavaDoc(15));
56         ld.updateCurrentState();
57         // < UPDATE CURRENT STATE
58
lc = new LayoutComponent("jLabel1", false);
59         // > START ADDING
60
baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
61         {
62             LayoutComponent[] comps = new LayoutComponent[] { lc };
63             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
64                 new Rectangle JavaDoc(0, 0, 34, 14)
65                 };
66             String JavaDoc defaultContId = null;
67             Point JavaDoc hotspot = new Point JavaDoc(13,7);
68             ld.startAdding(comps, bounds, hotspot, defaultContId);
69         }
70         // < START ADDING
71
prefPaddingInParent.put("Form-jLabel1-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
72
prefPaddingInParent.put("Form-jLabel1-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
73
prefPadding.put("jToggleButton1-jLabel1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
74
prefPadding.put("jLabel1-jToggleButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
75
prefPaddingInParent.put("Form-jLabel1-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
76
prefPaddingInParent.put("Form-jLabel1-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
77
prefPadding.put("jToggleButton1-jLabel1-0-0-2", new Integer JavaDoc(10)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
78
// > MOVE
79
{
80             Point JavaDoc p = new Point JavaDoc(27,52);
81             String JavaDoc containerId= "Form";
82             boolean autoPositioning = true;
83             boolean lockDimension = false;
84             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
85                 new Rectangle JavaDoc(10, 40, 34, 14)
86                 };
87             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
88         }
89         // < MOVE
90
prefPaddingInParent.put("Form-jLabel1-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
91
prefPaddingInParent.put("Form-jLabel1-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
92
prefPadding.put("jToggleButton1-jLabel1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
93
prefPadding.put("jLabel1-jToggleButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
94
prefPaddingInParent.put("Form-jLabel1-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
95
prefPaddingInParent.put("Form-jLabel1-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
96
prefPadding.put("jToggleButton1-jLabel1-0-0-2", new Integer JavaDoc(10)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
97
// > MOVE
98
{
99             Point JavaDoc p = new Point JavaDoc(26,52);
100             String JavaDoc containerId= "Form";
101             boolean autoPositioning = true;
102             boolean lockDimension = false;
103             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
104                 new Rectangle JavaDoc(10, 40, 34, 14)
105                 };
106             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
107         }
108         // < MOVE
109
// > END MOVING
110
compPrefSize.put("jLabel1", new Dimension JavaDoc(34, 14));
111         compPrefSize.put("jLabel1", new Dimension JavaDoc(34, 14));
112         prefPaddingInParent.put("Form-jLabel1-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
113
prefPaddingInParent.put("Form-jLabel1-1-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
114
ld.endMoving(true);
115         // < END MOVING
116
ld.externalSizeChangeHappened();
117         // > UPDATE CURRENT STATE
118
contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
119         compBounds.put("jToggleButton1", new Rectangle JavaDoc(10, 11, 105, 23));
120         baselinePosition.put("jToggleButton1-105-23", new Integer JavaDoc(15));
121         compPrefSize.put("jToggleButton1", new Dimension JavaDoc(105, 23));
122         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 40, 34, 14));
123         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
124         compPrefSize.put("jLabel1", new Dimension JavaDoc(34, 14));
125         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
126         compBounds.put("jToggleButton1", new Rectangle JavaDoc(10, 11, 105, 23));
127         baselinePosition.put("jToggleButton1-105-23", new Integer JavaDoc(15));
128         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 40, 34, 14));
129         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
130         ld.updateCurrentState();
131         // < UPDATE CURRENT STATE
132
lc = new LayoutComponent("jLabel2", false);
133         // > START ADDING
134
baselinePosition.put("jLabel2-34-14", new Integer JavaDoc(11));
135         {
136             LayoutComponent[] comps = new LayoutComponent[] { lc };
137             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
138                 new Rectangle JavaDoc(10, 40, 34, 14)
139                 };
140             String JavaDoc defaultContId= "Form";
141             Point JavaDoc hotspot = new Point JavaDoc(23,47);
142             ld.startAdding(comps, bounds, hotspot, defaultContId);
143         }
144         // < START ADDING
145
prefPaddingInParent.put("Form-jLabel2-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
146
prefPaddingInParent.put("Form-jLabel2-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
147
prefPadding.put("jToggleButton1-jLabel2-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
148
prefPadding.put("jLabel2-jToggleButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
149
prefPaddingInParent.put("Form-jLabel2-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
150
prefPaddingInParent.put("Form-jLabel2-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
151
prefPadding.put("jLabel1-jLabel2-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
152
prefPadding.put("jLabel2-jLabel1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
153
prefPadding.put("jToggleButton1-jLabel2-0-0-2", new Integer JavaDoc(10)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
154
// > MOVE
155
{
156             Point JavaDoc p = new Point JavaDoc(88,54);
157             String JavaDoc containerId= "Form";
158             boolean autoPositioning = true;
159             boolean lockDimension = false;
160             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
161                 new Rectangle JavaDoc(81, 40, 34, 14)
162                 };
163             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
164         }
165         // < MOVE
166
prefPaddingInParent.put("Form-jLabel2-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
167
prefPaddingInParent.put("Form-jLabel2-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
168
prefPadding.put("jToggleButton1-jLabel2-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
169
prefPadding.put("jLabel2-jToggleButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
170
prefPaddingInParent.put("Form-jLabel2-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
171
prefPaddingInParent.put("Form-jLabel2-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
172
prefPadding.put("jLabel1-jLabel2-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
173
prefPadding.put("jLabel2-jLabel1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
174
prefPadding.put("jToggleButton1-jLabel2-0-0-2", new Integer JavaDoc(10)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
175
// > MOVE
176
{
177             Point JavaDoc p = new Point JavaDoc(88,53);
178             String JavaDoc containerId= "Form";
179             boolean autoPositioning = true;
180             boolean lockDimension = false;
181             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
182                 new Rectangle JavaDoc(81, 40, 34, 14)
183                 };
184             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
185         }
186         // < MOVE
187
// > END MOVING
188
compPrefSize.put("jLabel2", new Dimension JavaDoc(34, 14));
189         compPrefSize.put("jLabel2", new Dimension JavaDoc(34, 14));
190         prefPadding.put("jLabel1-jLabel2-0-0-0", new Integer JavaDoc(10)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
191
ld.endMoving(true);
192         // < END MOVING
193
ld.externalSizeChangeHappened();
194         // > UPDATE CURRENT STATE
195
contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
196         compBounds.put("jToggleButton1", new Rectangle JavaDoc(10, 11, 105, 23));
197         baselinePosition.put("jToggleButton1-105-23", new Integer JavaDoc(15));
198         compPrefSize.put("jToggleButton1", new Dimension JavaDoc(105, 23));
199         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 40, 34, 14));
200         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
201         compPrefSize.put("jLabel1", new Dimension JavaDoc(34, 14));
202         compBounds.put("jLabel2", new Rectangle JavaDoc(81, 40, 34, 14));
203         baselinePosition.put("jLabel2-34-14", new Integer JavaDoc(11));
204         compPrefSize.put("jLabel2", new Dimension JavaDoc(34, 14));
205         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
206         compBounds.put("jToggleButton1", new Rectangle JavaDoc(10, 11, 105, 23));
207         baselinePosition.put("jToggleButton1-105-23", new Integer JavaDoc(15));
208         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 40, 34, 14));
209         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
210         compBounds.put("jLabel2", new Rectangle JavaDoc(81, 40, 34, 14));
211         baselinePosition.put("jLabel2-34-14", new Integer JavaDoc(11));
212         ld.updateCurrentState();
213         // < UPDATE CURRENT STATE
214
}
215     
216 }
217
Popular Tags