Class FlowLayout

java.lang.Object
tripleplay.ui.Layout
tripleplay.ui.layout.FlowLayout

public class FlowLayout extends Layout
Lays out elements in horizontal rows, starting a new row when a width limit is reached. By default, the hint width is used as the limit; this can be overridden with a fixed value.

TODO: vertical

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
     

    Nested classes/interfaces inherited from class tripleplay.ui.Layout

    Layout.Constraint
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final float
    The default gap between rows and elements in a row.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Sets the alignment used for positioning elements within their row.
    pythagoras.f.Dimension
    computeSize(Container<?> elems, float hintX, float hintY)
    Computes and returns the size needed to arrange children of the supplied container according to their preferred size, given the specified x and y size hints.
    gaps(float gap)
    Sets the gap, in pixels, to use between rows and between elements within a row.
    gaps(float hgap, float vgap)
    Sets the gap, in pixels, to use between rows and between elements within a row.
    void
    layout(Container<?> elems, float left, float top, float width, float height)
    Lays out the supplied elements into a region of the specified dimensions.
    Stretch elements vertically to the maximum height of other elements in the same row.
    wrapAt(float width)
    Sets the maximum width of a row of elements.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_GAP

      public static final float DEFAULT_GAP
      The default gap between rows and elements in a row.
      See Also:
  • Constructor Details

    • FlowLayout

      public FlowLayout()
  • Method Details

    • wrapAt

      public FlowLayout wrapAt(float width)
      Sets the maximum width of a row of elements. This should normally be used whenever a flow layout governs Elements that have horizontal siblings. By default, the hint width is used.
    • gaps

      public FlowLayout gaps(float gap)
      Sets the gap, in pixels, to use between rows and between elements within a row.
    • gaps

      public FlowLayout gaps(float hgap, float vgap)
      Sets the gap, in pixels, to use between rows and between elements within a row.
      Parameters:
      hgap - the gap to use between elements in a row
      vgap - the gap to use between rows
    • align

      public FlowLayout align(Style.VAlign align)
      Sets the alignment used for positioning elements within their row. By default, elements are not stretched and centered vertically: Style.VAlign.CENTER.
    • stretch

      public FlowLayout stretch()
      Stretch elements vertically to the maximum height of other elements in the same row. This clears any previously set vertical alignment.
    • computeSize

      public pythagoras.f.Dimension computeSize(Container<?> elems, float hintX, float hintY)
      Description copied from class: Layout
      Computes and returns the size needed to arrange children of the supplied container according to their preferred size, given the specified x and y size hints.
      Specified by:
      computeSize in class Layout
    • layout

      public void layout(Container<?> elems, float left, float top, float width, float height)
      Description copied from class: Layout
      Lays out the supplied elements into a region of the specified dimensions.
      Specified by:
      layout in class Layout