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.Rectangle;
046:
047: public interface VisualMapper extends LayoutConstants {
048:
049: // String getTopComponentId();
050:
051: /**
052: * Provides actual bounds (position and size) of a component - as it appears
053: * in the visual design area. The position should be in coordinates of the
054: * whole design visualization.
055: * @param componentId
056: * @return actual bounds of given component, null if the component is not
057: * currently visualized in the design area
058: */
059: Rectangle getComponentBounds(String componentId);
060:
061: /**
062: * Provides actual position and size of the interior of a component
063: * container - as it appears in the visual design area. (The interior
064: * differs from the outer bounds in that it should reflect the borders
065: * or other insets). The position should be in coordinates of the whole
066: * design visualization.
067: * @param componentId
068: * @return actual interior of given component, null if the component is not
069: * currently visualized in the design area
070: */
071: Rectangle getContainerInterior(String componentId);
072:
073: Dimension getComponentMinimumSize(String componentId);
074:
075: Dimension getComponentPreferredSize(String componentId);
076:
077: boolean hasExplicitPreferredSize(String componentId);
078:
079: /**
080: * Provides preferred padding (optimal amount of space) between two components.
081: * @param component1Id first component Id
082: * @param component2Id second component Id
083: * @param dimension the dimension (HORIZONTAL or VERTICAL) in which the
084: * components are positioned
085: * @param comp2Alignment the edge (LEADING or TRAILING) at which the second
086: * component is placed next to the first component
087: * @param paddingType padding type (RELATED, UNRELATED, SEPARATE or INDENT)
088: * @return preferred padding (amount of space) between the given components
089: */
090: int getPreferredPadding(String component1Id, String component2Id,
091: int dimension, int comp2Alignment, PaddingType paddingType);
092:
093: /**
094: * Provides preferred padding (optimal amount of space) between a component
095: * and its parent's border.
096: * @param parentId Id of the parent container
097: * @param componentId Id of the component
098: * @param dimension the dimension (HORIZONTAL or VERTICAL) in which the
099: * component is positioned
100: * @param compALignment the edge (LEADING or TRAILING) of the component
101: * which should be placed next to the parent's border
102: * @return preferred padding (amount of space) between the component and its
103: * parent's border
104: */
105: int getPreferredPaddingInParent(String parentId,
106: String componentId, int dimension, int compAlignment);
107:
108: int getBaselinePosition(String componentId, int width, int height);
109:
110: boolean[] getComponentResizability(String compId,
111: boolean[] resizability);
112:
113: /**
114: * Rebuilds the layout of given container. Called if LayoutDesigner needs
115: * immediate update of the layout according to the model.
116: */
117: void rebuildLayout(String containerId);
118:
119: void setComponentVisibility(String componentId, boolean visible);
120: }
|