Class AbsoluteLayout

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

public class AbsoluteLayout extends Layout
A layout that positions elements at absolute coordinates (at either their preferred size or at a manually specified size). Constraints are specified like so:

 Group group = new Group(new AbsoluteLayout()).add(
     AbsoluteLayout.at(new Label("+50+50"), 50, 50),
     AbsoluteLayout.at(new Button("100x50+25+25"), 25, 25, 100, 50)
 );
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    Defines absolute layout constraints.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends Element<?>>
    T
    at(T elem, float x, float y)
    Positions elem at the specified position, in its preferred size.
    static <T extends Element<?>>
    T
    at(T elem, float x, float y, float width, float height)
    Constrains elem to the specified position and size.
    static <T extends Element<?>>
    T
    at(T elem, float x, float y, float width, float height, Style.HAlign halign, Style.VAlign valign)
    Constrains elem to the specified size and aligns it relative to the given position using the given alignments.
    static <T extends Element<?>>
    T
    at(T elem, float x, float y, Style.HAlign halign, Style.VAlign valign)
    Positions elem relative to the given position using the given alignments.
    static <T extends Element<?>>
    T
    at(T elem, pythagoras.f.IPoint position)
    Positions elem at the specified position, in its preferred size.
    static <T extends Element<?>>
    T
    at(T elem, pythagoras.f.IPoint position, pythagoras.f.IDimension size)
    Constrains elem to the specified position and size.
    static <T extends Element<?>>
    T
    at(T elem, pythagoras.f.IPoint position, pythagoras.f.IDimension size, Style.HAlign halign, Style.VAlign valign)
    Constrains elem to the specified size and aligns it relative to the given position using the given alignments.
    static <T extends Element<?>>
    T
    at(T elem, pythagoras.f.IPoint position, Style.HAlign halign, Style.VAlign valign)
    Positions elem relative to the given position using the given alignments.
    static <T extends Element<?>>
    T
    centerAt(T elem, float x, float y)
    Centers elem on the specified position, in its preferred size.
    static <T extends Element<?>>
    T
    centerAt(T elem, pythagoras.f.IPoint position)
    Centers elem on the specified position, in its preferred size.
    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.
    void
    layout(Container<?> elems, float left, float top, float width, float height)
    Lays out the supplied elements into a region of the specified dimensions.
    Creates a constraint to position an element uniformly.

    Methods inherited from class java.lang.Object

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

    • AbsoluteLayout

      public AbsoluteLayout()
  • Method Details

    • uniform

      public static AbsoluteLayout.Constraint uniform(BoxPoint where)
      Creates a constraint to position an element uniformly. The given box point is used for both the position and the origin. For example, if BoxPoint.BR is used, then the element will be positioned such that its bottom right corner is over the bottom right corner of the group.
    • at

      public static <T extends Element<?>> T at(T elem, float x, float y)
      Positions elem at the specified position, in its preferred size.
    • at

      public static <T extends Element<?>> T at(T elem, pythagoras.f.IPoint position)
      Positions elem at the specified position, in its preferred size.
    • at

      public static <T extends Element<?>> T at(T elem, float x, float y, float width, float height)
      Constrains elem to the specified position and size.
    • at

      public static <T extends Element<?>> T at(T elem, pythagoras.f.IPoint position, pythagoras.f.IDimension size)
      Constrains elem to the specified position and size.
    • at

      public static <T extends Element<?>> T at(T elem, float x, float y, Style.HAlign halign, Style.VAlign valign)
      Positions elem relative to the given position using the given alignments.
    • at

      public static <T extends Element<?>> T at(T elem, pythagoras.f.IPoint position, Style.HAlign halign, Style.VAlign valign)
      Positions elem relative to the given position using the given alignments.
    • at

      public static <T extends Element<?>> T at(T elem, float x, float y, float width, float height, Style.HAlign halign, Style.VAlign valign)
      Constrains elem to the specified size and aligns it relative to the given position using the given alignments.
    • at

      public static <T extends Element<?>> T at(T elem, pythagoras.f.IPoint position, pythagoras.f.IDimension size, Style.HAlign halign, Style.VAlign valign)
      Constrains elem to the specified size and aligns it relative to the given position using the given alignments.
    • centerAt

      public static <T extends Element<?>> T centerAt(T elem, float x, float y)
      Centers elem on the specified position, in its preferred size.
    • centerAt

      public static <T extends Element<?>> T centerAt(T elem, pythagoras.f.IPoint position)
      Centers elem on the specified position, in its preferred size.
    • 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