|
1 /* |
|
2 * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. Oracle designates this |
|
8 * particular file as subject to the "Classpath" exception as provided |
|
9 * by Oracle in the LICENSE file that accompanied this code. |
|
10 * |
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
|
15 * accompanied this code). |
|
16 * |
|
17 * You should have received a copy of the GNU General Public License version |
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 * |
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 * or visit www.oracle.com if you need additional information or have any |
|
23 * questions. |
|
24 */ |
|
25 package java.awt; |
|
26 |
|
27 /** |
|
28 * Defines an interface for classes that know how to layout Containers |
|
29 * based on a layout constraints object. |
|
30 * |
|
31 * This interface extends the LayoutManager interface to deal with layouts |
|
32 * explicitly in terms of constraint objects that specify how and where |
|
33 * components should be added to the layout. |
|
34 * <p> |
|
35 * This minimal extension to LayoutManager is intended for tool |
|
36 * providers who wish to the creation of constraint-based layouts. |
|
37 * It does not yet provide full, general support for custom |
|
38 * constraint-based layout managers. |
|
39 * |
|
40 * @see LayoutManager |
|
41 * @see Container |
|
42 * |
|
43 * @author Jonni Kanerva |
|
44 */ |
|
45 public interface LayoutManager2 extends LayoutManager { |
|
46 |
|
47 /** |
|
48 * Adds the specified component to the layout, using the specified |
|
49 * constraint object. |
|
50 * @param comp the component to be added |
|
51 * @param constraints where/how the component is added to the layout. |
|
52 */ |
|
53 void addLayoutComponent(Component comp, Object constraints); |
|
54 |
|
55 /** |
|
56 * Calculates the maximum size dimensions for the specified container, |
|
57 * given the components it contains. |
|
58 * |
|
59 * @see java.awt.Component#getMaximumSize |
|
60 * @see LayoutManager |
|
61 * @param target the target container |
|
62 * @return the maximum size of the container |
|
63 */ |
|
64 public Dimension maximumLayoutSize(Container target); |
|
65 |
|
66 /** |
|
67 * Returns the alignment along the x axis. This specifies how |
|
68 * the component would like to be aligned relative to other |
|
69 * components. The value should be a number between 0 and 1 |
|
70 * where 0 represents alignment along the origin, 1 is aligned |
|
71 * the furthest away from the origin, 0.5 is centered, etc. |
|
72 * |
|
73 * @param target the target container |
|
74 * @return the x-axis alignment preference |
|
75 */ |
|
76 public float getLayoutAlignmentX(Container target); |
|
77 |
|
78 /** |
|
79 * Returns the alignment along the y axis. This specifies how |
|
80 * the component would like to be aligned relative to other |
|
81 * components. The value should be a number between 0 and 1 |
|
82 * where 0 represents alignment along the origin, 1 is aligned |
|
83 * the furthest away from the origin, 0.5 is centered, etc. |
|
84 * |
|
85 * @param target the target container |
|
86 * @return the y-axis alignment preference |
|
87 */ |
|
88 public float getLayoutAlignmentY(Container target); |
|
89 |
|
90 /** |
|
91 * Invalidates the layout, indicating that if the layout manager |
|
92 * has cached information it should be discarded. |
|
93 * @param target the target container |
|
94 */ |
|
95 public void invalidateLayout(Container target); |
|
96 |
|
97 } |