001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.form.layoutdesign;
043:
044: import java.awt.Dimension;
045: import java.awt.Point;
046: import java.awt.Rectangle;
047: import java.io.File;
048: import java.io.IOException;
049: import java.util.*;
050: import org.openide.filesystems.FileUtil;
051:
052: public class ALT_Bug66919Test extends LayoutTestCase {
053:
054: public ALT_Bug66919Test(String name) {
055: super (name);
056: try {
057: className = this .getClass().getName();
058: className = className.substring(
059: className.lastIndexOf('.') + 1, className.length());
060: startingFormFile = FileUtil.toFileObject(new File(url
061: .getFile()
062: + goldenFilesPath
063: + className
064: + "-StartingForm.form").getCanonicalFile());
065: } catch (IOException ioe) {
066: fail(ioe.toString());
067: }
068: }
069:
070: // Resize 'Save' button slightly to the right. The layout is screwed in
071: // vertical dimension so the button overlaps with the panel above it, but
072: // resizing in horizontal dimension only should not care about this overlap.
073: public void doChanges0() {
074: ld.externalSizeChangeHappened();
075: // > UPDATE CURRENT STATE
076: contInterior.put("jPanel1", new Rectangle(115, 31, 274, 157));
077: compBounds.put("jPanel1", new Rectangle(109, 11, 286, 183));
078: baselinePosition.put("jPanel1-286-183", new Integer(0));
079: compMinSize.put("jPanel1", new Dimension(12, 26));
080: compPrefSize.put("jPanel1", new Dimension(286, 183));
081: hasExplicitPrefSize.put("jPanel1", new Boolean(false));
082: hasExplicitPrefSize.put("jPanel1", new Boolean(false));
083: contInterior.put("Form", new Rectangle(0, 0, 778, 481));
084: compBounds.put("add", new Rectangle(10, 11, 93, 23));
085: baselinePosition.put("add-93-23", new Integer(15));
086: compPrefSize.put("add", new Dimension(93, 23));
087: compBounds.put("jPanel1", new Rectangle(109, 11, 286, 183));
088: baselinePosition.put("jPanel1-286-183", new Integer(0));
089: compBounds.put("save", new Rectangle(401, 173, 92, 23));
090: baselinePosition.put("save-92-23", new Integer(15));
091: compPrefSize.put("save", new Dimension(59, 23));
092: compBounds.put("delete", new Rectangle(631, 173, 137, 23));
093: baselinePosition.put("delete-137-23", new Integer(15));
094: compPrefSize.put("delete", new Dimension(65, 23));
095: compBounds.put("jPanel2", new Rectangle(401, 11, 348, 164));
096: baselinePosition.put("jPanel2-348-164", new Integer(0));
097: prefPaddingInParent.put("Form-add-0-0", new Integer(10)); // parentId-compId-dimension-compAlignment
098: prefPadding.put("add-jPanel1-0-0-0", new Integer(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
099: prefPaddingInParent.put("Form-jPanel2-0-1", new Integer(10)); // parentId-compId-dimension-compAlignment
100: prefPaddingInParent.put("Form-delete-0-1", new Integer(10)); // parentId-compId-dimension-compAlignment
101: prefPaddingInParent.put("Form-jPanel2-1-0", new Integer(11)); // parentId-compId-dimension-compAlignment
102: prefPaddingInParent.put("Form-jPanel1-1-0", new Integer(11)); // parentId-compId-dimension-compAlignment
103: prefPaddingInParent.put("Form-add-1-0", new Integer(11)); // parentId-compId-dimension-compAlignment
104: contInterior.put("jPanel2", new Rectangle(407, 31, 336, 138));
105: compBounds.put("jPanel2", new Rectangle(401, 11, 348, 164));
106: baselinePosition.put("jPanel2-348-164", new Integer(0));
107: compMinSize.put("jPanel2", new Dimension(12, 26));
108: compPrefSize.put("jPanel2", new Dimension(348, 164));
109: hasExplicitPrefSize.put("jPanel2", new Boolean(false));
110: hasExplicitPrefSize.put("jPanel2", new Boolean(false));
111: ld.updateCurrentState();
112: // < UPDATE CURRENT STATE
113: // > START RESIZING
114: {
115: String[] compIds = new String[] { "save" };
116: Rectangle[] bounds = new Rectangle[] { new Rectangle(401,
117: 173, 92, 23) };
118: Point hotspot = new Point(494, 186);
119: int[] resizeEdges = new int[] { 1, -1 };
120: boolean inLayout = true;
121: ld.startResizing(compIds, bounds, hotspot, resizeEdges,
122: inLayout);
123: }
124: baselinePosition.put("save-92-23", new Integer(15));
125: compPrefSize.put("save", new Dimension(59, 23));
126: // < START RESIZING
127: prefPadding.put("save-delete-0-0-0", new Integer(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
128: // > MOVE
129: {
130: Point p = new Point(515, 184);
131: String containerId = "Form";
132: boolean autoPositioning = true;
133: boolean lockDimension = false;
134: Rectangle[] bounds = new Rectangle[] { new Rectangle(401,
135: 173, 113, 23) };
136: ld.move(p, containerId, autoPositioning, lockDimension,
137: bounds);
138: }
139: // < MOVE
140: prefPadding.put("save-delete-0-0-0", new Integer(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
141: // > MOVE
142: {
143: Point p = new Point(516, 184);
144: String containerId = "Form";
145: boolean autoPositioning = true;
146: boolean lockDimension = false;
147: Rectangle[] bounds = new Rectangle[] { new Rectangle(401,
148: 173, 114, 23) };
149: ld.move(p, containerId, autoPositioning, lockDimension,
150: bounds);
151: }
152: // < MOVE
153: // > END MOVING
154: prefPadding.put("save-delete-0-0-0", new Integer(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
155: ld.endMoving(true);
156: // < END MOVING
157: ld.externalSizeChangeHappened();
158: // > UPDATE CURRENT STATE
159: contInterior.put("jPanel1", new Rectangle(115, 31, 274, 157));
160: compBounds.put("jPanel1", new Rectangle(109, 11, 286, 183));
161: baselinePosition.put("jPanel1-286-183", new Integer(0));
162: compMinSize.put("jPanel1", new Dimension(12, 26));
163: compPrefSize.put("jPanel1", new Dimension(286, 183));
164: hasExplicitPrefSize.put("jPanel1", new Boolean(false));
165: hasExplicitPrefSize.put("jPanel1", new Boolean(false));
166: contInterior.put("Form", new Rectangle(0, 0, 778, 481));
167: compBounds.put("add", new Rectangle(10, 11, 93, 23));
168: baselinePosition.put("add-93-23", new Integer(15));
169: compPrefSize.put("add", new Dimension(93, 23));
170: compBounds.put("jPanel1", new Rectangle(109, 11, 286, 183));
171: baselinePosition.put("jPanel1-286-183", new Integer(0));
172: compBounds.put("delete", new Rectangle(631, 173, 137, 23));
173: baselinePosition.put("delete-137-23", new Integer(15));
174: compPrefSize.put("delete", new Dimension(65, 23));
175: compBounds.put("jPanel2", new Rectangle(401, 11, 348, 164));
176: baselinePosition.put("jPanel2-348-164", new Integer(0));
177: compBounds.put("save", new Rectangle(401, 173, 114, 23));
178: baselinePosition.put("save-114-23", new Integer(15));
179: compPrefSize.put("save", new Dimension(59, 23));
180: prefPaddingInParent.put("Form-add-0-0", new Integer(10)); // parentId-compId-dimension-compAlignment
181: prefPadding.put("add-jPanel1-0-0-0", new Integer(6)); // comp1Id-comp2Id-dimension-comp2Alignment-paddingType
182: prefPaddingInParent.put("Form-jPanel2-0-1", new Integer(10)); // parentId-compId-dimension-compAlignment
183: prefPaddingInParent.put("Form-delete-0-1", new Integer(10)); // parentId-compId-dimension-compAlignment
184: prefPaddingInParent.put("Form-jPanel2-1-0", new Integer(11)); // parentId-compId-dimension-compAlignment
185: prefPaddingInParent.put("Form-jPanel1-1-0", new Integer(11)); // parentId-compId-dimension-compAlignment
186: prefPaddingInParent.put("Form-add-1-0", new Integer(11)); // parentId-compId-dimension-compAlignment
187: contInterior.put("jPanel2", new Rectangle(407, 31, 336, 138));
188: compBounds.put("jPanel2", new Rectangle(401, 11, 348, 164));
189: baselinePosition.put("jPanel2-348-164", new Integer(0));
190: compMinSize.put("jPanel2", new Dimension(12, 26));
191: compPrefSize.put("jPanel2", new Dimension(348, 164));
192: hasExplicitPrefSize.put("jPanel2", new Boolean(false));
193: hasExplicitPrefSize.put("jPanel2", new Boolean(false));
194: ld.updateCurrentState();
195: // < UPDATE CURRENT STATE
196: }
197:
198: }
|