KickJava   Java API By Example, From Geeks To Geeks.

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


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_Resizing03Test extends LayoutTestCase {
33
34     public ALT_Resizing03Test(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 downwards to snap to container border.
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(24,56);
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
// > MOVE
105
{
106             Point JavaDoc p = new Point JavaDoc(33,283);
107             String JavaDoc containerId= "Form";
108             boolean autoPositioning = true;
109             boolean lockDimension = false;
110             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
111                 new Rectangle JavaDoc(10, 31, 24, 258)
112                 };
113             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
114         }
115         // < MOVE
116
prefPaddingInParent.put("Form-jInternalFrame1-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
117
// > MOVE
118
{
119             Point JavaDoc p = new Point JavaDoc(32,283);
120             String JavaDoc containerId= "Form";
121             boolean autoPositioning = true;
122             boolean lockDimension = false;
123             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
124                 new Rectangle JavaDoc(10, 31, 24, 258)
125                 };
126             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
127         }
128         // < MOVE
129
// > END MOVING
130
prefPadding.put("jInternalFrame1-jButton2-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
131
prefPadding.put("jInternalFrame1-jScrollPane1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
132
prefPadding.put("jInternalFrame1-jButton2-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
133
contInterior.put("jInternalFrame1", new Rectangle JavaDoc(13, 54, 18, 232));
134         compBounds.put("jInternalFrame1", new Rectangle JavaDoc(10, 31, 24, 258));
135         baselinePosition.put("jInternalFrame1-24-258", new Integer JavaDoc(-1));
136         compMinSize.put("jInternalFrame1", new Dimension JavaDoc(30, 26));
137         compPrefSize.put("jInternalFrame1", new Dimension JavaDoc(24, 26));
138         hasExplicitPrefSize.put("jInternalFrame1", new Boolean JavaDoc(false));
139         hasExplicitPrefSize.put("jInternalFrame1", new Boolean JavaDoc(false));
140         ld.endMoving(true);
141         // < END MOVING
142
ld.externalSizeChangeHappened();
143         // > UPDATE CURRENT STATE
144
contInterior.put("jInternalFrame1", new Rectangle JavaDoc(13, 54, 18, 232));
145         compBounds.put("jInternalFrame1", new Rectangle JavaDoc(10, 31, 24, 258));
146         baselinePosition.put("jInternalFrame1-24-258", new Integer JavaDoc(-1));
147         compMinSize.put("jInternalFrame1", new Dimension JavaDoc(30, 26));
148         compPrefSize.put("jInternalFrame1", new Dimension JavaDoc(24, 258));
149         hasExplicitPrefSize.put("jInternalFrame1", new Boolean JavaDoc(false));
150         hasExplicitPrefSize.put("jInternalFrame1", new Boolean JavaDoc(false));
151         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
152         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 11, 34, 14));
153         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
154         compPrefSize.put("jLabel1", new Dimension JavaDoc(34, 14));
155         compBounds.put("jScrollPane1", new Rectangle JavaDoc(286, 11, 104, 64));
156         baselinePosition.put("jScrollPane1-104-64", new Integer JavaDoc(0));
157         compPrefSize.put("jScrollPane1", new Dimension JavaDoc(104, 64));
158         compBounds.put("jButton1", new Rectangle JavaDoc(315, 266, 75, 23));
159         baselinePosition.put("jButton1-75-23", new Integer JavaDoc(15));
160         compPrefSize.put("jButton1", new Dimension JavaDoc(75, 23));
161         compBounds.put("jButton2", new Rectangle JavaDoc(234, 266, 75, 23));
162         baselinePosition.put("jButton2-75-23", new Integer JavaDoc(15));
163         compPrefSize.put("jButton2", new Dimension JavaDoc(75, 23));
164         compBounds.put("jInternalFrame1", new Rectangle JavaDoc(10, 31, 24, 258));
165         baselinePosition.put("jInternalFrame1-24-258", new Integer JavaDoc(-1));
166         prefPaddingInParent.put("Form-jLabel1-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
167
prefPaddingInParent.put("Form-jInternalFrame1-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
168
prefPadding.put("jButton2-jButton1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
169
prefPadding.put("jLabel1-jScrollPane1-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
170
prefPadding.put("jLabel1-jButton2-0-0-0", new Integer JavaDoc(4)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
171
prefPadding.put("jInternalFrame1-jScrollPane1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
172
prefPadding.put("jInternalFrame1-jButton2-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
173
prefPaddingInParent.put("Form-jScrollPane1-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
174
prefPaddingInParent.put("Form-jButton1-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
175
prefPaddingInParent.put("Form-jButton1-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
176
prefPaddingInParent.put("Form-jButton2-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
177
prefPadding.put("jLabel1-jInternalFrame1-1-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
178
prefPaddingInParent.put("Form-jInternalFrame1-1-1", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
179
prefPaddingInParent.put("Form-jScrollPane1-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
180
prefPaddingInParent.put("Form-jLabel1-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
181
ld.updateCurrentState();
182         // < UPDATE CURRENT STATE
183
}
184     
185 }
186
Popular Tags