gov.sns.tools.apputils
Class EdgeLayout

java.lang.Object
  |
  +--gov.sns.tools.apputils.EdgeLayout
All Implemented Interfaces:
java.awt.LayoutManager

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

EdgeLayout allows the developer a simpler mechanism for layout of components than the GridBagLayout without sacrificing powerful layout capability. The developer simply defines the behavior of motion for the component with respect to its parent and how the component grows. The motion is specified by struts between the edges of the the component and the corresponding edges of the parent container. For example, if you use a RIGHT strut, the component is bound to its parent's right edge according to the initial placement of the component. That is, the gap between the right edges of the parent and its container is preserved. If the component is bound left and right to its parent and the component is constrained to grow horizontally, the component will maintain the left and right gaps with its parent container and grow accordingly.


Field Summary
static int ALL_SIDES
           
static int BOTTOM
           
static int BOTTOM_RIGHT
           
protected  java.util.Map constraintTable
           
static int GROW_BOTH
           
static int GROW_HORIZONTAL
           
static int GROW_VERTICAL
           
static int LEFT
           
static int LEFT_BOTTOM
           
static int LEFT_BOTTOM_RIGHT
           
static int LEFT_RIGHT
           
static int NO_GROWTH
           
static int NO_STRUTS
           
static int RIGHT
           
static int TOP
           
static int TOP_BOTTOM
           
static int TOP_BOTTOM_RIGHT
           
static int TOP_LEFT
           
static int TOP_LEFT_BOTTOM
           
static int TOP_LEFT_RIGHT
           
static int TOP_RIGHT
           
 
Constructor Summary
EdgeLayout()
          Creates a new instance of SimpleLayout
 
Method Summary
 void add(java.awt.Component component, java.awt.Container parent, int x, int y, int strutBehavior)
          Add the component to the parent at the specified coordinates with the specified strut behavior.
 void add(java.awt.Component component, java.awt.Container parent, int x, int y, int strutBehavior, int growBehavior)
          Add the component to the parent at the specified coordinates with the specified strut and growth behaviors.
 void addLayoutComponent(java.lang.String name, java.awt.Component component)
          Implement LayoutManager interface
protected  void layoutComponent(java.awt.Component component, java.awt.Container parent)
          Layout the component in the parent
 void layoutContainer(java.awt.Container parent)
          Implement LayoutManager interface
 java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
          Implement LayoutManager interface
 java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
          Implement LayoutManager interface
 void removeLayoutComponent(java.awt.Component component)
          Implement LayoutManager interface
 void setConstraints(java.awt.Component component, java.awt.Dimension containerSize, int x, int y, int strutBehavior)
          Add the component to the layout at the specified coordinates with the specified strut and growth behaviors.
 void setConstraints(java.awt.Component component, java.awt.Dimension containerSize, int x, int y, int strutBehavior, int growBehavior)
          Add the component to the layout at the specified coordinates with the specified strut and growth behaviors.
 void setConstraints(java.awt.Component component, int topStrut, int leftStrut, int bottomStrut, int rightStrut, int strutBehavior)
          Add the component to the layout at the specified coordinates with the specified struts and strut and no growth.
 void setConstraints(java.awt.Component component, int topStrut, int leftStrut, int bottomStrut, int rightStrut, int strutBehavior, int growBehavior)
          Add the component to the layout at the specified coordinates with the specified struts and strut and growth behaviors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_STRUTS

public static final int NO_STRUTS
See Also:
Constant Field Values

LEFT

public static final int LEFT
See Also:
Constant Field Values

RIGHT

public static final int RIGHT
See Also:
Constant Field Values

TOP

public static final int TOP
See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
See Also:
Constant Field Values

TOP_LEFT

public static final int TOP_LEFT
See Also:
Constant Field Values

TOP_BOTTOM

public static final int TOP_BOTTOM
See Also:
Constant Field Values

TOP_RIGHT

public static final int TOP_RIGHT
See Also:
Constant Field Values

LEFT_BOTTOM

public static final int LEFT_BOTTOM
See Also:
Constant Field Values

LEFT_RIGHT

public static final int LEFT_RIGHT
See Also:
Constant Field Values

BOTTOM_RIGHT

public static final int BOTTOM_RIGHT
See Also:
Constant Field Values

TOP_LEFT_BOTTOM

public static final int TOP_LEFT_BOTTOM
See Also:
Constant Field Values

TOP_BOTTOM_RIGHT

public static final int TOP_BOTTOM_RIGHT
See Also:
Constant Field Values

LEFT_BOTTOM_RIGHT

public static final int LEFT_BOTTOM_RIGHT
See Also:
Constant Field Values

TOP_LEFT_RIGHT

public static final int TOP_LEFT_RIGHT
See Also:
Constant Field Values

ALL_SIDES

public static final int ALL_SIDES
See Also:
Constant Field Values

NO_GROWTH

public static final int NO_GROWTH
See Also:
Constant Field Values

GROW_HORIZONTAL

public static final int GROW_HORIZONTAL
See Also:
Constant Field Values

GROW_VERTICAL

public static final int GROW_VERTICAL
See Also:
Constant Field Values

GROW_BOTH

public static final int GROW_BOTH
See Also:
Constant Field Values

constraintTable

protected java.util.Map constraintTable
Constructor Detail

EdgeLayout

public EdgeLayout()
Creates a new instance of SimpleLayout

Method Detail

setConstraints

public void setConstraints(java.awt.Component component,
                           int topStrut,
                           int leftStrut,
                           int bottomStrut,
                           int rightStrut,
                           int strutBehavior,
                           int growBehavior)
Add the component to the layout at the specified coordinates with the specified struts and strut and growth behaviors.


setConstraints

public void setConstraints(java.awt.Component component,
                           int topStrut,
                           int leftStrut,
                           int bottomStrut,
                           int rightStrut,
                           int strutBehavior)
Add the component to the layout at the specified coordinates with the specified struts and strut and no growth.


setConstraints

public void setConstraints(java.awt.Component component,
                           java.awt.Dimension containerSize,
                           int x,
                           int y,
                           int strutBehavior,
                           int growBehavior)
Add the component to the layout at the specified coordinates with the specified strut and growth behaviors. The struts are calculated based on the component's preferred size and the specified container size.


setConstraints

public void setConstraints(java.awt.Component component,
                           java.awt.Dimension containerSize,
                           int x,
                           int y,
                           int strutBehavior)
Add the component to the layout at the specified coordinates with the specified strut and growth behaviors. The struts are calculated based on the component's preferred size and the specified container size.


add

public void add(java.awt.Component component,
                java.awt.Container parent,
                int x,
                int y,
                int strutBehavior,
                int growBehavior)
Add the component to the parent at the specified coordinates with the specified strut and growth behaviors. The struts are calculated based on the component's preferred size and the parent's bounds at the time this method is invoked.


add

public void add(java.awt.Component component,
                java.awt.Container parent,
                int x,
                int y,
                int strutBehavior)
Add the component to the parent at the specified coordinates with the specified strut behavior. The growth behavior is set to NO_GROWTH.


addLayoutComponent

public void addLayoutComponent(java.lang.String name,
                               java.awt.Component component)
Implement LayoutManager interface

Specified by:
addLayoutComponent in interface java.awt.LayoutManager

layoutContainer

public void layoutContainer(java.awt.Container parent)
Implement LayoutManager interface

Specified by:
layoutContainer in interface java.awt.LayoutManager

layoutComponent

protected void layoutComponent(java.awt.Component component,
                               java.awt.Container parent)
Layout the component in the parent


minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
Implement LayoutManager interface

Specified by:
minimumLayoutSize in interface java.awt.LayoutManager

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
Implement LayoutManager interface

Specified by:
preferredLayoutSize in interface java.awt.LayoutManager

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component component)
Implement LayoutManager interface

Specified by:
removeLayoutComponent in interface java.awt.LayoutManager