Class LinearLayout

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

public final class LinearLayout extends Object implements Layout
Represents a layout in a straight line, internally wrapped around a GridLayout.
See Also:
  • Constructor Details

  • Method Details

    • spacing

      @NotNull public @NotNull LinearLayout spacing(int spacing)
      Sets the spacing for this layout.
      Parameters:
      spacing - The spacing to set
      Returns:
      this class, for chaining
    • isFullscreen

      public boolean isFullscreen()
      Description copied from interface: Layout
      Gets whether this layout is fullscreen. If true, this layout will automatically have its witdh and height set to the screen's width and height.
      Specified by:
      isFullscreen in interface Layout
      Returns:
      true if this layout is fullscreen
    • setFullscreen

      public void setFullscreen(boolean fullscreen)
      Description copied from interface: Layout
      Sets whether this layout is fullscreen. If true, this layout will automatically have its witdh and height set to the screen's width and height.
      Specified by:
      setFullscreen in interface Layout
      Parameters:
      fullscreen - true if this layout is fullscreen
    • getX

      public int getX()
      Description copied from interface: LayoutElement
      Gets the x-coordinate of this object.
      Specified by:
      getX in interface LayoutElement
      Returns:
      the x-coordinate
    • setX

      public void setX(int x)
      Description copied from interface: LayoutElement
      Sets the x-coordinate of this object.
      Specified by:
      setX in interface LayoutElement
      Parameters:
      x - the x-coordinate
    • getY

      public int getY()
      Description copied from interface: LayoutElement
      Gets the y-coordinate of this object.
      Specified by:
      getY in interface LayoutElement
      Returns:
      the y-coordinate
    • setY

      public void setY(int y)
      Description copied from interface: LayoutElement
      Sets the y-coordinate of this object.
      Specified by:
      setY in interface LayoutElement
      Parameters:
      y - the y-coordinate
    • getWidth

      public int getWidth()
      Description copied from interface: LayoutElement
      Gets the width of this object.
      Specified by:
      getWidth in interface LayoutElement
      Returns:
      the width
    • setWidth

      public void setWidth(int width)
      Description copied from interface: LayoutElement
      Sets the width of this object.
      Specified by:
      setWidth in interface LayoutElement
      Parameters:
      width - the width
    • getHeight

      public int getHeight()
      Description copied from interface: LayoutElement
      Gets the height of this object.
      Specified by:
      getHeight in interface LayoutElement
      Returns:
      the height
    • setHeight

      public void setHeight(int height)
      Description copied from interface: LayoutElement
      Sets the height of this object.
      Specified by:
      setHeight in interface LayoutElement
      Parameters:
      height - the height
    • 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.
      Specified by:
      addElement in interface 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.
      Specified by:
      createDefaultSettings in interface 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.
      Specified by:
      visitChildren in interface Layout
      Parameters:
      visitor - Element Visitor
    • arrangeElements

      public void arrangeElements()
      Description copied from interface: Layout
      Arranges the elements inside this Layout.
      Specified by:
      arrangeElements in interface Layout
    • horizontal

      @NotNull public static @NotNull LinearLayout horizontal()
      Creates a horizontal layout.
      Returns:
      A Horizontal LinearLayout
    • vertical

      @NotNull public static @NotNull LinearLayout vertical()
      Creates a vertical layout.
      Returns:
      A Vertical LinearLayout