org.crosswire.common.swing

## Class AbstractLayout

- java.lang.Object
- - org.crosswire.common.swing.AbstractLayout

- All Implemented Interfaces:
    LayoutManager, LayoutManager2, Serializable

      public abstract class AbstractLayout
      extends Object
      implements LayoutManager2, Serializable

  AbstractLayout - support for DeckLayout.
  Author:
    Joe Walker, Claude Duguay (Idea in JDJ article)
  See Also:
    `The GNU General Public License for details.`, Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `hgap` horizontal gap
    `private static long` | `serialVersionUID` Serialization ID
    `protected int` | `vgap` vertical gap

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractLayout()` Defaults the horizontal and vertical gaps to 0
    `protected` | `AbstractLayout(int hgap, int vgap)` Constructor that specifies the horizontal and vertical gaps

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addLayoutComponent(Component comp, Object constraints)` Add the specified component from the layout.
    `void` | `addLayoutComponent(String name, Component comp)` Adds the specified component with the specified name to the layout.
    `int` | `getHgap()` Get the horizontal gap between components.
    `float` | `getLayoutAlignmentX(Container parent)` Returns the alignment along the x axis.
    `float` | `getLayoutAlignmentY(Container parent)` Returns the alignment along the y axis.
    `int` | `getVgap()` Get the vertical gap between components.
    `void` | `invalidateLayout(Container target)` Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
    `Dimension` | `maximumLayoutSize(Container target)` Returns the maximum dimensions for this layout given the component in the specified target container.
    `void` | `removeLayoutComponent(Component comp)` Removes the specified component from the layout.
    `void` | `setHgap(int gap)` Set the horizontal gap between components.
    `void` | `setVgap(int gap)` Set the vertical gap between components.
    `String` | `toString()` Return a string representation of the layout manager

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

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

    - ### Methods inherited from interface java.awt.LayoutManager

      `layoutContainer, minimumLayoutSize, preferredLayoutSize`

- - ### Field Detail

    - #### hgap

          protected int hgap

      horizontal gap

    - #### vgap

          protected int vgap

      vertical gap

    - #### serialVersionUID

          private static final long serialVersionUID

      Serialization ID
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### AbstractLayout

          protected AbstractLayout()

      Defaults the horizontal and vertical gaps to 0

    - #### AbstractLayout

          protected AbstractLayout(int hgap,
                        int vgap)

      Constructor that specifies the horizontal and vertical gaps

  - ### Method Detail

    - #### getHgap

          public final int getHgap()

      Get the horizontal gap between components.

    - #### getVgap

          public final int getVgap()

      Get the vertical gap between components.

    - #### setHgap

          public final void setHgap(int gap)

      Set the horizontal gap between components.
      Parameters:
        `gap` - The horizontal gap to be set

    - #### setVgap

          public final void setVgap(int gap)

      Set the vertical gap between components.
      Parameters:
        `gap` - The vertical gap to be set

    - #### maximumLayoutSize

          public Dimension maximumLayoutSize(Container target)

      Returns the maximum dimensions for this layout given the component in the specified target container.
      Specified by:
        `maximumLayoutSize` in interface `LayoutManager2`
      Parameters:
        `target` - The component which needs to be laid out

    - #### getLayoutAlignmentX

          public float getLayoutAlignmentX(Container parent)

      Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.
      Specified by:
        `getLayoutAlignmentX` in interface `LayoutManager2`

    - #### getLayoutAlignmentY

          public float getLayoutAlignmentY(Container parent)

      Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.
      Specified by:
        `getLayoutAlignmentY` in interface `LayoutManager2`

    - #### invalidateLayout

          public void invalidateLayout(Container target)

      Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
      Specified by:
        `invalidateLayout` in interface `LayoutManager2`

    - #### addLayoutComponent

          public void addLayoutComponent(String name,
                                Component comp)

      Adds the specified component with the specified name to the layout. By default, we call the more recent addLayoutComponent method with an object constraint argument. The name is passed through directly.
      Specified by:
        `addLayoutComponent` in interface `LayoutManager`
      Parameters:
        `name` - The name of the component
        `comp` - The component to be added

    - #### addLayoutComponent

          public void addLayoutComponent(Component comp,
                                Object constraints)

      Add the specified component from the layout. By default, we let the Container handle this directly.
      Specified by:
        `addLayoutComponent` in interface `LayoutManager2`
      Parameters:
        `comp` - The component to be added
        `constraints` - The constraints to apply when laying out.

    - #### removeLayoutComponent

          public void removeLayoutComponent(Component comp)

      Removes the specified component from the layout. By default, we let the Container handle this directly.
      Specified by:
        `removeLayoutComponent` in interface `LayoutManager`
      Parameters:
        `comp` - the component to be removed

    - #### toString

          public String toString()

      Return a string representation of the layout manager
      Overrides:
        `toString` in class `Object`