KickJava   Java API By Example, From Geeks To Geeks.

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


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