KickJava   Java API By Example, From Geeks To Geeks.

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


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.HashMap JavaDoc;
28 import org.openide.filesystems.FileObject;
29 import org.openide.filesystems.FileUtil;
30 import org.netbeans.modules.form.RADComponent;
31
32 public class ALT_Resizing02Test extends LayoutTestCase {
33
34     public ALT_Resizing02Test(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     // Resize JInternalFrame down-right from its default size, do not snap.
46
public void doChanges0() {
47         ld.externalSizeChangeHappened();
48         // > UPDATE CURRENT STATE
49
contInterior.put("jInternalFrame1", new Rectangle JavaDoc(13, 54, 18, 0));
50         compBounds.put("jInternalFrame1", new Rectangle JavaDoc(10, 31, 24, 26));
51         baselinePosition.put("jInternalFrame1-24-26", new Integer JavaDoc(-1));
52         compMinSize.put("jInternalFrame1", new Dimension JavaDoc(30, 26));
53         compPrefSize.put("jInternalFrame1", new Dimension JavaDoc(24, 26));
54         hasExplicitPrefSize.put("jInternalFrame1", new Boolean JavaDoc(false));
55         hasExplicitPrefSize.put("jInternalFrame1", new Boolean JavaDoc(false));
56         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
57         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 11, 34, 14));
58         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
59         compPrefSize.put("jLabel1", new Dimension JavaDoc(34, 14));
60         compBounds.put("jInternalFrame1", new Rectangle JavaDoc(10, 31, 24, 26));
61         baselinePosition.put("jInternalFrame1-24-26", new Integer JavaDoc(-1));
62         compBounds.put("jScrollPane1", new Rectangle JavaDoc(286, 11, 104, 64));
63         baselinePosition.put("jScrollPane1-104-64", new Integer JavaDoc(0));
64         compPrefSize.put("jScrollPane1", new Dimension JavaDoc(104, 64));
65         compBounds.put("jButton1", new Rectangle JavaDoc(315, 266, 75, 23));
66         baselinePosition.put("jButton1-75-23", new Integer JavaDoc(15));
67         compPrefSize.put("jButton1", new Dimension JavaDoc(75, 23));
68         compBounds.put("jButton2", new Rectangle JavaDoc(234, 266, 75, 23));
69         baselinePosition.put("jButton2-75-23", new Integer JavaDoc(15));
70         compPrefSize.put("jButton2", new Dimension JavaDoc(75, 23));
71         prefPadding.put("jButton2-jButton1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
72
prefPaddingInParent.put("Form-jButton2-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
73
prefPaddingInParent.put("Form-jLabel1-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
74
prefPaddingInParent.put("Form-jInternalFrame1-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
75
prefPaddingInParent.put("Form-jScrollPane1-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
76
prefPaddingInParent.put("Form-jButton1-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
77
prefPadding.put("jLabel1-jInternalFrame1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
78
prefPaddingInParent.put("Form-jScrollPane1-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
79
prefPaddingInParent.put("Form-jLabel1-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
80
prefPaddingInParent.put("Form-jButton1-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
81
prefPaddingInParent.put("Form-jButton2-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
82
ld.updateCurrentState();
83         // < UPDATE CURRENT STATE
84
// > START RESIZING
85
{
86             String JavaDoc[] compIds = new String JavaDoc[] {
87                 "jInternalFrame1"
88                 };
89             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
90                 new Rectangle JavaDoc(10, 31, 24, 26)
91                 };
92             Point JavaDoc hotspot = new Point JavaDoc(32,57);
93             int[] resizeEdges = new int[] {
94                 1
95                     ,1
96                 };
97             boolean inLayout = true;
98             ld.startResizing(compIds, bounds, hotspot, resizeEdges, inLayout);
99         }
100         baselinePosition.put("jInternalFrame1-24-26", new Integer JavaDoc(-1));
101         compMinSize.put("jInternalFrame1", new Dimension JavaDoc(30, 26));
102         // < START RESIZING
103
prefPaddingInParent.put("Form-jInternalFrame1-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
104
prefPadding.put("jInternalFrame1-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
105
prefPadding.put("jInternalFrame1-jButton2-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
106
prefPadding.put("jInternalFrame1-jScrollPane1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
107
// > MOVE
108
{
109             Point JavaDoc p = new Point JavaDoc(262,243);
110             String JavaDoc containerId= "Form";
111             boolean autoPositioning = true;
112             boolean lockDimension = false;
113             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
114                 new Rectangle JavaDoc(10, 31, 254, 212)
115                 };
116             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
117         }
118         // < MOVE
119
prefPaddingInParent.put("Form-jInternalFrame1-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
120
prefPadding.put("jInternalFrame1-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
121
prefPadding.put("jInternalFrame1-jButton2-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
122
prefPadding.put("jInternalFrame1-jScrollPane1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
123
// > MOVE
124
{
125             Point JavaDoc p = new Point JavaDoc(263,243);
126             String JavaDoc containerId= "Form";
127             boolean autoPositioning = true;
128             boolean lockDimension = false;
129             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
130                 new Rectangle JavaDoc(10, 31, 255, 212)
131                 };
132             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
133         }
134         // < MOVE
135
// > END MOVING
136
prefPadding.put("jInternalFrame1-jScrollPane1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
137
prefPadding.put("jScrollPane1-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
138
prefPadding.put("jScrollPane1-jButton2-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
139
prefPadding.put("jInternalFrame1-jButton1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
140
prefPadding.put("jInternalFrame1-jButton2-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
141
contInterior.put("jInternalFrame1", new Rectangle JavaDoc(13, 54, 249, 186));
142         compBounds.put("jInternalFrame1", new Rectangle JavaDoc(10, 31, 255, 212));
143         baselinePosition.put("jInternalFrame1-255-212", new Integer JavaDoc(-1));
144         compMinSize.put("jInternalFrame1", new Dimension JavaDoc(30, 26));
145         compPrefSize.put("jInternalFrame1", new Dimension JavaDoc(24, 26));
146         hasExplicitPrefSize.put("jInternalFrame1", new Boolean JavaDoc(false));
147         hasExplicitPrefSize.put("jInternalFrame1", new Boolean JavaDoc(false));
148         ld.endMoving(true);
149         // < END MOVING
150
ld.externalSizeChangeHappened();
151         // > UPDATE CURRENT STATE
152
contInterior.put("jInternalFrame1", new Rectangle JavaDoc(13, 54, 249, 186));
153         compBounds.put("jInternalFrame1", new Rectangle JavaDoc(10, 31, 255, 212));
154         baselinePosition.put("jInternalFrame1-255-212", new Integer JavaDoc(-1));
155         compMinSize.put("jInternalFrame1", new Dimension JavaDoc(30, 26));
156         compPrefSize.put("jInternalFrame1", new Dimension JavaDoc(255, 212));
157         hasExplicitPrefSize.put("jInternalFrame1", new Boolean JavaDoc(false));
158         hasExplicitPrefSize.put("jInternalFrame1", new Boolean JavaDoc(false));
159         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
160         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 11, 34, 14));
161         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
162         compPrefSize.put("jLabel1", new Dimension JavaDoc(34, 14));
163         compBounds.put("jScrollPane1", new Rectangle JavaDoc(286, 11, 104, 64));
164         baselinePosition.put("jScrollPane1-104-64", new Integer JavaDoc(0));
165         compPrefSize.put("jScrollPane1", new Dimension JavaDoc(104, 64));
166         compBounds.put("jButton1", new Rectangle JavaDoc(315, 266, 75, 23));
167         baselinePosition.put("jButton1-75-23", new Integer JavaDoc(15));
168         compPrefSize.put("jButton1", new Dimension JavaDoc(75, 23));
169         compBounds.put("jButton2", new Rectangle JavaDoc(234, 266, 75, 23));
170         baselinePosition.put("jButton2-75-23", new Integer JavaDoc(15));
171         compPrefSize.put("jButton2", new Dimension JavaDoc(75, 23));
172         compBounds.put("jInternalFrame1", new Rectangle JavaDoc(10, 31, 255, 212));
173         baselinePosition.put("jInternalFrame1-255-212", new Integer JavaDoc(-1));
174         prefPadding.put("jButton2-jButton1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
175
prefPaddingInParent.put("Form-jButton2-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
176
prefPaddingInParent.put("Form-jLabel1-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
177
prefPaddingInParent.put("Form-jInternalFrame1-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
178
prefPaddingInParent.put("Form-jScrollPane1-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
179
prefPaddingInParent.put("Form-jButton1-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
180
prefPadding.put("jLabel1-jInternalFrame1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
181
prefPaddingInParent.put("Form-jScrollPane1-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
182
prefPaddingInParent.put("Form-jLabel1-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
183
prefPaddingInParent.put("Form-jButton1-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
184
prefPaddingInParent.put("Form-jButton2-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
185
ld.updateCurrentState();
186         // < UPDATE CURRENT STATE
187
}
188     
189 }
190
Popular Tags