Class AbstractGuiComponentBuilder<B extends AbstractGuiComponentBuilder<B>>

java.lang.Object
io.github.toberocat.guiengine.components.AbstractGuiComponentBuilder<B>
Type Parameters:
B - The type of the builder class.
All Implemented Interfaces:
GuiComponentBuilder
Direct Known Subclasses:
EmbeddedGuiComponentBuilder, SimpleItemComponentBuilder, ToggleItemComponentBuilder

public abstract class AbstractGuiComponentBuilder<B extends AbstractGuiComponentBuilder<B>> extends Object implements GuiComponentBuilder
An abstract base class for building GUI components. This class provides common properties and methods for building GUI components. Created: 10.07.2023 Author: Tobias Madlberger (Tobias)
  • Field Details

    • priority

      @NotNull protected @NotNull RenderPriority priority
    • id

      @NotNull protected @NotNull String id
    • x

      protected int x
    • y

      protected int y
    • hidden

      protected boolean hidden
    • clickFunctions

      @NotNull protected @NotNull List<GuiFunction> clickFunctions
    • dragFunctions

      @NotNull protected @NotNull List<GuiFunction> dragFunctions
    • closeFunctions

      @NotNull protected @NotNull List<GuiFunction> closeFunctions
  • Constructor Details

    • AbstractGuiComponentBuilder

      public AbstractGuiComponentBuilder()
  • Method Details

    • setPriority

      @NotNull public B setPriority(@NotNull @NotNull RenderPriority priority)
      Set the rendering priority of the GUI component.
      Parameters:
      priority - The RenderPriority to set.
      Returns:
      The builder instance.
    • setId

      @NotNull public B setId(@NotNull @NotNull String id)
      Set the ID of the GUI component.
      Parameters:
      id - The ID to set.
      Returns:
      The builder instance.
    • setX

      @NotNull public B setX(int x)
      Set the X coordinate of the GUI component.
      Parameters:
      x - The X coordinate to set.
      Returns:
      The builder instance.
    • setY

      @NotNull public B setY(int y)
      Set the Y coordinate of the GUI component.
      Parameters:
      y - The Y coordinate to set.
      Returns:
      The builder instance.
    • setHidden

      @NotNull public B setHidden(boolean hidden)
      Set the visibility of the GUI component.
      Parameters:
      hidden - true to hide the component, false to make it visible.
      Returns:
      The builder instance.
    • setClickFunctions

      @NotNull public B setClickFunctions(@NotNull @NotNull List<GuiFunction> clickFunctions)
      Set the click functions for the GUI component.
      Parameters:
      clickFunctions - The list of click functions to set.
      Returns:
      The builder instance.
    • setDragFunctions

      @NotNull public B setDragFunctions(@NotNull @NotNull List<GuiFunction> dragFunctions)
      Set the drag functions for the GUI component.
      Parameters:
      dragFunctions - The list of drag functions to set.
      Returns:
      The builder instance.
    • setCloseFunctions

      @NotNull public B setCloseFunctions(@NotNull @NotNull List<GuiFunction> closeFunctions)
      Set the close functions for the GUI component.
      Parameters:
      closeFunctions - The list of close functions to set.
      Returns:
      The builder instance.
    • getId

      @NotNull public @NotNull String getId()
      Get the ID of the GUI component.
      Returns:
      The ID of the GUI component.
    • deserialize

      public void deserialize(@NotNull @NotNull ParserContext node) throws IOException
      Deserialize the properties of the GUI component from the provided ParserContext node.
      Specified by:
      deserialize in interface GuiComponentBuilder
      Parameters:
      node - The ParserContext node containing the properties of the GUI component.
      Throws:
      IOException - If there is an error while deserializing the properties.
    • self

      @NotNull protected final B self()
      Helper method to return the builder instance.
      Returns:
      The builder instance.