Class FlexText
java.lang.Object
org.strassburger.tui4j.formatting.layout.FlexText
- All Implemented Interfaces:
Renderable
A layout component that arranges multiple StyledText parts with flexible justification and spacing.
-
Constructor Summary
ConstructorsConstructorDescriptionFlexText()FlexText(StyledText... part) Creates a FlexText with a single part -
Method Summary
Modifier and TypeMethodDescriptionaddPart(StyledText part) intgetGap()getParts()static FlexTextCreates a FlexText representing a key-value pair with a clear line separationstatic FlexTextkeyValue(StyledText key, StyledText value) Creates a FlexText representing a key-value pair with a clear line separationvoidRender the element using the given printer and dimensionssetGap(int gap) Sets the fixed gap size between partssetJustify(FlexJustify justify) Sets the justification mode for arranging partssetParts(List<StyledText> parts) setSeparatorChar(StyledText separatorChar) Sets the character(s) used for spacing between parts
-
Constructor Details
-
FlexText
public FlexText() -
FlexText
Creates a FlexText with a single part- Parameters:
part- the StyledText part to add
-
-
Method Details
-
getParts
-
setParts
-
addPart
-
addPart
-
getJustify
-
setJustify
Sets the justification mode for arranging parts- Parameters:
justify- the FlexJustify mode- Returns:
- the FlexText instance
-
getGap
public int getGap() -
setGap
Sets the fixed gap size between parts- Parameters:
gap- the number of separator characters to insert between parts- Returns:
- the FlexText instance
-
getSeparatorChar
-
setSeparatorChar
Sets the character(s) used for spacing between parts- Parameters:
separatorChar- the StyledText to use as the separator- Returns:
- the FlexText instance
-
render
Description copied from interface:RenderableRender the element using the given printer and dimensions- Specified by:
renderin interfaceRenderable- Parameters:
printer- the printer to usewidth- the available widthheight- the available height
-
keyValue
Creates a FlexText representing a key-value pair with a clear line separation- Parameters:
key- the key stringvalue- the value string- Returns:
- the constructed FlexText
-
keyValue
Creates a FlexText representing a key-value pair with a clear line separation- Parameters:
key- the key StyledTextvalue- the value StyledText- Returns:
- the constructed FlexText
-