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