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
Nested ClassesModifier and TypeClassDescriptionstatic enumSpecifies the horizontal alignment of elements inside aFlowBox.static enumSpecifies the horizontal alignment of elements inside aFlowBox.Nested classes/interfaces inherited from interface org.moddingx.libx.screen.text.entry.TextScreenEntry
TextScreenEntry.Direct -
Constructor Summary
ConstructorsConstructorDescriptionFlowBox(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 aFlowBoxrecord class. -
Method Summary
Modifier and TypeMethodDescriptionelements()Returns the value of theelementsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thehorizontalAlignmentrecord component.intleft()Returns the value of theleftrecord component.intright()Returns the value of therightrecord component.inttop()Returns the value of thetoprecord component.final StringtoString()Returns a string representation of this record class.Returns the value of theverticalAlignmentrecord 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 aFlowBoxrecord class.- Parameters:
horizontalAlignment- the value for thehorizontalAlignmentrecord componentverticalAlignment- the value for theverticalAlignmentrecord componentelements- the value for theelementsrecord componentleft- the value for theleftrecord componentright- the value for therightrecord componenttop- the value for thetoprecord 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 thehorizontalAlignmentrecord component.- Returns:
- the value of the
horizontalAlignmentrecord component
-
verticalAlignment
Returns the value of theverticalAlignmentrecord component.- Returns:
- the value of the
verticalAlignmentrecord component
-
elements
Returns the value of theelementsrecord component.- Returns:
- the value of the
elementsrecord component
-
left
public int left()Returns the value of theleftrecord component.- Specified by:
leftin interfaceTextScreenEntry- Returns:
- the value of the
leftrecord component
-
right
public int right()Returns the value of therightrecord component.- Returns:
- the value of the
rightrecord component
-
top
public int top()Returns the value of thetoprecord component.- Specified by:
topin interfaceTextScreenEntry- Returns:
- the value of the
toprecord component
-