Class EqualSpacingLayout

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

public final class EqualSpacingLayout extends AbstractLayout
Represents a layout with equal spacing.
See Also:
  • Constructor Details

    • EqualSpacingLayout

      public EqualSpacingLayout(@NotNull @NotNull ElementBounds bounds, @NotNull @NotNull EqualSpacingLayout.Orientation orientation)
      Creates a new equal spacing layout with the given bounds and orientation.
      Parameters:
      bounds - The bounds of the layout
      orientation - The orientation of the layout
    • EqualSpacingLayout

      public EqualSpacingLayout(int width, int height, @NotNull @NotNull EqualSpacingLayout.Orientation orientation)
      Creates a new equal spacing layout with the given width, height, and orientation.
      Parameters:
      width - The width of the layout
      height - The height of the layout
      orientation - The orientation of the layout
    • EqualSpacingLayout

      public EqualSpacingLayout(int x, int y, int width, int height, @NotNull @NotNull EqualSpacingLayout.Orientation orientation)
      Creates a new equal spacing layout with the given x, y, width, height, and orientation.
      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
      orientation - The orientation of the layout
  • Method Details

    • 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.