Package com.smartgwt.client.types

# Enum LayoutPolicy

java.lang.Object
java.lang.Enum<LayoutPolicy>
com.smartgwt.client.types.LayoutPolicy

All Implemented Interfaces:
  `ValueEnum`, `Serializable`, `Comparable<LayoutPolicy>`, `Constable`

public enum LayoutPolicy extends Enum<LayoutPolicy> implements ValueEnum
Policy controlling how the Layout will manage member sizes on this axis.

Note that, by default, Layouts do not automatically expand the size of all members to match a member that overflows the layout on the breadth axis. This means that a `DynamicForm` or other component that can't shrink beyond a minimum width will "stick out" of the Layout, wider than any other member and wider than automatically generated components like resizeBars or sectionHeaders (in a `SectionStack`).

This is by design: matching the size of overflowing members would cause expensive redraws of all members in the Layout, and with two or more members potentially overflowing, could turn minor browser size reporting bugs or minor glitches in custom components into infinite resizing loops.

If you run into this situation, you can either:

- set the overflowing member to `overflow`: "auto", so that it scrolls if it needs more space
- set the Layout as a whole to `overflow`:"auto", so that the whole Layout scrolls when the member overflows
- define a `resized()` handler to manually update the breadth of the layout
- set `Layout.minBreadthMember` to ensure that the available breadth used to expand all (other) members is artificially increased to match the current breadth of the `minBreadthMember` member; the layout will still be overflowed in this case and the reported size from `Canvas.getWidth()` or `Canvas.getHeight()` won't change, but all members should fill the visible width or height along the breadth axis

For the last approach, given the VLayout `myLayout` and a member `myWideMember`, then we could define the following `resized()` handler on `myLayout`:

      myLayout.addResizedHandler(new ResizedHandler() {
          @Override
          public void onResized(ResizedEvent event) {
              int memberWidth = myWideMember.getVisibleWidth();
              myLayout.setWidth(Math.max(myLayout.getWidth(), memberWidth + offset));
      }

where `offset` reflects the difference in width (due to margins, padding, etc.) between the layout and its widest member. In most cases, a fixed offset can be used, but it can also be computed via the calculation:

          myLayout.getWidth() - myLayout.getViewportWidth()

by adding a `draw handler` for `myLayout`. (That calculation is not always valid inside the `resized()` handler itself.)

Note: the HLayout case is similar- just substitute height where width appears above.

See also `Layout.overflow`.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class java.lang.Enum

  `Enum.EnumDesc<E extends Enum<E>>`

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `FILL`
  Layout sizes members so that they fill the specified size of the layout.
  `NONE`
  Layout does not try to size members on the axis at all, merely stacking them (length axis) and leaving them at default breadth.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getValue()`
  `static LayoutPolicy`
  `valueOf(String name)`
  Returns the enum constant of this type with the specified name.
  `static LayoutPolicy[]`
  `values()`
  Returns an array containing the constants of this enum type, in the order they are declared.

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

  `clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

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

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### NONE

    public static final LayoutPolicy NONE
    Layout does not try to size members on the axis at all, merely stacking them (length axis) and leaving them at default breadth.

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "none".

  - ### FILL

    public static final LayoutPolicy FILL
    Layout sizes members so that they fill the specified size of the layout. The rules are:
    - Any component given an initial pixel size, programmatically resized to a specific pixel size, or drag resized by user action is left at that exact size
    - Any component that `autofits` is given exactly the space it needs, never forced to take up more.
    - All other components split the remaining space equally, or according to their relative percentages.
    - Any component that declares a `Canvas.minWidth` or `Canvas.minHeight` will never be sized smaller than that size
    - Any component that declares a `Canvas.maxWidth` or `Canvas.maxHeight` will never be sized larger than that size
    In addition, components may declare that they have `adaptive sizing`, and may coordinate with the Layout to render at different sizes according to the amount of available space.

    If this enumerated value is used in a `Component XML` file or server-side DataSource descriptor (.ds.xml file), use the value "fill".

- ## Method Details

  - ### values

    public static LayoutPolicy[] values()
    Returns an array containing the constants of this enum type, in the order they are declared.
    Returns:
      an array containing the constants of this enum type, in the order they are declared

  - ### valueOf

    public static LayoutPolicy valueOf(String name)
    Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
    Parameters:
      `name` - the name of the enum constant to be returned.
    Returns:
      the enum constant with the specified name
    Throws:
      `IllegalArgumentException` - if this enum type has no constant with the specified name
      `NullPointerException` - if the argument is null

  - ### getValue

    public String getValue()
    Specified by:
      `getValue` in interface `ValueEnum`