KickJava   Java API By Example, From Geeks To Geeks.

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


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 // Unlike test 15, this one makes sure that the fixed gaps are preserved if the
31
// component between other components is moved without parallel align.
32
public class ALT_ParallelPosition16Test extends LayoutTestCase {
33
34     public ALT_ParallelPosition16Test(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 jButton to snap left of jButton2.
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, 179, 23));
51         baselinePosition.put("jToggleButton1-179-23", new Integer JavaDoc(15));
52         compPrefSize.put("jToggleButton1", new Dimension JavaDoc(179, 23));
53         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 44, 34, 14));
54         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
55         compPrefSize.put("jLabel1", new Dimension JavaDoc(34, 14));
56         compBounds.put("jButton1", new Rectangle JavaDoc(92, 40, 75, 23));
57         baselinePosition.put("jButton1-75-23", new Integer JavaDoc(15));
58         compPrefSize.put("jButton1", new Dimension JavaDoc(75, 23));
59         compBounds.put("jButton2", new Rectangle JavaDoc(225, 40, 75, 23));
60         baselinePosition.put("jButton2-75-23", new Integer JavaDoc(15));
61         compPrefSize.put("jButton2", new Dimension JavaDoc(75, 23));
62         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
63         compBounds.put("jToggleButton1", new Rectangle JavaDoc(10, 11, 179, 23));
64         baselinePosition.put("jToggleButton1-179-23", new Integer JavaDoc(15));
65         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 44, 34, 14));
66         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
67         compBounds.put("jButton1", new Rectangle JavaDoc(92, 40, 75, 23));
68         baselinePosition.put("jButton1-75-23", new Integer JavaDoc(15));
69         compBounds.put("jButton2", new Rectangle JavaDoc(225, 40, 75, 23));
70         baselinePosition.put("jButton2-75-23", new Integer JavaDoc(15));
71         ld.updateCurrentState();
72         // < UPDATE CURRENT STATE
73
// > START MOVING
74
baselinePosition.put("jButton1-75-23", new Integer JavaDoc(15));
75         {
76             String JavaDoc[] compIds = new String JavaDoc[] {
77                 "jButton1"
78                 };
79             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
80                 new Rectangle JavaDoc(92, 40, 75, 23)
81                 };
82             Point JavaDoc hotspot = new Point JavaDoc(139,54);
83             ld.startMoving(compIds, bounds, hotspot);
84         }
85         // < START MOVING
86
prefPaddingInParent.put("Form-jButton1-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
87
prefPaddingInParent.put("Form-jButton1-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
88
prefPadding.put("jToggleButton1-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
89
prefPadding.put("jButton1-jToggleButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
90
prefPadding.put("jLabel1-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
91
prefPadding.put("jButton1-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
92
prefPadding.put("jButton2-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
93
prefPadding.put("jButton1-jLabel1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
94
prefPadding.put("jButton1-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
95
prefPadding.put("jButton1-jButton2-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
96
prefPaddingInParent.put("Form-jButton1-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
97
prefPaddingInParent.put("Form-jButton1-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
98
prefPadding.put("jLabel1-jButton1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
99
prefPadding.put("jButton1-jLabel1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
100
prefPadding.put("jButton2-jButton1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
101
prefPadding.put("jButton1-jButton2-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
102
prefPadding.put("jToggleButton1-jButton1-0-0-2", new Integer JavaDoc(10)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
103
// > MOVE
104
{
105             Point JavaDoc p = new Point JavaDoc(187,56);
106             String JavaDoc containerId= "Form";
107             boolean autoPositioning = true;
108             boolean lockDimension = false;
109             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
110                 new Rectangle JavaDoc(144, 40, 75, 23)
111                 };
112             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
113         }
114         // < MOVE
115
prefPaddingInParent.put("Form-jButton1-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
116
prefPaddingInParent.put("Form-jButton1-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
117
prefPadding.put("jToggleButton1-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
118
prefPadding.put("jButton1-jToggleButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
119
prefPadding.put("jLabel1-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
120
prefPadding.put("jButton1-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
121
prefPadding.put("jButton2-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
122
prefPadding.put("jButton1-jLabel1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
123
prefPadding.put("jButton1-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
124
prefPadding.put("jButton1-jButton2-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
125
prefPaddingInParent.put("Form-jButton1-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
126
prefPaddingInParent.put("Form-jButton1-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
127
prefPadding.put("jLabel1-jButton1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
128
prefPadding.put("jButton1-jLabel1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
129
prefPadding.put("jButton2-jButton1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
130
prefPadding.put("jButton1-jButton2-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
131
prefPadding.put("jToggleButton1-jButton1-0-0-2", new Integer JavaDoc(10)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
132
// > MOVE
133
{
134             Point JavaDoc p = new Point JavaDoc(188,56);
135             String JavaDoc containerId= "Form";
136             boolean autoPositioning = true;
137             boolean lockDimension = false;
138             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
139                 new Rectangle JavaDoc(144, 40, 75, 23)
140                 };
141             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
142         }
143         // < MOVE
144
// > END MOVING
145
prefPadding.put("jLabel1-jButton1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
146
ld.endMoving(true);
147         // < END MOVING
148
ld.externalSizeChangeHappened();
149         // > UPDATE CURRENT STATE
150
contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
151         compBounds.put("jToggleButton1", new Rectangle JavaDoc(10, 11, 179, 23));
152         baselinePosition.put("jToggleButton1-179-23", new Integer JavaDoc(15));
153         compPrefSize.put("jToggleButton1", new Dimension JavaDoc(179, 23));
154         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 44, 34, 14));
155         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
156         compPrefSize.put("jLabel1", new Dimension JavaDoc(34, 14));
157         compBounds.put("jButton2", new Rectangle JavaDoc(225, 40, 75, 23));
158         baselinePosition.put("jButton2-75-23", new Integer JavaDoc(15));
159         compPrefSize.put("jButton2", new Dimension JavaDoc(75, 23));
160         compBounds.put("jButton1", new Rectangle JavaDoc(144, 40, 75, 23));
161         baselinePosition.put("jButton1-75-23", new Integer JavaDoc(15));
162         compPrefSize.put("jButton1", new Dimension JavaDoc(75, 23));
163         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
164         compBounds.put("jToggleButton1", new Rectangle JavaDoc(10, 11, 179, 23));
165         baselinePosition.put("jToggleButton1-179-23", new Integer JavaDoc(15));
166         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 44, 34, 14));
167         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
168         compBounds.put("jButton2", new Rectangle JavaDoc(225, 40, 75, 23));
169         baselinePosition.put("jButton2-75-23", new Integer JavaDoc(15));
170         compBounds.put("jButton1", new Rectangle JavaDoc(144, 40, 75, 23));
171         baselinePosition.put("jButton1-75-23", new Integer JavaDoc(15));
172         ld.updateCurrentState();
173         // < UPDATE CURRENT STATE
174
}
175     
176 }
177
Popular Tags