KickJava   Java API By Example, From Geeks To Geeks.

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


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
// Component surrounded with fixed gaps (and components) is right aligned to
32
// force resizing gap creation.
33
public class ALT_ParallelPosition15Test extends LayoutTestCase {
34
35     public ALT_ParallelPosition15Test(String JavaDoc name) {
36         super(name);
37         try {
38         className = this.getClass().getName();
39         className = className.substring(className.lastIndexOf('.') + 1, className.length());
40             startingFormFile = FileUtil.toFileObject(new File JavaDoc(url.getFile() + goldenFilesPath + className + "-StartingForm.form").getCanonicalFile());
41         } catch (IOException JavaDoc ioe) {
42             fail(ioe.toString());
43         }
44     }
45
46     // Move jButton1 to right align with the toggle button.
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("jToggleButton1", new Rectangle JavaDoc(10, 11, 179, 23));
52         baselinePosition.put("jToggleButton1-179-23", new Integer JavaDoc(15));
53         compPrefSize.put("jToggleButton1", new Dimension JavaDoc(179, 23));
54         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 44, 34, 14));
55         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
56         compPrefSize.put("jLabel1", new Dimension JavaDoc(34, 14));
57         compBounds.put("jButton1", new Rectangle JavaDoc(87, 40, 75, 23));
58         baselinePosition.put("jButton1-75-23", new Integer JavaDoc(15));
59         compPrefSize.put("jButton1", new Dimension JavaDoc(75, 23));
60         compBounds.put("jButton2", new Rectangle JavaDoc(229, 40, 75, 23));
61         baselinePosition.put("jButton2-75-23", new Integer JavaDoc(15));
62         compPrefSize.put("jButton2", new Dimension JavaDoc(75, 23));
63         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
64         compBounds.put("jToggleButton1", new Rectangle JavaDoc(10, 11, 179, 23));
65         baselinePosition.put("jToggleButton1-179-23", new Integer JavaDoc(15));
66         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 44, 34, 14));
67         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
68         compBounds.put("jButton1", new Rectangle JavaDoc(87, 40, 75, 23));
69         baselinePosition.put("jButton1-75-23", new Integer JavaDoc(15));
70         compBounds.put("jButton2", new Rectangle JavaDoc(229, 40, 75, 23));
71         baselinePosition.put("jButton2-75-23", new Integer JavaDoc(15));
72         ld.updateCurrentState();
73         // < UPDATE CURRENT STATE
74
// > START MOVING
75
baselinePosition.put("jButton1-75-23", new Integer JavaDoc(15));
76         {
77             String JavaDoc[] compIds = new String JavaDoc[] {
78                 "jButton1"
79                 };
80             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
81                 new Rectangle JavaDoc(87, 40, 75, 23)
82                 };
83             Point JavaDoc hotspot = new Point JavaDoc(121,55);
84             ld.startMoving(compIds, bounds, hotspot);
85         }
86         // < START MOVING
87
prefPaddingInParent.put("Form-jButton1-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
88
prefPaddingInParent.put("Form-jButton1-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
89
prefPadding.put("jToggleButton1-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
90
prefPadding.put("jButton1-jToggleButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
91
prefPadding.put("jLabel1-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
92
prefPadding.put("jButton1-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
93
prefPadding.put("jButton2-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
94
prefPadding.put("jButton1-jLabel1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
95
prefPadding.put("jButton1-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
96
prefPadding.put("jButton1-jButton2-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
97
prefPaddingInParent.put("Form-jButton1-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
98
prefPaddingInParent.put("Form-jButton1-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
99
prefPadding.put("jLabel1-jButton1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
100
prefPadding.put("jButton1-jLabel1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
101
prefPadding.put("jButton2-jButton1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
102
prefPadding.put("jButton1-jButton2-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
103
prefPadding.put("jToggleButton1-jButton1-0-0-2", new Integer JavaDoc(10)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
104
// > MOVE
105
{
106             Point JavaDoc p = new Point JavaDoc(146,55);
107             String JavaDoc containerId= "Form";
108             boolean autoPositioning = true;
109             boolean lockDimension = false;
110             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
111                 new Rectangle JavaDoc(114, 40, 75, 23)
112                 };
113             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
114         }
115         // < MOVE
116
prefPaddingInParent.put("Form-jButton1-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
117
prefPaddingInParent.put("Form-jButton1-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
118
prefPadding.put("jToggleButton1-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
119
prefPadding.put("jButton1-jToggleButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
120
prefPadding.put("jLabel1-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
121
prefPadding.put("jButton1-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
122
prefPadding.put("jButton2-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
123
prefPadding.put("jButton1-jLabel1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
124
prefPadding.put("jButton1-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
125
prefPadding.put("jButton1-jButton2-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
126
prefPaddingInParent.put("Form-jButton1-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
127
prefPaddingInParent.put("Form-jButton1-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
128
prefPadding.put("jLabel1-jButton1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
129
prefPadding.put("jButton1-jLabel1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
130
prefPadding.put("jButton2-jButton1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
131
prefPadding.put("jButton1-jButton2-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
132
prefPadding.put("jToggleButton1-jButton1-0-0-2", new Integer JavaDoc(10)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
133
// > MOVE
134
{
135             Point JavaDoc p = new Point JavaDoc(147,55);
136             String JavaDoc containerId= "Form";
137             boolean autoPositioning = true;
138             boolean lockDimension = false;
139             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
140                 new Rectangle JavaDoc(114, 40, 75, 23)
141                 };
142             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
143         }
144         // < MOVE
145
// > END MOVING
146
prefPadding.put("jLabel1-jButton1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
147
prefPadding.put("jButton1-jButton2-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
148
ld.endMoving(true);
149         // < END MOVING
150
ld.externalSizeChangeHappened();
151         // > UPDATE CURRENT STATE
152
contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
153         compBounds.put("jToggleButton1", new Rectangle JavaDoc(10, 11, 179, 23));
154         baselinePosition.put("jToggleButton1-179-23", new Integer JavaDoc(15));
155         compPrefSize.put("jToggleButton1", new Dimension JavaDoc(179, 23));
156         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 44, 34, 14));
157         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
158         compPrefSize.put("jLabel1", new Dimension JavaDoc(34, 14));
159         compBounds.put("jButton2", new Rectangle JavaDoc(229, 40, 75, 23));
160         baselinePosition.put("jButton2-75-23", new Integer JavaDoc(15));
161         compPrefSize.put("jButton2", new Dimension JavaDoc(75, 23));
162         compBounds.put("jButton1", new Rectangle JavaDoc(114, 40, 75, 23));
163         baselinePosition.put("jButton1-75-23", new Integer JavaDoc(15));
164         compPrefSize.put("jButton1", new Dimension JavaDoc(75, 23));
165         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
166         compBounds.put("jToggleButton1", new Rectangle JavaDoc(10, 11, 179, 23));
167         baselinePosition.put("jToggleButton1-179-23", new Integer JavaDoc(15));
168         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 44, 34, 14));
169         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
170         compBounds.put("jButton2", new Rectangle JavaDoc(229, 40, 75, 23));
171         baselinePosition.put("jButton2-75-23", new Integer JavaDoc(15));
172         compBounds.put("jButton1", new Rectangle JavaDoc(114, 40, 75, 23));
173         baselinePosition.put("jButton1-75-23", new Integer JavaDoc(15));
174         ld.updateCurrentState();
175         // < UPDATE CURRENT STATE
176
}
177     
178 }
179
Popular Tags