KickJava   Java API By Example, From Geeks To Geeks.

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


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.Rectangle JavaDoc;
24
25 public interface VisualMapper {
26
27     int PADDING_RELATED = 0;
28     int PADDING_UNRELATED = 1;
29     int INDENT = 2;
30
31 // String getTopComponentId();
32

33     /**
34      * Provides actual bounds (position and size) of a component - as it appears
35      * in the visual design area. The position should be in coordinates of the
36      * whole design visualization.
37      * @param componentId
38      * @return actual bounds of given component, null if the component is not
39      * currently visualized in the design area
40      */

41     Rectangle JavaDoc getComponentBounds(String JavaDoc componentId);
42     
43     /**
44      * Provides actual position and size of the interior of a component
45      * container - as it appears in the visual design area. (The interior
46      * differs from the outer bounds in that it should reflect the borders
47      * or other insets). The position should be in coordinates of the whole
48      * design visualization.
49      * @param componentId
50      * @return actual interior of given component, null if the component is not
51      * currently visualized in the design area
52      */

53     Rectangle JavaDoc getContainerInterior(String JavaDoc componentId);
54
55     Dimension JavaDoc getComponentMinimumSize(String JavaDoc componentId);
56     Dimension JavaDoc getComponentPreferredSize(String JavaDoc componentId);
57
58     boolean hasExplicitPreferredSize(String JavaDoc componentId);
59
60     /**
61      * Provides preferred padding (optimal amount of space) between two components.
62      * @param component1Id first component Id
63      * @param component2Id second component Id
64      * @param dimension the dimension (HORIZONTAL or VERTICAL) in which the
65      * components are positioned
66      * @param comp2Alignment the edge (LEADING or TRAILING) at which the second
67      * component is placed next to the first component
68      * @param paddingType padding type (PADDING_RELATED, PADDING_UNRELATED or INDENT)
69      * @return preferred padding (amount of space) between the given components
70      */

71     int getPreferredPadding(String JavaDoc component1Id,
72                             String JavaDoc component2Id,
73                             int dimension,
74                             int comp2Alignment,
75                             int paddingType);
76
77     /**
78      * Provides preferred padding (optimal amount of space) between a component
79      * and its parent's border.
80      * @param parentId Id of the parent container
81      * @param componentId Id of the component
82      * @param dimension the dimension (HORIZONTAL or VERTICAL) in which the
83      * component is positioned
84      * @param compALignment the edge (LEADING or TRAILING) of the component
85      * which should be placed next to the parent's border
86      * @return preferred padding (amount of space) between the component and its
87      * parent's border
88      */

89     int getPreferredPaddingInParent(String JavaDoc parentId,
90                                     String JavaDoc componentId,
91                                     int dimension,
92                                     int compAlignment);
93
94     int getBaselinePosition(String JavaDoc componentId, int width, int height);
95
96     boolean[] getComponentResizability(String JavaDoc compId, boolean[] resizability);
97
98     /**
99      * Rebuilds the layout of given container. Called if LayoutDesigner needs
100      * immediate update of the layout according to the model.
101      */

102     void rebuildLayout(String JavaDoc containerId);
103 }
104
Popular Tags