Class FrameLayout

java.lang.Object
xyz.gmitch215.socketmc.screen.layout.AbstractLayout
xyz.gmitch215.socketmc.screen.layout.FrameLayout
All Implemented Interfaces:
Serializable, Layout, LayoutElement

public final class FrameLayout extends AbstractLayout
Represents a layout with multiple children, rendered in a frame-like layout.
See Also:
  • Constructor Details

    • FrameLayout

      public FrameLayout()
      Creates a new FrameLayout at the origin with no size.
    • FrameLayout

      public FrameLayout(@NotNull @NotNull ElementBounds bounds)
      Creates a new FrameLayout with the given bounds.
      Parameters:
      bounds - The bounds of the layout.
    • FrameLayout

      public FrameLayout(int width, int height)
      Creates a new FrameLayout at the origin with the given size.
      Parameters:
      width - The width of the layout.
      height - The height of the layout.
    • FrameLayout

      public FrameLayout(int x, int y, int width, int height)
      Creates a new FrameLayout with the given position and size.
      Parameters:
      x - The x position of the layout.
      y - The y position of the layout.
      width - The width of the layout.
      height - The height of the layout.
  • Method Details

    • getChildren

      @NotNull public @NotNull List<ChildContainer> getChildren()
      Gets an immutable copy of all the children in this layout.
      Returns:
      All FrameLayout Children
    • getMinWidth

      public int getMinWidth()
      Gets the minimum width of the layout.
      Returns:
      The minimum width of the layout.
    • setMinWidth

      @NotNull public @NotNull FrameLayout setMinWidth(int minWidth) throws IllegalArgumentException
      Sets the minimum width of the layout.
      Parameters:
      minWidth - The minimum width of the layout.
      Returns:
      this class, for chaining
      Throws:
      IllegalArgumentException - if the minimum width is negative
    • getMinHeight

      public int getMinHeight()
      Gets the minimum height of the layout.
      Returns:
      The minimum height of the layout.
    • setMinHeight

      @NotNull public @NotNull FrameLayout setMinHeight(int minHeight) throws IllegalArgumentException
      Sets the minimum height of the layout.
      Parameters:
      minHeight - The minimum height of the layout.
      Returns:
      this class, for chaining
      Throws:
      IllegalArgumentException - if the minimum height is negative
    • setMinSize

      @NotNull public @NotNull FrameLayout setMinSize(int minWidth, int minHeight) throws IllegalArgumentException
      Sets the minimum size of the layout.
      Parameters:
      minWidth - The minimum width of the layout.
      minHeight - The minimum height of the layout.
      Returns:
      this class, for chaining
      Throws:
      IllegalArgumentException - if the minimum width or height is negative
    • addElement

      public <T extends LayoutElement> T addElement(@NotNull T element, @NotNull @NotNull LayoutSettings settings) throws IllegalArgumentException
      Description copied from interface: Layout
      Adds an element to this layout.
      Type Parameters:
      T - the type of the element
      Parameters:
      element - the element to add
      settings - the settings for the element
      Returns:
      the added element
      Throws:
      IllegalArgumentException - if the element or settings are null
    • createDefaultSettings

      @NotNull public @NotNull LayoutSettings createDefaultSettings()
      Description copied from interface: Layout
      Generates the default layout settings for this layout.
      Returns:
      Default Layout Settings
    • visitChildren

      public void visitChildren(@NotNull @NotNull Consumer<LayoutElement> visitor)
      Description copied from interface: Layout
      Visits this layout and all of its children.
      Parameters:
      visitor - Element Visitor
    • arrangeElements

      public void arrangeElements()
      Description copied from interface: Layout
      Arranges the elements inside this Layout.