Class Table
java.lang.Object
org.strassburger.tui4j.formatting.layout.table.Table
- All Implemented Interfaces:
Renderable
A table layout component that arranges data in rows and columns with customizable styles and alignments.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddRow(List<StyledText> row) Adds a row to the tablebooleanvoidRender the element using the given printer and dimensionssetColumnAlignment(int col, ColumnAlign columnAlignments) Sets the alignment for a specific columnsetColumnGrow(int col, int grow) Sets the grow factor for a specific columnsetDefaultGrow(int grow) Sets the default grow factor for all columnssetHasHeader(boolean hasHeader) Sets whether the table has a header rowsetRows(List<List<StyledText>> rows) Sets the rows of the tablesetStyle(TableStyle style) Sets the style of the table
-
Constructor Details
-
Table
public Table()
-
-
Method Details
-
setRows
Sets the rows of the table- Parameters:
rows- the list of rows, each row is a list of StyledText cells- Returns:
- the Table instance for chaining
-
addRow
Adds a row to the table- Parameters:
row- the row to add- Returns:
- the Table instance for chaining
-
hasHeader
public boolean hasHeader() -
setHasHeader
Sets whether the table has a header row- Parameters:
hasHeader- true if the first row is a header- Returns:
- the Table instance for chaining
-
setColumnAlignment
Sets the alignment for a specific column- Parameters:
col- the column indexcolumnAlignments- the alignment to set- Returns:
- the Table instance for chaining
-
setColumnGrow
Sets the grow factor for a specific column- Parameters:
col- the column indexgrow- the grow factor (must be >= 0)- Returns:
- the Table instance for chaining
-
setDefaultGrow
Sets the default grow factor for all columns- Parameters:
grow- the default grow factor (must be >= 0)- Returns:
- the Table instance for chaining
-
setStyle
Sets the style of the table- Parameters:
style- theTableStyleto use (e.g.TableStyles.DEFAULT)- Returns:
- the Table instance for chaining
-
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
-