/[classpath]/classpath/javax/swing/OverlayLayout.java
ViewVC logotype

Diff of /classpath/javax/swing/OverlayLayout.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by rabbit78, Thu Sep 29 22:00:38 2005 UTC revision 1.8 by rabbit78, Thu Sep 29 22:32:18 2005 UTC
# Line 1  Line 1 
1  /* OverlayLayout.java --  /* OverlayLayout.java -- A layout manager
2     Copyright (C) 2002, 2004 Free Software Foundation, Inc.     Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 45  import java.awt.LayoutManager2; Line 45  import java.awt.LayoutManager2;
45  import java.io.Serializable;  import java.io.Serializable;
46    
47  /**  /**
48   * OverlayLayout   * A layout manager that lays out the components of a container one over
49   * @author      Andrew Selkirk   * another.
50   * @version     1.0   *
51     * The components take as much space as is available in the container, but not
52     * more than specified by their maximum size.
53     *
54     * The overall layout is mainly affected by the components
55     * <code>alignmentX</code> and <code>alignmentY</code> properties. All
56     * components are aligned, so that their alignment points (for either
57     * direction) are placed in one line (the baseline for this direction).
58     *
59     * For example: An X alignment of 0.0 means that the component's alignment
60     * point is at it's left edge, an X alignment of 0.5 means that the alignment
61     * point is in the middle, an X alignment of 1.0 means, the aligment point is
62     * at the right edge. So if you have three components, the first with 0.0, the
63     * second with 0.5 and the third with 1.0, then they are laid out like this:
64     *
65     * <pre>
66     *          +-------+
67     *          |   1   |
68     *          +-------+
69     *      +-------+
70     *      |   2   |
71     *      +-------+
72     * +---------+
73     * |    3    +
74     * +---------+
75     * </pre>
76     * The above picture shows the X alignment between the components. An Y
77     * alignment like shown above cannot be achieved with this layout manager. The
78     * components are place on top of each other, with the X alignment shown above.
79     *
80     * @author Roman Kennke (kennke@aicas.com)
81     * @author Andrew Selkirk
82   */   */
83  public class OverlayLayout implements LayoutManager2, Serializable  public class OverlayLayout implements LayoutManager2, Serializable
84  {  {
85    private static final long serialVersionUID = 18082829169631543L;    private static final long serialVersionUID = 18082829169631543L;
86    
87    /**    /**
88     * target     * The container to be laid out.
89     */     */
90    private Container target;    private Container target;
91    
92    /**    /**
93     * xChildren     * The size requirements of the containers children for the X direction.
94     */     */
95    private SizeRequirements[] xChildren;    private SizeRequirements[] xChildren;
96    
97    /**    /**
98     * yChildren     * The size requirements of the containers children for the Y direction.
99     */     */
100    private SizeRequirements[] yChildren;    private SizeRequirements[] yChildren;
101    
102    /**    /**
103     * xTotal     * The size requirements of the container to be laid out for the X direction.
104     */     */
105    private SizeRequirements xTotal;    private SizeRequirements xTotal;
106    
107    /**    /**
108     * yTotal     * The size requirements of the container to be laid out for the Y direction.
109     */     */
110    private SizeRequirements yTotal;    private SizeRequirements yTotal;
111    
# Line 99  public class OverlayLayout implements La Line 130  public class OverlayLayout implements La
130    private int[] spansY;    private int[] spansY;
131    
132    /**    /**
133     * Constructor OverlayLayout     * Creates a new OverlayLayout for the specified container.
134     * @param target TODO     *
135       * @param target the container to be laid out
136     */     */
137    public OverlayLayout(Container target)    public OverlayLayout(Container target)
138    {    {
# Line 108  public class OverlayLayout implements La Line 140  public class OverlayLayout implements La
140    }    }
141    
142    /**    /**
143     * invalidateLayout     * Notifies the layout manager that the layout has become invalid. It throws
144     * @param target TODO     * away cached layout information and recomputes it the next time it is
145       * requested.
146       *
147       * @param target not used here
148     */     */
149    public void invalidateLayout(Container target)    public void invalidateLayout(Container target)
150    {    {
# Line 124  public class OverlayLayout implements La Line 159  public class OverlayLayout implements La
159    }    }
160    
161    /**    /**
162     * addLayoutComponent     * This method is not used in this layout manager.
163     * @param string TODO     *
164     * @param component TODO     * @param string not used here
165       * @param component not used here
166     */     */
167    public void addLayoutComponent(String string, Component component)    public void addLayoutComponent(String string, Component component)
168    {    {
# Line 134  public class OverlayLayout implements La Line 170  public class OverlayLayout implements La
170    }    }
171    
172    /**    /**
173     * addLayoutComponent     * This method is not used in this layout manager.
174     * @param component TODO     *
175     * @param constraints TODO     * @param component not used here
176       * @param constraints not used here
177     */     */
178    public void addLayoutComponent(Component component, Object constraints)    public void addLayoutComponent(Component component, Object constraints)
179    {    {
# Line 144  public class OverlayLayout implements La Line 181  public class OverlayLayout implements La
181    }    }
182    
183    /**    /**
184     * removeLayoutComponent     * This method is not used in this layout manager.
185     * @param component TODO     *
186       * @param component not used here
187     */     */
188    public void removeLayoutComponent(Component component)    public void removeLayoutComponent(Component component)
189    {    {
# Line 153  public class OverlayLayout implements La Line 191  public class OverlayLayout implements La
191    }    }
192    
193    /**    /**
194     * preferredLayoutSize     * Returns the preferred size of the container that is laid out. This is
195     * @param target TODO     * computed by the children's preferred sizes, taking their alignments into
196     * @returns Dimension     * account.
197       *
198       * @param target not used here
199       *
200       * @returns the preferred size of the container that is laid out
201     */     */
202    public Dimension preferredLayoutSize(Container target)    public Dimension preferredLayoutSize(Container target)
203    {    {
# Line 167  public class OverlayLayout implements La Line 209  public class OverlayLayout implements La
209    }    }
210    
211    /**    /**
212     * minimumLayoutSize     * Returns the minimum size of the container that is laid out. This is
213     * @param target TODO     * computed by the children's minimum sizes, taking their alignments into
214     * @returns Dimension     * account.
215       *
216       * @param target not used here
217       *
218       * @returns the minimum size of the container that is laid out
219     */     */
220    public Dimension minimumLayoutSize(Container target)    public Dimension minimumLayoutSize(Container target)
221    {    {
# Line 181  public class OverlayLayout implements La Line 227  public class OverlayLayout implements La
227    }    }
228    
229    /**    /**
230     * maximumLayoutSize     * Returns the maximum size of the container that is laid out. This is
231     * @param target TODO     * computed by the children's maximum sizes, taking their alignments into
232     * @returns Dimension     * account.
233       *
234       * @param target not used here
235       *
236       * @returns the maximum size of the container that is laid out
237     */     */
238    public Dimension maximumLayoutSize(Container target)    public Dimension maximumLayoutSize(Container target)
239    {    {
# Line 195  public class OverlayLayout implements La Line 245  public class OverlayLayout implements La
245    }    }
246    
247    /**    /**
248     * getLayoutAlignmentX     * Returns the X alignment of the container that is laid out. This is
249     * @param target TODO     * computed by the children's preferred sizes, taking their alignments into
250     * @returns float     * account.
251       *
252       * @param target not used here
253       *
254       * @returns the X alignment of the container that is laid out
255     */     */
256    public float getLayoutAlignmentX(Container target)    public float getLayoutAlignmentX(Container target)
257    {    {
# Line 209  public class OverlayLayout implements La Line 263  public class OverlayLayout implements La
263    }    }
264    
265    /**    /**
266     * getLayoutAlignmentY     * Returns the Y alignment of the container that is laid out. This is
267     * @param target TODO     * computed by the children's preferred sizes, taking their alignments into
268     * @returns float     * account.
269       *
270       * @param target not used here
271       *
272       * @returns the X alignment of the container that is laid out
273     */     */
274    public float getLayoutAlignmentY(Container target)    public float getLayoutAlignmentY(Container target)
275    {    {
# Line 223  public class OverlayLayout implements La Line 281  public class OverlayLayout implements La
281    }    }
282    
283    /**    /**
284     * layoutContainer     * Lays out the container and it's children.
285     * @param target TODO     *
286       * The children are laid out one over another.
287       *
288       * The components take as much space as is available in the container, but
289       * not more than specified by their maximum size.
290       *
291       * The overall layout is mainly affected by the components
292       * <code>alignmentX</code> and <code>alignmentY</code> properties. All
293       * components are aligned, so that their alignment points (for either
294       * direction) are placed in one line (the baseline for this direction).
295       *
296       * For example: An X alignment of 0.0 means that the component's alignment
297       * point is at it's left edge, an X alignment of 0.5 means that the alignment
298       * point is in the middle, an X alignment of 1.0 means, the aligment point is
299       * at the right edge. So if you have three components, the first with 0.0,
300       * the second with 0.5 and the third with 1.0, then they are laid out like
301       * this:
302       *
303       * <pre>
304       *          +-------+
305       *          |   1   |
306       *          +-------+
307       *      +-------+
308       *      |   2   |
309       *      +-------+
310       * +---------+
311       * |    3    +
312       * +---------+
313       * </pre>
314       * The above picture shows the X alignment between the components. An Y
315       * alignment like shown above cannot be achieved with this layout manager.
316       * The components are place on top of each other, with the X alignment shown
317       * above.
318       *
319       * @param target not used here
320     */     */
321    public void layoutContainer(Container target)    public void layoutContainer(Container target)
322    {    {

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26