com.orsoncharts.table

## Class VerticalFlowElement

- java.lang.Object
- - com.orsoncharts.table.AbstractTableElement
  - - com.orsoncharts.table.VerticalFlowElement

- All Implemented Interfaces:
    ContainerElement, TableElement, java.io.Serializable

      public class VerticalFlowElement
      extends AbstractTableElement
      implements ContainerElement, java.io.Serializable

  A table element that displays a list of sub-elements in a vertical flow layout.
  NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
  Since:
    1.1
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from interface com.orsoncharts.table.TableElement

      `CLASS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `VerticalFlowElement()` Creates a new instance (equivalent to `new VerticalFlowElement(VAlign.MIDDLE, 2)`).
    `VerticalFlowElement(VAlign alignment, int vgap)` Creates a new instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addElement(TableElement element)` Adds a sub-element to the list.
    `void` | `draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D bounds)` Draws the element and all of its subelements within the specified bounds.
    `void` | `draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D bounds, TableElementOnDraw onDrawHandler)` Draws the element within the specified bounds.
    `boolean` | `equals(java.lang.Object obj)` Tests this element for equality with an arbitrary object.
    `java.util.List<TableElement>` | `getElements()` Returns a (new) list containing the elements in this flow layout.
    `VAlign` | `getVerticalAlignment()` Returns the vertical alignment for the elements.
    `int` | `getVGap()` Returns the vertical gap between elements, in Java2D units.
    `java.util.List<java.awt.geom.Rectangle2D>` | `layoutElements(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D bounds, java.util.Map<java.lang.String,java.lang.Object> constraints)` Performs a layout of this table element, returning a list of bounding rectangles for the element and its subelements.
    `java.awt.geom.Dimension2D` | `preferredSize(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D bounds, java.util.Map<java.lang.String,java.lang.Object> constraints)` Returns the preferred size for the element.
    `void` | `receive(TableElementVisitor visitor)` Receives a `TableElementVisitor` (the visitor will be received by all the elements in the flow).
    `void` | `setVerticalAlignment(VAlign alignment)` Sets the vertical alignment of elements within columns,
    `void` | `setVGap(int vgap)` Sets the vertical gap between elements.

    - ### Methods inherited from class com.orsoncharts.table.AbstractTableElement

      `getBackground, getInsets, getProperty, getRefPoint, getTag, preferredSize, setBackground, setBackgroundColor, setInsets, setProperty, setRefPoint, setTag`

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

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

    - ### Methods inherited from interface com.orsoncharts.table.TableElement

      `getProperty, getRefPoint, preferredSize, setProperty`

- - ### Constructor Detail

    - #### VerticalFlowElement

          public VerticalFlowElement()

      Creates a new instance (equivalent to `new VerticalFlowElement(VAlign.MIDDLE, 2)`).

    - #### VerticalFlowElement

          public VerticalFlowElement(VAlign alignment,
                                     int vgap)

      Creates a new instance.
      Parameters:
        `alignment` - the vertical alignment of columns (`null` not permitted).
        `vgap` - the gap between elements.

  - ### Method Detail

    - #### getVerticalAlignment

          public VAlign getVerticalAlignment()

      Returns the vertical alignment for the elements.
      Returns:
        The vertical alignment (never `null`).

    - #### setVerticalAlignment

          public void setVerticalAlignment(VAlign alignment)

      Sets the vertical alignment of elements within columns,
      Parameters:
        `alignment` - the alignment (`null` not permitted).

    - #### getVGap

          public int getVGap()

      Returns the vertical gap between elements, in Java2D units.
      Returns:
        The vertical gap.

    - #### setVGap

          public void setVGap(int vgap)

      Sets the vertical gap between elements.
      Parameters:
        `vgap` - the gap (in Java2D units).

    - #### getElements

          public java.util.List<TableElement> getElements()

      Returns a (new) list containing the elements in this flow layout.
      Returns:
        A list containing the elements (possibly empty, but never `null`).

    - #### addElement

          public void addElement(TableElement element)

      Adds a sub-element to the list.
      Specified by:
        `addElement` in interface `ContainerElement`
      Parameters:
        `element` - the element (`null` not permitted).

    - #### receive

          public void receive(TableElementVisitor visitor)

      Receives a `TableElementVisitor` (the visitor will be received by all the elements in the flow).
      Specified by:
        `receive` in interface `TableElement`
      Parameters:
        `visitor` - the visitor (`null` not permitted).
      Since:
        1.2

    - #### preferredSize

          public java.awt.geom.Dimension2D preferredSize(java.awt.Graphics2D g2,
                                                         java.awt.geom.Rectangle2D bounds,
                                                         java.util.Map<java.lang.String,java.lang.Object> constraints)

      Returns the preferred size for the element.
      Specified by:
        `preferredSize` in interface `TableElement`
      Specified by:
        `preferredSize` in class `AbstractTableElement`
      Parameters:
        `g2` - the graphics target (`null` not permitted).
        `bounds` - the bounds (`null` not permitted).
        `constraints` - the layout constraints (ignored here).
      Returns:
        The preferred size (never `null`).

    - #### layoutElements

          public java.util.List<java.awt.geom.Rectangle2D> layoutElements(java.awt.Graphics2D g2,
                                                                          java.awt.geom.Rectangle2D bounds,
                                                                          java.util.Map<java.lang.String,java.lang.Object> constraints)

      Description copied from interface: `TableElement`
      Performs a layout of this table element, returning a list of bounding rectangles for the element and its subelements. This method is typically called by the `TableElement.draw(java.awt.Graphics2D, java.awt.geom.Rectangle2D)` method.
      Specified by:
        `layoutElements` in interface `TableElement`
      Parameters:
        `g2` - the graphics target (`null` not permitted).
        `bounds` - the bounds (`null` not permitted).
        `constraints` - the constraints (if any).
      Returns:
        A list of bounding rectangles.

    - #### draw

          public void draw(java.awt.Graphics2D g2,
                           java.awt.geom.Rectangle2D bounds)

      Draws the element and all of its subelements within the specified bounds.
      Specified by:
        `draw` in interface `TableElement`
      Parameters:
        `g2` - the graphics target (`null` not permitted).
        `bounds` - the bounds (`null` not permitted).

    - #### draw

          public void draw(java.awt.Graphics2D g2,
                           java.awt.geom.Rectangle2D bounds,
                           TableElementOnDraw onDrawHandler)

      Draws the element within the specified bounds. If the `recordBounds` flag is set, this element and each of its children will have its `BOUNDS_2D` property updated with the current bounds.
      Specified by:
        `draw` in interface `TableElement`
      Parameters:
        `g2` - the graphics target (`null` not permitted).
        `bounds` - the bounds (`null` not permitted).
        `onDrawHandler` - record the bounds?
      Since:
        1.3

    - #### equals

          public boolean equals(java.lang.Object obj)

      Tests this element for equality with an arbitrary object.
      Overrides:
        `equals` in class `AbstractTableElement`
      Parameters:
        `obj` - the object (`null` permitted).
      Returns:
        A boolean.