KickJava   Java API By Example, From Geeks To Geeks.

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


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 // Testing snapping out of parallel group with suppressed resizing - needs to be
31
// enabled again.
32
public class ALT_ParallelPosition18Test extends LayoutTestCase {
33
34     public ALT_ParallelPosition18Test(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 the second textfield to the right to snap next to the text area.
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("jLabel1", new Rectangle JavaDoc(10, 14, 34, 14));
51         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
52         compPrefSize.put("jLabel1", new Dimension JavaDoc(34, 14));
53         compBounds.put("jTextField1", new Rectangle JavaDoc(48, 11, 97, 20));
54         baselinePosition.put("jTextField1-97-20", new Integer JavaDoc(14));
55         compPrefSize.put("jTextField1", new Dimension JavaDoc(59, 20));
56         compBounds.put("jLabel2", new Rectangle JavaDoc(10, 40, 34, 14));
57         baselinePosition.put("jLabel2-34-14", new Integer JavaDoc(11));
58         compPrefSize.put("jLabel2", new Dimension JavaDoc(34, 14));
59         compBounds.put("jTextField2", new Rectangle JavaDoc(48, 37, 97, 20));
60         baselinePosition.put("jTextField2-97-20", new Integer JavaDoc(14));
61         compPrefSize.put("jTextField2", new Dimension JavaDoc(59, 20));
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         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
66         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 14, 34, 14));
67         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
68         compBounds.put("jTextField1", new Rectangle JavaDoc(48, 11, 97, 20));
69         baselinePosition.put("jTextField1-97-20", new Integer JavaDoc(14));
70         compBounds.put("jLabel2", new Rectangle JavaDoc(10, 40, 34, 14));
71         baselinePosition.put("jLabel2-34-14", new Integer JavaDoc(11));
72         compBounds.put("jTextField2", new Rectangle JavaDoc(48, 37, 97, 20));
73         baselinePosition.put("jTextField2-97-20", new Integer JavaDoc(14));
74         compBounds.put("jScrollPane1", new Rectangle JavaDoc(286, 11, 104, 64));
75         baselinePosition.put("jScrollPane1-104-64", new Integer JavaDoc(0));
76         ld.updateCurrentState();
77         // < UPDATE CURRENT STATE
78
// > START RESIZING
79
baselinePosition.put("jTextField2-97-20", new Integer JavaDoc(14));
80         compPrefSize.put("jTextField2", new Dimension JavaDoc(59, 20));
81         {
82             String JavaDoc[] compIds = new String JavaDoc[] {
83                 "jTextField2"
84                 };
85             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
86                 new Rectangle JavaDoc(48, 37, 97, 20)
87                 };
88             Point JavaDoc hotspot = new Point JavaDoc(148,49);
89             int[] resizeEdges = new int[] {
90                 1,
91                     -1
92                 };
93             boolean inLayout = true;
94             ld.startResizing(compIds, bounds, hotspot, resizeEdges, inLayout);
95         }
96         // < START RESIZING
97
prefPadding.put("jTextField2-jScrollPane1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
98
// > MOVE
99
{
100             Point JavaDoc p = new Point JavaDoc(281,49);
101             String JavaDoc containerId= "Form";
102             boolean autoPositioning = true;
103             boolean lockDimension = false;
104             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
105                 new Rectangle JavaDoc(48, 37, 232, 20)
106                 };
107             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
108         }
109         // < MOVE
110
prefPadding.put("jTextField2-jScrollPane1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
111
// > MOVE
112
{
113             Point JavaDoc p = new Point JavaDoc(280,49);
114             String JavaDoc containerId= "Form";
115             boolean autoPositioning = true;
116             boolean lockDimension = false;
117             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
118                 new Rectangle JavaDoc(48, 37, 232, 20)
119                 };
120             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
121         }
122         // < MOVE
123
// > END MOVING
124
prefPadding.put("jTextField1-jScrollPane1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
125
prefPadding.put("jTextField2-jScrollPane1-0-0-0", new Integer JavaDoc(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
126
ld.endMoving(true);
127         // < END MOVING
128
ld.externalSizeChangeHappened();
129         // > UPDATE CURRENT STATE
130
contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
131         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 14, 34, 14));
132         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
133         compPrefSize.put("jLabel1", new Dimension JavaDoc(34, 14));
134         compBounds.put("jTextField1", new Rectangle JavaDoc(48, 11, 97, 20));
135         baselinePosition.put("jTextField1-97-20", new Integer JavaDoc(14));
136         compPrefSize.put("jTextField1", new Dimension JavaDoc(59, 20));
137         compBounds.put("jLabel2", new Rectangle JavaDoc(10, 40, 34, 14));
138         baselinePosition.put("jLabel2-34-14", new Integer JavaDoc(11));
139         compPrefSize.put("jLabel2", new Dimension JavaDoc(34, 14));
140         compBounds.put("jScrollPane1", new Rectangle JavaDoc(286, 11, 104, 64));
141         baselinePosition.put("jScrollPane1-104-64", new Integer JavaDoc(0));
142         compPrefSize.put("jScrollPane1", new Dimension JavaDoc(104, 64));
143         compBounds.put("jTextField2", new Rectangle JavaDoc(48, 37, 232, 20));
144         baselinePosition.put("jTextField2-232-20", new Integer JavaDoc(14));
145         compPrefSize.put("jTextField2", new Dimension JavaDoc(59, 20));
146         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
147         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 14, 34, 14));
148         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
149         compBounds.put("jTextField1", new Rectangle JavaDoc(48, 11, 97, 20));
150         baselinePosition.put("jTextField1-97-20", new Integer JavaDoc(14));
151         compBounds.put("jLabel2", new Rectangle JavaDoc(10, 40, 34, 14));
152         baselinePosition.put("jLabel2-34-14", new Integer JavaDoc(11));
153         compBounds.put("jScrollPane1", new Rectangle JavaDoc(286, 11, 104, 64));
154         baselinePosition.put("jScrollPane1-104-64", new Integer JavaDoc(0));
155         compBounds.put("jTextField2", new Rectangle JavaDoc(48, 37, 232, 20));
156         baselinePosition.put("jTextField2-232-20", new Integer JavaDoc(14));
157         ld.updateCurrentState();
158         // < UPDATE CURRENT STATE
159
}
160     
161 }
162
Popular Tags