Package xal.tools.apputils
Class EdgeLayout
java.lang.Object
xal.tools.apputils.EdgeLayout
- All Implemented Interfaces:
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.
- Author:
- tap
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the component to the parent at the specified coordinates with the specified strut behavior.voidAdd the component to the parent at the specified coordinates with the specified strut and growth behaviors.voidaddLayoutComponent(String name, Component component) Implement LayoutManager interfaceprotected voidlayoutComponent(Component component, Container parent) Layout the component in the parentvoidlayoutContainer(Container parent) Implement LayoutManager interfaceminimumLayoutSize(Container parent) Implement LayoutManager interfacepreferredLayoutSize(Container parent) Implement LayoutManager interfacevoidremoveLayoutComponent(Component component) Implement LayoutManager interfacevoidsetConstraints(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.voidsetConstraints(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.voidsetConstraints(Component component, 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.voidsetConstraints(Component component, 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.
-
Field Details
-
NO_STRUTS
public static final int NO_STRUTS- See Also:
-
LEFT
public static final int LEFT- See Also:
-
RIGHT
public static final int RIGHT- See Also:
-
TOP
public static final int TOP- See Also:
-
BOTTOM
public static final int BOTTOM- See Also:
-
TOP_LEFT
public static final int TOP_LEFT- See Also:
-
TOP_BOTTOM
public static final int TOP_BOTTOM- See Also:
-
TOP_RIGHT
public static final int TOP_RIGHT- See Also:
-
LEFT_BOTTOM
public static final int LEFT_BOTTOM- See Also:
-
LEFT_RIGHT
public static final int LEFT_RIGHT- See Also:
-
BOTTOM_RIGHT
public static final int BOTTOM_RIGHT- See Also:
-
TOP_LEFT_BOTTOM
public static final int TOP_LEFT_BOTTOM- See Also:
-
TOP_BOTTOM_RIGHT
public static final int TOP_BOTTOM_RIGHT- See Also:
-
LEFT_BOTTOM_RIGHT
public static final int LEFT_BOTTOM_RIGHT- See Also:
-
TOP_LEFT_RIGHT
public static final int TOP_LEFT_RIGHT- See Also:
-
ALL_SIDES
public static final int ALL_SIDES- See Also:
-
NO_GROWTH
public static final int NO_GROWTH- See Also:
-
GROW_HORIZONTAL
public static final int GROW_HORIZONTAL- See Also:
-
GROW_VERTICAL
public static final int GROW_VERTICAL- See Also:
-
GROW_BOTH
public static final int GROW_BOTH- See Also:
-
constraintTable
-
-
Constructor Details
-
EdgeLayout
public EdgeLayout()Creates a new instance of SimpleLayout
-
-
Method Details
-
setConstraints
public void setConstraints(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(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(Component component, 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(Component component, 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(Component component, 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
Add the component to the parent at the specified coordinates with the specified strut behavior. The growth behavior is set to NO_GROWTH. -
addLayoutComponent
Implement LayoutManager interface- Specified by:
addLayoutComponentin interfaceLayoutManager
-
layoutContainer
Implement LayoutManager interface- Specified by:
layoutContainerin interfaceLayoutManager
-
layoutComponent
Layout the component in the parent -
minimumLayoutSize
Implement LayoutManager interface- Specified by:
minimumLayoutSizein interfaceLayoutManager
-
preferredLayoutSize
Implement LayoutManager interface- Specified by:
preferredLayoutSizein interfaceLayoutManager
-
removeLayoutComponent
Implement LayoutManager interface- Specified by:
removeLayoutComponentin interfaceLayoutManager
-