FreeSpaceComponent - ParzivalExe/guiapi GitHub Wiki
Overview
FromAgain, the name already describes this component pretty well as a FreeSpaceComponent is used to prevent Components from using the place it is used for.
The result will be a place
in the Gui that will not be populated by any Components. Threw a specific Field you can also specify if this position should be filled by the given FillItem
of the Gui or if it should be completely free, even if the Gui should normally would fill empty places with FillItem
s
Implementation
The implementation of FreeSpaceComponent is basically the most simple implementation from all of the Components. Simply create the Component like this:
FreeSpaceComponent spaceComponent = new FreeSpaceComponent();
//manipulate spaceComponent here
gui.addComponent(spaceComponent);
For FreeSpaceComponents you probably want to set the actual Place they should keep free every time so simply write spaceComponent.setPlace(place);
inside the manipulate spaceComponent region.
Now there is actually only one thing you can also change for the FreeSpaceComponent. With the field boolean forceNoFill
you can choose weather the free space should be filled with the FillItem
of the Gui
or always stay free. Default here is forceNoFill = false
meaning, that the space is filled by the FillItem
of the Gui but you can of course also change that in the manipulate spaceComponent region by writing spaceComponent.setForceNoFill(true)
.
Events
ComponentClickedEvent
= fired, when the StaticComponent (or any other Component) is clicked
XML-Attributes
place="{PLACE}"
= sets the place this Component should be placed at in the Gui (example: place="4"
)
forceNoFill="{true|false}"
= decides weather FillItem of Gui will fill this place or not (example: forceNoFill="true"
)
Resources
Component-Code: io.github.parzivalExe.guiApi.components.FreeSpaceComponent
Great, now you know how to implement a FreeSpaceComponent with a few lines. Next Component on the List is EventComponent.