de.uni_paderborn.fujaba.fsa.swing
Class OvalLayout

java.lang.Object
  extended byde.uni_paderborn.fujaba.fsa.swing.OvalLayout
All Implemented Interfaces:
java.awt.LayoutManager

public class OvalLayout
extends java.lang.Object
implements java.awt.LayoutManager

Layouts the components line by line in such a style that the components will fit into an OvalBorder that may be put around the container.

The insets of the OvalBorder that encloses the component directly (i.e. the OvalBorder is the inner border of a CompoundBorder or the OvalBorder is used alone) are ignored.

This LayoutManager tries to optimize the horizontal size of the oval by shifting the components vertically.

Version:
$Revision: 1.13 $
Author:
$Author: lowende $

Nested Class Summary
private static class OvalLayout.ComponentInfo
          ComponentInfo serves as a simple data structure for associating a component with its planned bounds.
private  class OvalLayout.TempLayout
          Container for a layout that has been calculated but not yet applied to the components.
 
Field Summary
(package private)  int borderGap
          The spacing between the components and the border of the oval
(package private)  int verticalBorderGap
          More spacing at the top and at the bottom of the oval
(package private)  int verticalGap
          The vertical spacing between the components
 
Constructor Summary
OvalLayout()
          Creates an OvalLayout with default settings.
OvalLayout(int verticalGap, int borderGap, int verticalBorderGap)
          Creates an OvalLayout with the given vgap.
 
Method Summary
 void addLayoutComponent(java.lang.String name, java.awt.Component comp)
          Adds a component to the layout.
static java.awt.Insets getInsetsTilBorder(javax.swing.JComponent c, javax.swing.border.Border stopBorder)
          Calculates the insets of this container til the given oval border.
private static boolean getInsetsTilBorder(javax.swing.JComponent c, javax.swing.border.Border thisBorder, javax.swing.border.Border stopBorder, java.awt.Insets insets)
          Get the insetsTilBorder attribute of the OvalLayout class
static java.awt.Insets getInsetsWithoutOval(java.awt.Container container)
          Calculates the insets of this container, but ignores the insets of an directly enclosing OvalBorder, if it exists.
 void layoutContainer(java.awt.Container container)
          Lay outs the components in the container that they fit into an oval that the container can contain ...
 java.awt.Dimension minimumLayoutSize(java.awt.Container container)
          Returns the minimum size that the container may use.
 java.awt.Dimension preferredLayoutSize(java.awt.Container container)
          Returns the preferred size of this layout.
 void removeLayoutComponent(java.awt.Component comp)
          Removes a component from the layout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

verticalGap

int verticalGap
The vertical spacing between the components


borderGap

int borderGap
The spacing between the components and the border of the oval


verticalBorderGap

int verticalBorderGap
More spacing at the top and at the bottom of the oval

Constructor Detail

OvalLayout

public OvalLayout()
Creates an OvalLayout with default settings.


OvalLayout

public OvalLayout(int verticalGap,
                  int borderGap,
                  int verticalBorderGap)
Creates an OvalLayout with the given vgap.

Parameters:
verticalGap - the vertical spacing between the components
borderGap - The spacing between the components and the border of the oval
verticalBorderGap - No description provided
Method Detail

layoutContainer

public void layoutContainer(java.awt.Container container)
Lay outs the components in the container that they fit into an oval that the container can contain ... (weird sentence)

Specified by:
layoutContainer in interface java.awt.LayoutManager
Parameters:
container - No description provided

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container container)
Returns the minimum size that the container may use. Is currently equal to the preferred layout size.

Specified by:
minimumLayoutSize in interface java.awt.LayoutManager
Parameters:
container - No description provided
Returns:
No description provided

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container container)
Returns the preferred size of this layout.

Specified by:
preferredLayoutSize in interface java.awt.LayoutManager
Parameters:
container - No description provided
Returns:
No description provided

addLayoutComponent

public void addLayoutComponent(java.lang.String name,
                               java.awt.Component comp)
Adds a component to the layout. Not used by this LayoutManager.

Specified by:
addLayoutComponent in interface java.awt.LayoutManager
Parameters:
name - The object added.
comp - The object added.

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component comp)
Removes a component from the layout. Not used by this LayoutManager.

Specified by:
removeLayoutComponent in interface java.awt.LayoutManager
Parameters:
comp - No description provided

getInsetsWithoutOval

public static java.awt.Insets getInsetsWithoutOval(java.awt.Container container)
Calculates the insets of this container, but ignores the insets of an directly enclosing OvalBorder, if it exists.

Parameters:
container - the container to calculate the insets for.
Returns:
the insets of the container without the insets of the inner OvalBorder.

getInsetsTilBorder

private static boolean getInsetsTilBorder(javax.swing.JComponent c,
                                          javax.swing.border.Border thisBorder,
                                          javax.swing.border.Border stopBorder,
                                          java.awt.Insets insets)
Get the insetsTilBorder attribute of the OvalLayout class

Parameters:
c - No description provided
thisBorder - No description provided
stopBorder - No description provided
insets - No description provided
Returns:
The insetsTilBorder value

getInsetsTilBorder

public static java.awt.Insets getInsetsTilBorder(javax.swing.JComponent c,
                                                 javax.swing.border.Border stopBorder)
Calculates the insets of this container til the given oval border.

Parameters:
c - the component the border belongs to
stopBorder - No description provided
Returns:
the insets of the component starting from the outer border til the given border