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 Summary
FieldsModifier and TypeFieldDescriptionprotected @NotNull List<GuiFunction>protected @NotNull List<GuiFunction>protected @NotNull List<GuiFunction>protected booleanprotected @NotNull Stringprotected @NotNull RenderPriorityprotected intprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserialize(@NotNull ParserContext node) Deserialize the properties of the GUI component from the provided ParserContext node.@NotNull StringgetId()Get the ID of the GUI component.protected final Bself()Helper method to return the builder instance.setClickFunctions(@NotNull List<GuiFunction> clickFunctions) Set the click functions for the GUI component.setCloseFunctions(@NotNull List<GuiFunction> closeFunctions) Set the close functions for the GUI component.setDragFunctions(@NotNull List<GuiFunction> dragFunctions) Set the drag functions for the GUI component.setHidden(boolean hidden) Set the visibility of the GUI component.Set the ID of the GUI component.setPriority(@NotNull RenderPriority priority) Set the rendering priority of the GUI component.setX(int x) Set the X coordinate of the GUI component.setY(int y) Set the Y coordinate of the GUI component.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.toberocat.guiengine.components.GuiComponentBuilder
createComponent
-
Field Details
-
priority
-
id
-
x
protected int x -
y
protected int y -
clickFunctions
-
dragFunctions
-
closeFunctions
-
-
Constructor Details
-
AbstractGuiComponentBuilder
public AbstractGuiComponentBuilder()
-
-
Method Details
-
setPriority
Set the rendering priority of the GUI component.- Parameters:
priority- The RenderPriority to set.- Returns:
- The builder instance.
-
setId
Set the ID of the GUI component.- Parameters:
id- The ID to set.- Returns:
- The builder instance.
-
setX
Set the X coordinate of the GUI component.- Parameters:
x- The X coordinate to set.- Returns:
- The builder instance.
-
setY
Set the Y coordinate of the GUI component.- Parameters:
y- The Y coordinate to set.- Returns:
- The builder instance.
-
setHidden
Set the visibility of the GUI component.- Parameters:
hidden- true to hide the component, false to make it visible.- Returns:
- The builder instance.
-
setClickFunctions
Set the click functions for the GUI component.- Parameters:
clickFunctions- The list of click functions to set.- Returns:
- The builder instance.
-
setDragFunctions
Set the drag functions for the GUI component.- Parameters:
dragFunctions- The list of drag functions to set.- Returns:
- The builder instance.
-
setCloseFunctions
Set the close functions for the GUI component.- Parameters:
closeFunctions- The list of close functions to set.- Returns:
- The builder instance.
-
getId
Get the ID of the GUI component.- Returns:
- The ID of the GUI component.
-
deserialize
Deserialize the properties of the GUI component from the provided ParserContext node.- Specified by:
deserializein interfaceGuiComponentBuilder- Parameters:
node- The ParserContext node containing the properties of the GUI component.- Throws:
IOException- If there is an error while deserializing the properties.
-
self
Helper method to return the builder instance.- Returns:
- The builder instance.
-