KickJava   Java API By Example, From Geeks To Geeks.

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


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 public class ALT_Bug66919Test extends LayoutTestCase {
31
32     public ALT_Bug66919Test(String JavaDoc name) {
33         super(name);
34         try {
35         className = this.getClass().getName();
36         className = className.substring(className.lastIndexOf('.') + 1, className.length());
37             startingFormFile = FileUtil.toFileObject(new File JavaDoc(url.getFile() + goldenFilesPath + className + "-StartingForm.form").getCanonicalFile());
38         } catch (IOException JavaDoc ioe) {
39             fail(ioe.toString());
40         }
41     }
42
43     // Resize 'Save' button slightly to the right. The layout is screwed in
44
// vertical dimension so the button overlaps with the panel above it, but
45
// resizing in horizontal dimension only should not care about this overlap.
46
public void doChanges0() {
47         ld.externalSizeChangeHappened();
48         // > UPDATE CURRENT STATE
49
contInterior.put("jPanel1", new Rectangle JavaDoc(115, 31, 274, 157));
50         compBounds.put("jPanel1", new Rectangle JavaDoc(109, 11, 286, 183));
51         baselinePosition.put("jPanel1-286-183", new Integer JavaDoc(0));
52         compMinSize.put("jPanel1", new Dimension JavaDoc(12, 26));
53         compPrefSize.put("jPanel1", new Dimension JavaDoc(286, 183));
54         hasExplicitPrefSize.put("jPanel1", new Boolean JavaDoc(false));
55         hasExplicitPrefSize.put("jPanel1", new Boolean JavaDoc(false));
56         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 778, 481));
57         compBounds.put("add", new Rectangle JavaDoc(10, 11, 93, 23));
58         baselinePosition.put("add-93-23", new Integer JavaDoc(15));
59         compPrefSize.put("add", new Dimension JavaDoc(93, 23));
60         compBounds.put("jPanel1", new Rectangle JavaDoc(109, 11, 286, 183));
61         baselinePosition.put("jPanel1-286-183", new Integer JavaDoc(0));
62         compBounds.put("save", new Rectangle JavaDoc(401, 173, 92, 23));
63         baselinePosition.put("save-92-23", new Integer JavaDoc(15));
64         compPrefSize.put("save", new Dimension JavaDoc(59, 23));
65         compBounds.put("delete", new Rectangle JavaDoc(631, 173, 137, 23));
66         baselinePosition.put("delete-137-23", new Integer JavaDoc(15));
67         compPrefSize.put("delete", new Dimension JavaDoc(65, 23));
68         compBounds.put("jPanel2", new Rectangle JavaDoc(401, 11, 348, 164));
69         baselinePosition.put("jPanel2-348-164", new Integer JavaDoc(0));
70         prefPaddingInParent.put("Form-add-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
71
prefPadding.put("add-jPanel1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
72
prefPaddingInParent.put("Form-jPanel2-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
73
prefPaddingInParent.put("Form-delete-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
74
prefPaddingInParent.put("Form-jPanel2-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
75
prefPaddingInParent.put("Form-jPanel1-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
76
prefPaddingInParent.put("Form-add-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
77
contInterior.put("jPanel2", new Rectangle JavaDoc(407, 31, 336, 138));
78         compBounds.put("jPanel2", new Rectangle JavaDoc(401, 11, 348, 164));
79         baselinePosition.put("jPanel2-348-164", new Integer JavaDoc(0));
80         compMinSize.put("jPanel2", new Dimension JavaDoc(12, 26));
81         compPrefSize.put("jPanel2", new Dimension JavaDoc(348, 164));
82         hasExplicitPrefSize.put("jPanel2", new Boolean JavaDoc(false));
83         hasExplicitPrefSize.put("jPanel2", new Boolean JavaDoc(false));
84         ld.updateCurrentState();
85         // < UPDATE CURRENT STATE
86
// > START RESIZING
87
{
88             String JavaDoc[] compIds = new String JavaDoc[] {
89                 "save"
90                 };
91             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
92                 new Rectangle JavaDoc(401, 173, 92, 23)
93                 };
94             Point JavaDoc hotspot = new Point JavaDoc(494,186);
95             int[] resizeEdges = new int[] {
96                 1,
97                     -1
98                 };
99             boolean inLayout = true;
100             ld.startResizing(compIds, bounds, hotspot, resizeEdges, inLayout);
101         }
102         baselinePosition.put("save-92-23", new Integer JavaDoc(15));
103         compPrefSize.put("save", new Dimension JavaDoc(59, 23));
104         // < START RESIZING
105
prefPadding.put("save-delete-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
106
// > MOVE
107
{
108             Point JavaDoc p = new Point JavaDoc(515,184);
109             String JavaDoc containerId= "Form";
110             boolean autoPositioning = true;
111             boolean lockDimension = false;
112             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
113                 new Rectangle JavaDoc(401, 173, 113, 23)
114                 };
115             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
116         }
117         // < MOVE
118
prefPadding.put("save-delete-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
119
// > MOVE
120
{
121             Point JavaDoc p = new Point JavaDoc(516,184);
122             String JavaDoc containerId= "Form";
123             boolean autoPositioning = true;
124             boolean lockDimension = false;
125             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
126                 new Rectangle JavaDoc(401, 173, 114, 23)
127                 };
128             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
129         }
130         // < MOVE
131
// > END MOVING
132
prefPadding.put("save-delete-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
133
ld.endMoving(true);
134         // < END MOVING
135
ld.externalSizeChangeHappened();
136         // > UPDATE CURRENT STATE
137
contInterior.put("jPanel1", new Rectangle JavaDoc(115, 31, 274, 157));
138         compBounds.put("jPanel1", new Rectangle JavaDoc(109, 11, 286, 183));
139         baselinePosition.put("jPanel1-286-183", new Integer JavaDoc(0));
140         compMinSize.put("jPanel1", new Dimension JavaDoc(12, 26));
141         compPrefSize.put("jPanel1", new Dimension JavaDoc(286, 183));
142         hasExplicitPrefSize.put("jPanel1", new Boolean JavaDoc(false));
143         hasExplicitPrefSize.put("jPanel1", new Boolean JavaDoc(false));
144         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 778, 481));
145         compBounds.put("add", new Rectangle JavaDoc(10, 11, 93, 23));
146         baselinePosition.put("add-93-23", new Integer JavaDoc(15));
147         compPrefSize.put("add", new Dimension JavaDoc(93, 23));
148         compBounds.put("jPanel1", new Rectangle JavaDoc(109, 11, 286, 183));
149         baselinePosition.put("jPanel1-286-183", new Integer JavaDoc(0));
150         compBounds.put("delete", new Rectangle JavaDoc(631, 173, 137, 23));
151         baselinePosition.put("delete-137-23", new Integer JavaDoc(15));
152         compPrefSize.put("delete", new Dimension JavaDoc(65, 23));
153         compBounds.put("jPanel2", new Rectangle JavaDoc(401, 11, 348, 164));
154         baselinePosition.put("jPanel2-348-164", new Integer JavaDoc(0));
155         compBounds.put("save", new Rectangle JavaDoc(401, 173, 114, 23));
156         baselinePosition.put("save-114-23", new Integer JavaDoc(15));
157         compPrefSize.put("save", new Dimension JavaDoc(59, 23));
158         prefPaddingInParent.put("Form-add-0-0", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
159
prefPadding.put("add-jPanel1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
160
prefPaddingInParent.put("Form-jPanel2-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
161
prefPaddingInParent.put("Form-delete-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
162
prefPaddingInParent.put("Form-jPanel2-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
163
prefPaddingInParent.put("Form-jPanel1-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
164
prefPaddingInParent.put("Form-add-1-0", new Integer JavaDoc(11)); // parentId-compId-dimension-compAlignment
165
contInterior.put("jPanel2", new Rectangle JavaDoc(407, 31, 336, 138));
166         compBounds.put("jPanel2", new Rectangle JavaDoc(401, 11, 348, 164));
167         baselinePosition.put("jPanel2-348-164", new Integer JavaDoc(0));
168         compMinSize.put("jPanel2", new Dimension JavaDoc(12, 26));
169         compPrefSize.put("jPanel2", new Dimension JavaDoc(348, 164));
170         hasExplicitPrefSize.put("jPanel2", new Boolean JavaDoc(false));
171         hasExplicitPrefSize.put("jPanel2", new Boolean JavaDoc(false));
172         ld.updateCurrentState();
173         // < UPDATE CURRENT STATE
174
}
175     
176 }
177
Popular Tags