Record Class FlowBox
java.lang.Object
java.lang.Record
org.moddingx.libx.screen.text.entry.FlowBox
- Record Components:
horizontalAlignment
- How the elements should be aligned horizontally.verticalAlignment
- How the elements should be aligned vertically.elements
- The elements inside this box.left
- The horizontal padding to the left edge of the screen.top
- The vertical padding to the bottom of the previous component.
- All Implemented Interfaces:
TextScreenEntry
public record FlowBox(FlowBox.HorizontalAlignment horizontalAlignment, FlowBox.VerticalAlignment verticalAlignment, List<TextScreenEntry.Direct> elements, int left, int right, int top)
extends Record
implements TextScreenEntry
A flow box can align elements horizontally inside a
TextScreen
that align items vertically by default.
Elements will be split into multiple rows, where each row is filled with as many elements as possible before
they overflow. Note that wrapped components
can shrink in width. It is
recommended to set a minimum width
when using wrapped components
inside a flow box.
Inside the flow box, left padding
will be added to each element and describes the
distance to the previous element in the row. The first element in a row won't get left padding, to pad the start of
a row, pad the entire flow box.
All elements in a row will get the same top padding
which is the maximum of the
individual top paddings inside that row.
Flow boxes can also define right padding
which is useful when the flow box uses
FlowBox.HorizontalAlignment.RIGHT
alignment.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Specifies the horizontal alignment of elements inside aFlowBox
.static enum
Specifies the horizontal alignment of elements inside aFlowBox
.Nested classes/interfaces inherited from interface org.moddingx.libx.screen.text.entry.TextScreenEntry
TextScreenEntry.Direct
-
Constructor Summary
ConstructorDescriptionFlowBox
(List<TextScreenEntry.Direct> elements, int horizontalPadding, int top) FlowBox
(List<TextScreenEntry.Direct> elements, int left, int right, int top) FlowBox
(FlowBox.HorizontalAlignment alignment, List<TextScreenEntry.Direct> elements, int horizontalPadding, int top) FlowBox
(FlowBox.HorizontalAlignment alignment, List<TextScreenEntry.Direct> elements, int left, int right, int top) FlowBox
(FlowBox.HorizontalAlignment horizontalAlignment, FlowBox.VerticalAlignment verticalAlignment, List<TextScreenEntry.Direct> elements, int horizontalPadding, int top) FlowBox
(FlowBox.HorizontalAlignment horizontalAlignment, FlowBox.VerticalAlignment verticalAlignment, List<TextScreenEntry.Direct> elements, int left, int right, int top) Creates an instance of aFlowBox
record class. -
Method Summary
Modifier and TypeMethodDescriptionelements()
Returns the value of theelements
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.Returns the value of thehorizontalAlignment
record component.int
left()
Returns the value of theleft
record component.int
right()
Returns the value of theright
record component.int
top()
Returns the value of thetop
record component.final String
toString()
Returns a string representation of this record class.Returns the value of theverticalAlignment
record component.
-
Constructor Details
-
FlowBox
-
FlowBox
public FlowBox(FlowBox.HorizontalAlignment alignment, List<TextScreenEntry.Direct> elements, int horizontalPadding, int top) -
FlowBox
public FlowBox(FlowBox.HorizontalAlignment horizontalAlignment, FlowBox.VerticalAlignment verticalAlignment, List<TextScreenEntry.Direct> elements, int horizontalPadding, int top) -
FlowBox
-
FlowBox
public FlowBox(FlowBox.HorizontalAlignment alignment, List<TextScreenEntry.Direct> elements, int left, int right, int top) -
FlowBox
public FlowBox(FlowBox.HorizontalAlignment horizontalAlignment, FlowBox.VerticalAlignment verticalAlignment, List<TextScreenEntry.Direct> elements, int left, int right, int top) Creates an instance of aFlowBox
record class.- Parameters:
horizontalAlignment
- the value for thehorizontalAlignment
record componentverticalAlignment
- the value for theverticalAlignment
record componentelements
- the value for theelements
record componentleft
- the value for theleft
record componentright
- the value for theright
record componenttop
- the value for thetop
record component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
horizontalAlignment
Returns the value of thehorizontalAlignment
record component.- Returns:
- the value of the
horizontalAlignment
record component
-
verticalAlignment
Returns the value of theverticalAlignment
record component.- Returns:
- the value of the
verticalAlignment
record component
-
elements
Returns the value of theelements
record component.- Returns:
- the value of the
elements
record component
-
left
public int left()Returns the value of theleft
record component.- Specified by:
left
in interfaceTextScreenEntry
- Returns:
- the value of the
left
record component
-
right
public int right()Returns the value of theright
record component.- Returns:
- the value of the
right
record component
-
top
public int top()Returns the value of thetop
record component.- Specified by:
top
in interfaceTextScreenEntry
- Returns:
- the value of the
top
record component
-