Interface Layout
- All Superinterfaces:
LayoutElement
,Serializable
- All Known Implementing Classes:
AbstractLayout
,EqualSpacingLayout
,FrameLayout
,GridLayout
,LinearLayout
,PageLayout
Represents a Screen Layout.
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T extends LayoutElement>
TaddElement
(T element) Adds an element to this layout using the default settings.default <T extends LayoutElement>
TaddElement
(T element, @NotNull Consumer<LayoutSettings> settings) Adds an element to this layout.default <T extends LayoutElement>
TaddElement
(T element, @NotNull Supplier<LayoutSettings> settings) Adds an element to this layout.<T extends LayoutElement>
TaddElement
(T element, @NotNull LayoutSettings settings) Adds an element to this layout.default void
Arranges the elements inside this Layout.Generates the default layout settings for this layout.boolean
Gets whether this layout is fullscreen.void
setFullscreen
(boolean fullscreen) Sets whether this layout is fullscreen.void
visitChildren
(@NotNull Consumer<LayoutElement> visitor) Visits this layout and all of its children.default void
visitWidgets
(@Nullable Consumer<AbstractWidget> visitor) Visits all the widgets in this layout.
-
Method Details
-
isFullscreen
boolean isFullscreen()Gets whether this layout is fullscreen. If true, this layout will automatically have its witdh and height set to the screen's width and height.- Returns:
- true if this layout is fullscreen
-
setFullscreen
void setFullscreen(boolean fullscreen) Sets whether this layout is fullscreen. If true, this layout will automatically have its witdh and height set to the screen's width and height.- Parameters:
fullscreen
- true if this layout is fullscreen
-
addElement
Adds an element to this layout using the default settings.- Type Parameters:
T
- the type of the element- Parameters:
element
- the element to add- Returns:
- the added element
- Throws:
IllegalArgumentException
- if the element is null
-
addElement
default <T extends LayoutElement> T addElement(@NotNull T element, @NotNull @NotNull Supplier<LayoutSettings> settings) throws IllegalArgumentException Adds an element to this layout.- Type Parameters:
T
- the type of the element- Parameters:
element
- the element to addsettings
- the generator for the element settings- Returns:
- the added element
- Throws:
IllegalArgumentException
- if the element or settings are null
-
addElement
default <T extends LayoutElement> T addElement(@NotNull T element, @NotNull @NotNull Consumer<LayoutSettings> settings) throws IllegalArgumentException Adds an element to this layout.- Type Parameters:
T
- the type of the element- Parameters:
element
- the element to addsettings
- the function for settings applied oncreateDefaultSettings()
- Returns:
- the added element
- Throws:
IllegalArgumentException
- if the element or settings are null
-
addElement
<T extends LayoutElement> T addElement(@NotNull T element, @NotNull @NotNull LayoutSettings settings) throws IllegalArgumentException 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
Generates the default layout settings for this layout.- Returns:
- Default Layout Settings
-
visitChildren
Visits this layout and all of its children.- Parameters:
visitor
- Element Visitor
-
visitWidgets
Visits all the widgets in this layout.- Specified by:
visitWidgets
in interfaceLayoutElement
- Parameters:
visitor
- Widget Visitor
-
arrangeElements
default void arrangeElements()Arranges the elements inside this Layout.
-