Interface Layout

All Superinterfaces:
LayoutElement, Serializable
All Known Implementing Classes:
AbstractLayout, EqualSpacingLayout, FrameLayout, GridLayout, LinearLayout, PageLayout

public interface Layout extends LayoutElement, Serializable
Represents a Screen Layout.
  • Method Details

    • isFullscreen

      boolean isFullscreen()
      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.
      Returns:
      true if this layout is fullscreen
    • setFullscreen

      void setFullscreen(boolean fullscreen)
      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.
      Parameters:
      fullscreen - true if this layout is fullscreen
    • addElement

      default <T extends LayoutElement> T addElement(@NotNull T element) throws IllegalArgumentException
      Adds an element to this layout using the default settings.
      Type Parameters:
      T - the type of the element
      Parameters:
      element - the element to add
      Returns:
      the added element
      Throws:
      IllegalArgumentException - if the element is null
    • addElement

      default <T extends LayoutElement> T addElement(@NotNull T element, @NotNull @NotNull Supplier<LayoutSettings> settings) throws IllegalArgumentException
      Adds an element to this layout.
      Type Parameters:
      T - the type of the element
      Parameters:
      element - the element to add
      settings - the generator for the element settings
      Returns:
      the added element
      Throws:
      IllegalArgumentException - if the element or settings are null
    • addElement

      default <T extends LayoutElement> T addElement(@NotNull T element, @NotNull @NotNull Consumer<LayoutSettings> settings) throws IllegalArgumentException
      Adds an element to this layout.
      Type Parameters:
      T - the type of the element
      Parameters:
      element - the element to add
      settings - the function for settings applied on createDefaultSettings()
      Returns:
      the added element
      Throws:
      IllegalArgumentException - if the element or settings are null
    • addElement

      <T extends LayoutElement> T addElement(@NotNull T element, @NotNull @NotNull LayoutSettings settings) throws IllegalArgumentException
      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 @NotNull LayoutSettings createDefaultSettings()
      Generates the default layout settings for this layout.
      Returns:
      Default Layout Settings
    • visitChildren

      void visitChildren(@NotNull @NotNull Consumer<LayoutElement> visitor)
      Visits this layout and all of its children.
      Parameters:
      visitor - Element Visitor
    • visitWidgets

      default void visitWidgets(@Nullable @Nullable Consumer<AbstractWidget> visitor)
      Visits all the widgets in this layout.
      Specified by:
      visitWidgets in interface LayoutElement
      Parameters:
      visitor - Widget Visitor
    • arrangeElements

      default void arrangeElements()
      Arranges the elements inside this Layout.