KickJava   Java API By Example, From Geeks To Geeks.

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


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 resized under its minimum size.
32
public class ALT_ParallelPosition14Test extends LayoutTestCase {
33
34     public ALT_ParallelPosition14Test(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 (shrink) the button to right align with the toggle button.
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("jToggleButton1", new Rectangle JavaDoc(10, 11, 105, 23));
51         baselinePosition.put("jToggleButton1-105-23", new Integer JavaDoc(15));
52         compPrefSize.put("jToggleButton1", new Dimension JavaDoc(105, 23));
53         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 44, 34, 14));
54         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
55         compPrefSize.put("jLabel1", new Dimension JavaDoc(34, 14));
56         compBounds.put("jButton1", new Rectangle JavaDoc(48, 40, 75, 23));
57         baselinePosition.put("jButton1-75-23", new Integer JavaDoc(15));
58         compPrefSize.put("jButton1", new Dimension JavaDoc(75, 23));
59         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
60         compBounds.put("jToggleButton1", new Rectangle JavaDoc(10, 11, 105, 23));
61         baselinePosition.put("jToggleButton1-105-23", new Integer JavaDoc(15));
62         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 44, 34, 14));
63         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
64         compBounds.put("jButton1", new Rectangle JavaDoc(48, 40, 75, 23));
65         baselinePosition.put("jButton1-75-23", new Integer JavaDoc(15));
66         ld.updateCurrentState();
67         // < UPDATE CURRENT STATE
68
// > START RESIZING
69
baselinePosition.put("jButton1-75-23", new Integer JavaDoc(15));
70         compPrefSize.put("jButton1", new Dimension JavaDoc(75, 23));
71         {
72             String JavaDoc[] compIds = new String JavaDoc[] {
73                 "jButton1"
74                 };
75             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
76                 new Rectangle JavaDoc(48, 40, 75, 23)
77                 };
78             Point JavaDoc hotspot = new Point JavaDoc(124,53);
79             int[] resizeEdges = new int[] {
80                 1,
81                     -1
82                 };
83             boolean inLayout = true;
84             ld.startResizing(compIds, bounds, hotspot, resizeEdges, inLayout);
85         }
86         // < START RESIZING
87
prefPaddingInParent.put("Form-jButton1-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
88
// > MOVE
89
{
90             Point JavaDoc p = new Point JavaDoc(119,53);
91             String JavaDoc containerId= "Form";
92             boolean autoPositioning = true;
93             boolean lockDimension = false;
94             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
95                 new Rectangle JavaDoc(48, 40, 67, 23)
96                 };
97             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
98         }
99         // < MOVE
100
prefPaddingInParent.put("Form-jButton1-0-1", new Integer JavaDoc(10)); // parentId-compId-dimension-compAlignment
101
// > MOVE
102
{
103             Point JavaDoc p = new Point JavaDoc(118,53);
104             String JavaDoc containerId= "Form";
105             boolean autoPositioning = true;
106             boolean lockDimension = false;
107             Rectangle JavaDoc[] bounds = new Rectangle JavaDoc[] {
108                 new Rectangle JavaDoc(48, 40, 67, 23)
109                 };
110             ld.move(p, containerId, autoPositioning, lockDimension, bounds);
111         }
112         // < MOVE
113
// > END MOVING
114
compPrefSize.put("jButton1", new Dimension JavaDoc(75, 23));
115         ld.endMoving(true);
116         // < END MOVING
117
ld.externalSizeChangeHappened();
118         // > UPDATE CURRENT STATE
119
contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
120         compBounds.put("jToggleButton1", new Rectangle JavaDoc(10, 11, 105, 23));
121         baselinePosition.put("jToggleButton1-105-23", new Integer JavaDoc(15));
122         compPrefSize.put("jToggleButton1", new Dimension JavaDoc(105, 23));
123         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 44, 34, 14));
124         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
125         compPrefSize.put("jLabel1", new Dimension JavaDoc(34, 14));
126         compBounds.put("jButton1", new Rectangle JavaDoc(48, 40, 67, 23));
127         baselinePosition.put("jButton1-67-23", new Integer JavaDoc(15));
128         compPrefSize.put("jButton1", new Dimension JavaDoc(75, 23));
129         contInterior.put("Form", new Rectangle JavaDoc(0, 0, 400, 300));
130         compBounds.put("jToggleButton1", new Rectangle JavaDoc(10, 11, 105, 23));
131         baselinePosition.put("jToggleButton1-105-23", new Integer JavaDoc(15));
132         compBounds.put("jLabel1", new Rectangle JavaDoc(10, 44, 34, 14));
133         baselinePosition.put("jLabel1-34-14", new Integer JavaDoc(11));
134         compBounds.put("jButton1", new Rectangle JavaDoc(48, 40, 67, 23));
135         baselinePosition.put("jButton1-67-23", new Integer JavaDoc(15));
136         ld.updateCurrentState();
137         // < UPDATE CURRENT STATE
138
}
139     
140 }
141
Popular Tags