ProgramixGenericLib v5.0.1

com.programix.gui.layout
Class AnchorLayout

java.lang.Object
  extended by com.programix.gui.layout.AnchorLayout
All Implemented Interfaces:
LayoutManager, Serializable

public class AnchorLayout
extends Object
implements LayoutManager, Serializable

This LayoutManager lays out a single component within a container "anchoring" it as specified by the AnchorPoint.

If at the time of layout there is more than one component in the container, only the first component is used (the others are ignored). If there are not any components in the container, this layout manger quietly does nothing.

Author:
Paul Hyde
See Also:
AnchorPoint, AnchorTableLayout, FormLayout, ColumnButtonLayout, RowButtonLayout, StackLayout, Serialized Form

Field Summary
static AnchorPoint DEFAULT_ANCHOR_POINT
          The default anchor point used when the container is larger than is needed for the child component.
static int DEFAULT_BORDER_GAP
          The default number of pixels to be placed around the outside of all the child component before the edge of the container.
 
Constructor Summary
AnchorLayout()
          Creates a layout using the DEFAULT_ANCHOR_POINT and the DEFAULT_BORDER_GAP.
AnchorLayout(AnchorPoint anchorPoint)
          Creates a layout using the specified anchor.
AnchorLayout(int borderGap)
          Creates a layout using the specified border.
AnchorLayout(int borderGap, AnchorPoint anchorPoint)
          Creates a layout using the specified border size and anchor.
 
Method Summary
 void addLayoutComponent(String name, Component comp)
          Called by the graphical subsystem when a component is being added to the container.
 AnchorPoint getAnchorPoint()
          Returns the region to cluster the single child component in when the container is bigger than the table requires.
 int getBorderGap()
          Returns the number of pixels to pad the top, bottom, left, and right areas around the single child component.
 void layoutContainer(Container parent)
          Called by the graphical subsystem when the container wants to re-layout the components within it.
 Dimension minimumLayoutSize(Container parent)
          Called by the graphical subsystem when the container wants to know what to report its minimum size as.
 Dimension preferredLayoutSize(Container parent)
          Called by the graphical subsystem when the container wants to know what to report its preferred size as.
 void removeLayoutComponent(Component comp)
          Called by the graphical subsystem when a component is being removed from the container.
 void setAnchorPoint(AnchorPoint anchorPoint)
          Changes the region to cluster the table in when the container is bigger than the table requires.
 void setBorderGap(int borderGap)
          Changes the number of pixels to pad the top, bottom, left, and right areas around the single child component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ANCHOR_POINT

public static final AnchorPoint DEFAULT_ANCHOR_POINT
The default anchor point used when the container is larger than is needed for the child component. This default value is AnchorPoint.NORTH.


DEFAULT_BORDER_GAP

public static final int DEFAULT_BORDER_GAP
The default number of pixels to be placed around the outside of all the child component before the edge of the container. Used as a padding. This default value is 5.

See Also:
Constant Field Values
Constructor Detail

AnchorLayout

public AnchorLayout(int borderGap,
                    AnchorPoint anchorPoint)
Creates a layout using the specified border size and anchor.

Parameters:
borderGap - - minimum blanks space around the outside of the child component. See setBorderGap.
anchorPoint - - region to anchor the component into when there is extra space. See setAnchorPoint.

AnchorLayout

public AnchorLayout(AnchorPoint anchorPoint)
Creates a layout using the specified anchor. Uses DEFAULT_BORDER_GAP.

Parameters:
anchorPoint - - region to anchor the component into when there is extra space. See setAnchorPoint.

AnchorLayout

public AnchorLayout(int borderGap)
Creates a layout using the specified border. Uses DEFAULT_ANCHOR_POINT.

Parameters:
borderGap - - minimum blanks space around the outside of the child component. See setBorderGap.

AnchorLayout

public AnchorLayout()
Creates a layout using the DEFAULT_ANCHOR_POINT and the DEFAULT_BORDER_GAP.

Method Detail

layoutContainer

public void layoutContainer(Container parent)
Called by the graphical subsystem when the container wants to re-layout the components within it.

Specified by:
layoutContainer in interface LayoutManager

preferredLayoutSize

public Dimension preferredLayoutSize(Container parent)
Called by the graphical subsystem when the container wants to know what to report its preferred size as.

Specified by:
preferredLayoutSize in interface LayoutManager

minimumLayoutSize

public Dimension minimumLayoutSize(Container parent)
Called by the graphical subsystem when the container wants to know what to report its minimum size as. This layout manager returns its preferred size also as its minimum size.

Specified by:
minimumLayoutSize in interface LayoutManager

removeLayoutComponent

public void removeLayoutComponent(Component comp)
Called by the graphical subsystem when a component is being removed from the container. This layout manager does nothing for this request.

Specified by:
removeLayoutComponent in interface LayoutManager

addLayoutComponent

public void addLayoutComponent(String name,
                               Component comp)
Called by the graphical subsystem when a component is being added to the container. This layout manager does nothing for this request.

Specified by:
addLayoutComponent in interface LayoutManager

getBorderGap

public int getBorderGap()
Returns the number of pixels to pad the top, bottom, left, and right areas around the single child component. This eliminates the need to set an "empty border" on this container. This is the minimum space between the outermost edges of the child component and the edge of the container. The actual gap may be larger if the container has insets (and/or a Border).


setBorderGap

public void setBorderGap(int borderGap)
Changes the number of pixels to pad the top, bottom, left, and right areas around the single child component. This eliminates the need to set an "empty border" on this container. This is the minimum space between the outermost edges of the child component and the edge of the container. The actual gap may be larger if the container has insets (and/or a Border). Passed value is silently increased to 0 if a negative gap is specified.


getAnchorPoint

public AnchorPoint getAnchorPoint()
Returns the region to cluster the single child component in when the container is bigger than the table requires.


setAnchorPoint

public void setAnchorPoint(AnchorPoint anchorPoint)
Changes the region to cluster the table in when the container is bigger than the table requires. If null is passed in, the DEFAULT_ANCHOR_POINT will be used instead.


ProgramixGenericLib v5.0.1

Copyright © 2001-2009 Programix Incorporated. All rights reserved. ProgramixGenericLib is free and is OSI Certified Open Source Software under the BSD license.