Class EqualSpacingLayout
java.lang.Object
xyz.gmitch215.socketmc.screen.layout.AbstractLayout
xyz.gmitch215.socketmc.screen.layout.EqualSpacingLayout
- All Implemented Interfaces:
Serializable
,Layout
,LayoutElement
Represents a layout with equal spacing.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The orientation of the equal spacing layout.Nested classes/interfaces inherited from class xyz.gmitch215.socketmc.screen.layout.AbstractLayout
AbstractLayout.AbstractChildContainer
-
Field Summary
Fields inherited from class xyz.gmitch215.socketmc.screen.layout.AbstractLayout
height, width, x, y
-
Constructor Summary
ConstructorDescriptionEqualSpacingLayout
(int x, int y, int width, int height, @NotNull EqualSpacingLayout.Orientation orientation) Creates a new equal spacing layout with the given x, y, width, height, and orientation.EqualSpacingLayout
(int width, int height, @NotNull EqualSpacingLayout.Orientation orientation) Creates a new equal spacing layout with the given width, height, and orientation.EqualSpacingLayout
(@NotNull ElementBounds bounds, @NotNull EqualSpacingLayout.Orientation orientation) Creates a new equal spacing layout with the given bounds and orientation. -
Method Summary
Modifier and TypeMethodDescription<T extends LayoutElement>
TaddElement
(T element, @NotNull LayoutSettings settings) Adds an element to this layout.void
Arranges the elements inside this Layout.Generates the default layout settings for this layout.void
visitChildren
(@NotNull Consumer<LayoutElement> visitor) Visits this layout and all of its children.Methods inherited from class xyz.gmitch215.socketmc.screen.layout.AbstractLayout
getHeight, getWidth, getX, getY, isFullscreen, setFullscreen, setHeight, setWidth, setX, setY
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface xyz.gmitch215.socketmc.screen.layout.Layout
addElement, addElement, addElement, visitWidgets
Methods inherited from interface xyz.gmitch215.socketmc.screen.layout.LayoutElement
setPosition, setSize, setSize, setSize
-
Constructor Details
-
EqualSpacingLayout
public EqualSpacingLayout(@NotNull @NotNull ElementBounds bounds, @NotNull @NotNull EqualSpacingLayout.Orientation orientation) Creates a new equal spacing layout with the given bounds and orientation.- Parameters:
bounds
- The bounds of the layoutorientation
- The orientation of the layout
-
EqualSpacingLayout
public EqualSpacingLayout(int width, int height, @NotNull @NotNull EqualSpacingLayout.Orientation orientation) Creates a new equal spacing layout with the given width, height, and orientation.- Parameters:
width
- The width of the layoutheight
- The height of the layoutorientation
- The orientation of the layout
-
EqualSpacingLayout
public EqualSpacingLayout(int x, int y, int width, int height, @NotNull @NotNull EqualSpacingLayout.Orientation orientation) Creates a new equal spacing layout with the given x, y, width, height, and orientation.- Parameters:
x
- The x position of the layouty
- The y position of the layoutwidth
- The width of the layoutheight
- The height of the layoutorientation
- The orientation of the layout
-
-
Method Details
-
addElement
public <T extends LayoutElement> T addElement(@NotNull T element, @NotNull @NotNull LayoutSettings settings) throws IllegalArgumentException Description copied from interface:Layout
Adds an element to this layout.- Type Parameters:
T
- the type of the element- Parameters:
element
- the element to addsettings
- the settings for the element- Returns:
- the added element
- Throws:
IllegalArgumentException
- if the element or settings are null
-
createDefaultSettings
Description copied from interface:Layout
Generates the default layout settings for this layout.- Returns:
- Default Layout Settings
-
visitChildren
Description copied from interface:Layout
Visits this layout and all of its children.- Parameters:
visitor
- Element Visitor
-
arrangeElements
public void arrangeElements()Description copied from interface:Layout
Arranges the elements inside this Layout.
-