Class PageLayout
java.lang.Object
xyz.gmitch215.socketmc.screen.layout.PageLayout
- All Implemented Interfaces:
 Serializable,Layout,LayoutElement
Represents a layout with a header, footer, and content area. This layout is always at the top left of the screen, with isFullscreen() always true.
 This means that calling setWidth(int) and setHeight(int) will have no effect.
- See Also:
 
- 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe top margin of the content area.static final intThe default height for the header and footer. - 
Constructor Summary
ConstructorsConstructorDescriptionCreates a new PageLayout using the default margin height.PageLayout(int marginHeight) Creates a new PageLayout.PageLayout(int headerHeight, int footerHeight) Creates a new PageLayout. - 
Method Summary
Modifier and TypeMethodDescription<T extends LayoutElement>
TaddElement(T element, @NotNull LayoutSettings settings) Adds an element to the contents of this PageLayout.<T extends LayoutElement>
TaddFooterElement(T element) Adds an element to the footer of this PageLayout.<T extends LayoutElement>
TaddFooterElement(T element, @NotNull Consumer<LayoutSettings> settings) Adds an element to the footer of this PageLayout.<T extends LayoutElement>
TaddFooterElement(T element, @NotNull Supplier<LayoutSettings> settings) Adds an element to the footer of this PageLayout.<T extends LayoutElement>
TaddFooterElement(T element, @NotNull LayoutSettings settings) Adds an element to the footer of this PageLayout.<T extends LayoutElement>
TaddHeaderElement(T element) Adds an element to the header of this PageLayout.<T extends LayoutElement>
TaddHeaderElement(T element, @NotNull Consumer<LayoutSettings> settings) Adds an element to the header of this PageLayout.<T extends LayoutElement>
TaddHeaderElement(T element, @NotNull Supplier<LayoutSettings> settings) Adds an element to the header of this PageLayout.<T extends LayoutElement>
TaddHeaderElement(T element, @NotNull LayoutSettings settings) Adds an element to the header of this PageLayout.voidArranges the elements inside this Layout.Generates the default layout settings for this layout.intGets the height of the content area.intGets the height of the footer.intGets the height of the header.intGets the height of this object.intgetWidth()Gets the width of this object.intgetX()Gets the x-coordinate of this object.intgetY()Gets the y-coordinate of this object.booleanGets whether this layout is fullscreen.voidsetFooterHeight(int footerHeight) Sets the height of the footer.voidsetFullscreen(boolean fullscreen) Sets whether this layout is fullscreen.voidsetHeaderHeight(int headerHeight) Sets the height of the header.voidsetHeight(int height) Sets the height of this object.voidsetWidth(int width) Sets the width of this object.voidsetX(int x) Sets the x-coordinate of this object.voidsetY(int y) Sets the y-coordinate of this object.voidvisitChildren(@NotNull Consumer<LayoutElement> visitor) Visits this layout and all of its children.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface xyz.gmitch215.socketmc.screen.layout.Layout
addElement, addElement, addElement, visitWidgetsMethods inherited from interface xyz.gmitch215.socketmc.screen.layout.LayoutElement
setPosition, setSize, setSize, setSize 
- 
Field Details
- 
DEFAULT_MARGIN_HEIGHT
public static final int DEFAULT_MARGIN_HEIGHTThe default height for the header and footer.- See Also:
 
 - 
CONTENT_MARGIN_TOP
public static final int CONTENT_MARGIN_TOPThe top margin of the content area.- See Also:
 
 
 - 
 - 
Constructor Details
- 
PageLayout
public PageLayout()Creates a new PageLayout using the default margin height. - 
PageLayout
public PageLayout(int marginHeight) Creates a new PageLayout.- Parameters:
 marginHeight- The height of the header and footer.
 - 
PageLayout
public PageLayout(int headerHeight, int footerHeight) Creates a new PageLayout.- Parameters:
 headerHeight- The height of the header.footerHeight- The height of the footer.
 
 - 
 - 
Method Details
- 
getHeaderHeight
public int getHeaderHeight()Gets the height of the header.- Returns:
 - Header Height
 
 - 
setHeaderHeight
public void setHeaderHeight(int headerHeight) Sets the height of the header.- Parameters:
 headerHeight- Header Height
 - 
getContentHeight
public int getContentHeight()Gets the height of the content area.- Returns:
 - Content Height
 
 - 
addHeaderElement
@NotNull public <T extends LayoutElement> T addHeaderElement(@NotNull T element) throws IllegalArgumentException Adds an element to the header of this PageLayout.- Type Parameters:
 T- the type of element- Parameters:
 element- the element to add- Returns:
 - the element that was added
 - Throws:
 IllegalArgumentException- if the element or settings are null
 - 
addHeaderElement
@NotNull public <T extends LayoutElement> T addHeaderElement(@NotNull T element, @NotNull @NotNull LayoutSettings settings) throws IllegalArgumentException Adds an element to the header of this PageLayout.- Type Parameters:
 T- the type of element- Parameters:
 element- the element to addsettings- the settings for the element- Returns:
 - the element that was added
 - Throws:
 IllegalArgumentException- if the element or settings are null
 - 
addHeaderElement
@NotNull public <T extends LayoutElement> T addHeaderElement(@NotNull T element, @NotNull @NotNull Supplier<LayoutSettings> settings) throws IllegalArgumentException Adds an element to the header of this PageLayout.- Type Parameters:
 T- the type of element- Parameters:
 element- the element to addsettings- the generator for the element settings- Returns:
 - the element that was added
 - Throws:
 IllegalArgumentException- if the element or settings are null
 - 
addHeaderElement
@NotNull public <T extends LayoutElement> T addHeaderElement(@NotNull T element, @NotNull @NotNull Consumer<LayoutSettings> settings) throws IllegalArgumentException Adds an element to the header of this PageLayout.- Type Parameters:
 T- the type of element- Parameters:
 element- the element to addsettings- the function for settings applied oncreateDefaultSettings()- Returns:
 - the element that was added
 - Throws:
 IllegalArgumentException- if the element or settings are null
 - 
isFullscreen
public boolean isFullscreen()Description copied from interface:LayoutGets whether this layout is fullscreen. If true, this layout will automatically have its witdh and height set to the screen's width and height.- Specified by:
 isFullscreenin interfaceLayout- Returns:
 - true if this layout is fullscreen
 
 - 
setFullscreen
public void setFullscreen(boolean fullscreen) Description copied from interface:LayoutSets whether this layout is fullscreen. If true, this layout will automatically have its witdh and height set to the screen's width and height.- Specified by:
 setFullscreenin interfaceLayout- Parameters:
 fullscreen- true if this layout is fullscreen
 - 
addElement
public <T extends LayoutElement> T addElement(@NotNull T element, @NotNull @NotNull LayoutSettings settings) throws IllegalArgumentException Adds an element to the contents of this PageLayout.- Specified by:
 addElementin interfaceLayout- Type Parameters:
 T- the type of element- Parameters:
 element- the element to addsettings- the settings for the element- Returns:
 - the element that was added
 - Throws:
 IllegalArgumentException- if the element or settings are null
 - 
createDefaultSettings
Description copied from interface:LayoutGenerates the default layout settings for this layout.- Specified by:
 createDefaultSettingsin interfaceLayout- Returns:
 - Default Layout Settings
 
 - 
visitChildren
Description copied from interface:LayoutVisits this layout and all of its children.- Specified by:
 visitChildrenin interfaceLayout- Parameters:
 visitor- Element Visitor
 - 
arrangeElements
public void arrangeElements()Description copied from interface:LayoutArranges the elements inside this Layout.- Specified by:
 arrangeElementsin interfaceLayout
 - 
getHeight
public int getHeight()Description copied from interface:LayoutElementGets the height of this object.- Specified by:
 getHeightin interfaceLayoutElement- Returns:
 - the height
 
 - 
setHeight
public void setHeight(int height) Description copied from interface:LayoutElementSets the height of this object.- Specified by:
 setHeightin interfaceLayoutElement- Parameters:
 height- the height
 - 
getWidth
public int getWidth()Description copied from interface:LayoutElementGets the width of this object.- Specified by:
 getWidthin interfaceLayoutElement- Returns:
 - the width
 
 - 
setWidth
public void setWidth(int width) Description copied from interface:LayoutElementSets the width of this object.- Specified by:
 setWidthin interfaceLayoutElement- Parameters:
 width- the width
 - 
getX
public int getX()Description copied from interface:LayoutElementGets the x-coordinate of this object.- Specified by:
 getXin interfaceLayoutElement- Returns:
 - the x-coordinate
 
 - 
setX
public void setX(int x) Description copied from interface:LayoutElementSets the x-coordinate of this object.- Specified by:
 setXin interfaceLayoutElement- Parameters:
 x- the x-coordinate
 - 
getY
public int getY()Description copied from interface:LayoutElementGets the y-coordinate of this object.- Specified by:
 getYin interfaceLayoutElement- Returns:
 - the y-coordinate
 
 - 
setY
public void setY(int y) Description copied from interface:LayoutElementSets the y-coordinate of this object.- Specified by:
 setYin interfaceLayoutElement- Parameters:
 y- the y-coordinate
 
 -