Class ToggleItemComponentBuilder
java.lang.Object
io.github.toberocat.guiengine.components.AbstractGuiComponentBuilder<ToggleItemComponentBuilder>
io.github.toberocat.guiengine.components.provided.toggle.ToggleItemComponentBuilder
- All Implemented Interfaces:
GuiComponentBuilder
public class ToggleItemComponentBuilder
extends AbstractGuiComponentBuilder<ToggleItemComponentBuilder>
Builder class for creating instances of
ToggleItemComponent
.-
Field Summary
Fields inherited from class io.github.toberocat.guiengine.components.AbstractGuiComponentBuilder
clickFunctions, closeFunctions, dragFunctions, hidden, id, priority, x, y
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull ToggleItemComponent
Create a new instance ofToggleItemComponent
with the provided parameters.void
deserialize
(@NotNull ParserContext node) Deserialize the builder from a parser context node.@NotNull ToggleItemComponentBuilder
setOptions
(@NotNull ParserContext options) Set the options for the toggle item component.@NotNull ToggleItemComponentBuilder
setSelected
(int selected) Set the index of the initially selected option.Methods inherited from class io.github.toberocat.guiengine.components.AbstractGuiComponentBuilder
getId, self, setClickFunctions, setCloseFunctions, setDragFunctions, setHidden, setId, setPriority, setX, setY
-
Constructor Details
-
ToggleItemComponentBuilder
public ToggleItemComponentBuilder()
-
-
Method Details
-
setOptions
@NotNull public @NotNull ToggleItemComponentBuilder setOptions(@NotNull @NotNull ParserContext options) Set the options for the toggle item component.- Parameters:
options
- The parser context containing the options for the toggle item.- Returns:
- This builder instance.
-
setSelected
Set the index of the initially selected option.- Parameters:
selected
- The index of the initially selected option.- Returns:
- This builder instance.
-
createComponent
Create a new instance ofToggleItemComponent
with the provided parameters.- Returns:
- The created ToggleItemComponent instance.
- Throws:
AssertionError
- if options are not set.
-
deserialize
Deserialize the builder from a parser context node.- Specified by:
deserialize
in interfaceGuiComponentBuilder
- Overrides:
deserialize
in classAbstractGuiComponentBuilder<ToggleItemComponentBuilder>
- Parameters:
node
- The parser context node containing the serialized data.- Throws:
IOException
- if there is an error while deserializing.
-