Class FlowLayout

java.lang.Object
com.blackrook.gui.layout.FlowLayout
All Implemented Interfaces:
GUILayout

public class FlowLayout extends Object implements GUILayout
A layout for GUIObjects that sets the position of its components inside the parent. This does not resize components.
Author:
Matthew Tropiano
  • Field Details

    • DEFAULT_GAP

      public static final float DEFAULT_GAP
      Default gap size.
      See Also:
    • hAlignment

      protected FlowLayout.HAlignment hAlignment
      Horizontal alignment type.
    • vAlignment

      protected FlowLayout.VAlignment vAlignment
      Vertical alignment type.
    • horizontalGap

      protected float horizontalGap
      Horizontal gap between objects.
    • verticalGap

      protected float verticalGap
      Vertical gap between objects.
    • sizeX

      protected float sizeX
      Current X space.
    • sizeY

      protected float sizeY
      Current Y space.
    • currentLineup

      protected List<com.blackrook.gui.layout.FlowLayout.Flow> currentLineup
      Vector of objects.
  • Constructor Details

    • FlowLayout

      public FlowLayout()
      Creates a new FlowLayout with a LEFT horizontal alignment, TOP vertical alignment, and default gaps.
    • FlowLayout

      public FlowLayout(FlowLayout.HAlignment h)
      Creates a new FlowLayout with a specific horizontal alignment, TOP vertical alignment, and default gaps.
      Parameters:
      h - the horizontal alignment of this layout.
    • FlowLayout

      public FlowLayout(FlowLayout.HAlignment h, FlowLayout.VAlignment v)
      Creates a new FlowLayout with specific alignments and default gaps.
      Parameters:
      h - the horizontal alignment of this layout.
      v - the vertical alignment of this layout.
    • FlowLayout

      public FlowLayout(FlowLayout.HAlignment h, FlowLayout.VAlignment v, float hGap)
      Creates a new FlowLayout with specific alignments and horizontal gap.
      Parameters:
      h - the horizontal alignment of this layout.
      v - the vertical alignment of this layout.
      hGap - the gap between horizontal elements.
    • FlowLayout

      public FlowLayout(FlowLayout.HAlignment h, FlowLayout.VAlignment v, float hGap, float vGap)
      Creates a new FlowLayout with specific alignments and gaps.
      Parameters:
      h - the horizontal alignment of this layout.
      v - the vertical alignment of this layout.
      hGap - the gap between horizontal elements.
      vGap - the gap between vertical elements.
  • Method Details

    • createNewLinePanel

      public static GUIObject createNewLinePanel()
      Creates a special panel that is used for deciding to create a new line in the flow layout.
      Returns:
      a new panel.
    • resizeChild

      public void resizeChild(GUIObject object, int index, int childTotal)
      Description copied from interface: GUILayout
      Called when a child object needs resizing. DO NOT RESIZE THE PARENT OBJECT IN THIS METHOD, AS IT MAY CAUSE AN INFINITE LOOP TO OCCUR.
      Specified by:
      resizeChild in interface GUILayout
      Parameters:
      object - the object to resize.
      index - the child index while traversing through the list of children.
      childTotal - the total number of children.
    • prepareLayout

      protected void prepareLayout(GUIObject parent)
    • orientChildren

      protected void orientChildren(GUIObject parent)