PIRL.Viewers

## Class Draggable_Rows.Draggable_Rows_Layout

- java.lang.Object
- - PIRL.Viewers.Draggable_Rows.Draggable_Rows_Layout

All Implemented Interfaces:
  LayoutManager, LayoutManager2

Enclosing class:
  Draggable_Rows

    public class Draggable_Rows.Draggable_Rows_Layout
    extends Object
    implements LayoutManager2

Draggable_Rows_Layout is a LayoutManager for a vertical stack of row Components.

See Also:
  `LayoutManager2`

### Field Summary

Fields
`protected static int` `MAXIMUM_DIMENSION` Convenience constants for specifying which `layout size` dimensions to calculate.
`protected static int` `MINIMUM_DIMENSION` Convenience constants for specifying which `layout size` dimensions to calculate.
`protected static int` `PREFERRED_DIMENSION` Convenience constants for specifying which `layout size` dimensions to calculate.

### Method Summary

Methods
`void` `addLayoutComponent(Component component, Object constraints)`
`void` `addLayoutComponent(String name, Component component)`
`float` `getLayoutAlignmentX(Container container)` Gets the horizontal alignment factor for the layout.
`float` `getLayoutAlignmentY(Container container)` Gets the vertical alignment factor for the layout.
`void` `invalidateLayout(Container container)` The layout constraints for the container are invalidated.
`protected Dimension` `Layout_Size(Container container, int which_dimension)` Gets the dimensions for a container suitable for laying out the components it contains.
`void` `layoutContainer(Container container)` Layout the container components as stacked rows.
`Dimension` `maximumLayoutSize(Container container)` Gets the maximum layout dimensions for the container.
`Dimension` `minimumLayoutSize(Container container)` Gets the minumum layout dimensions for the container.
`Dimension` `preferredLayoutSize(Container container)` Gets the preferred layout dimensions for the container.
`void` `removeLayoutComponent(Component component)`
`Draggable_Rows.Draggable_Rows_Layout` `setLayoutAlignmentX(float alignment)` Sets the horizontal row alignment factor.
`protected void` `Update_Sizes(Container container)` Calculates a container layout size.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### MINIMUM_DIMENSION

    protected static final int MINIMUM_DIMENSION

Convenience constants for specifying which `layout size` dimensions to calculate.

See Also:
  Constant Field Values

#### PREFERRED_DIMENSION

    protected static final int PREFERRED_DIMENSION

Convenience constants for specifying which `layout size` dimensions to calculate.

See Also:
  Constant Field Values

#### MAXIMUM_DIMENSION

    protected static final int MAXIMUM_DIMENSION

Convenience constants for specifying which `layout size` dimensions to calculate.

See Also:
  Constant Field Values

### Method Detail

#### setLayoutAlignmentX

    public Draggable_Rows.Draggable_Rows_Layout setLayoutAlignmentX(float alignment)

Sets the horizontal row alignment factor.

An alignment of 0.0 aligns the rows against their left sides; 1.0 aligns against the rights sides; 0.5 aligns rows along their centers; etc.

The initial, default, alignment factor is 0.0.

Parameters:
  `alignment` - The horizontal alignment factor.
Returns:
  This Draggable_Rows_Layout.

#### Update_Sizes

    protected void Update_Sizes(Container container)

Calculates a container layout size.

If the container is empty or its size requirements have not been `invalidated` since they were last set, then nothing is done.

A set of width and height `SizeRequirements` is maintained for each component and for the entire container. The components' minimum, preferred and maximum sizes are used; the `horizontal alignment factor` is applied. Components that are not visible have no affect on the layout.

The container's width size requirements are based on the `aligned size requirements` of the components; the height size requirements are based on the `tiled size requirements` of the components.

Parameters:
  `container` - The container associated with this layout manager.

#### Layout_Size

    protected Dimension Layout_Size(Container container,
                        int which_dimension)

Gets the dimensions for a container suitable for laying out the components it contains.

The container, if it is not empty, has the preferred, minimum or maximum size, depending on which dimension is specified, of each component it contains examined. The container width is the maximum value of the component widths, or the `Draggable_Rows.EMPTY_WIDTH` if there are no components, plus the left and right insets amount. The container height is the sum of the heights of all visible components, or zero if there are no components, plus the top and bottom insets amount.

Parameters:
  `container` - The container associated with this layout manager.
  `which_dimension` - If the `MINIMUM_DIMENSION`, the minimum sizes will be calculated; if the `PREFERRED_DIMENSION`, the preferred size is determined; if the `MAXIMUM_DIMENSION` the maximum size.
Returns:
  The requested Dimension for the container.
See Also:
  `Update_Sizes(Container)`, `minimumLayoutSize(Container)`, `preferredLayoutSize(Container)`, `maximumLayoutSize(Container)`

#### layoutContainer

    public void layoutContainer(Container container)

Layout the container components as stacked rows.

All components of the container are distributed in top-to-bottom order as they occur in the container's component list. The SizeRequirements for the components are first `updated`. The the bounds of each component are then determined using horizontally alignment into a single column and vertical top-to-bottom distribution into continguous rows.

Specified by:
  `layoutContainer` in interface `LayoutManager`
Parameters:
  `container` - The container associated with this layout manager.

#### minimumLayoutSize

    public Dimension minimumLayoutSize(Container container)

Gets the minumum layout dimensions for the container.

Specified by:
  `minimumLayoutSize` in interface `LayoutManager`
Parameters:
  `container` - The container associated with this layout manager.
Returns:
  The requested Dimension for the container.
See Also:
  `Layout_Size(Container, int)`

#### preferredLayoutSize

    public Dimension preferredLayoutSize(Container container)

Gets the preferred layout dimensions for the container.

Specified by:
  `preferredLayoutSize` in interface `LayoutManager`
Parameters:
  `container` - The container associated with this layout manager.
Returns:
  The requested Dimension for the container.
See Also:
  `Layout_Size(Container, int)`

#### addLayoutComponent

    public void addLayoutComponent(String name,
                          Component component)

Specified by:
  `addLayoutComponent` in interface `LayoutManager`

#### removeLayoutComponent

    public void removeLayoutComponent(Component component)

Specified by:
  `removeLayoutComponent` in interface `LayoutManager`

#### maximumLayoutSize

    public Dimension maximumLayoutSize(Container container)

Gets the maximum layout dimensions for the container.

Specified by:
  `maximumLayoutSize` in interface `LayoutManager2`
Parameters:
  `container` - The container associated with this layout manager.
Returns:
  The requested Dimension for the container.
See Also:
  `Layout_Size(Container, int)`

#### getLayoutAlignmentX

    public float getLayoutAlignmentX(Container container)

Gets the horizontal alignment factor for the layout.

Specified by:
  `getLayoutAlignmentX` in interface `LayoutManager2`
Parameters:
  `container` - The container associated with this layout manager.
Returns:
  The horizontal alignment factor.
See Also:
  `setLayoutAlignmentX(float)`

#### getLayoutAlignmentY

    public float getLayoutAlignmentY(Container container)

Gets the vertical alignment factor for the layout.

Specified by:
  `getLayoutAlignmentY` in interface `LayoutManager2`
Parameters:
  `container` - The container associated with this layout manager.
Returns:
  The horizontal alignment factor which is always 0.0.

#### addLayoutComponent

    public void addLayoutComponent(Component component,
                          Object constraints)

Specified by:
  `addLayoutComponent` in interface `LayoutManager2`

#### invalidateLayout

    public void invalidateLayout(Container container)

The layout constraints for the container are invalidated.

The next time a `layout` is to occur the layout constraints will be `updated`.

This method is called by AWT when the invalidate method is called on the Container. Since the invalidate method may be called asynchronously to the event thread, this method may be called asynchronously.

Specified by:
  `invalidateLayout` in interface `LayoutManager2`
Parameters:
  `container` - The affected container.