Package io.bdeploy.common.cli.data
Class DataTableBase
java.lang.Object
io.bdeploy.common.cli.data.DataTableBase
- All Implemented Interfaces:
DataTable,RenderableResult
- Direct Known Subclasses:
DataTableCsv,DataTableJson,DataTableText
Base class for
DataTable implementations.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd a horizontal ruler row at the current position.column(DataTableColumn column) Adds a column to the table.Adds a column to the table.protected Stringprotected Stringprotected Stringprotected List<List<DataTableCell>>getRows()protected PrintStreamout()row()Creates a builder which will insert a row into the table when its build() method is called.row(List<DataTableCell> list) setCaption(String caption) setExitCode(ExitCode exitCode) setHideHeadersHint(boolean hide) setIndentHint(int hint) setLineWrapHint(boolean wrap) setWordBreakHint(boolean allowBreak) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.bdeploy.common.cli.data.RenderableResult
render
-
Constructor Details
-
DataTableBase
- Parameters:
output- the output to render to.
-
-
Method Details
-
out
- Returns:
- the output to render to.
-
getCaption
- Returns:
- the set caption or
nullif there should be no caption.
-
getRows
- Returns:
- all currently defined data rows. Each row contains a series of cells whos accumulated span must equal the number of columns.
-
ellipsis
- Parameters:
data- the original datalimit- the length limit- Returns:
- the original data limited to the given length minus 3 characters plus '...' appended.
-
expand
- Parameters:
data- the original datawidth- the width to expand the string to.- Returns:
- the original data in a string of exactly
widthlength. The data is either filled up with spaces, or shortened according toellipsis(String, int).
-
setCaption
- Specified by:
setCaptionin interfaceDataTable- Parameters:
caption- The caption of the table. The caption row is hidden if no caption is set.
-
setIndentHint
- Specified by:
setIndentHintin interfaceDataTable- Parameters:
hint- by how much to indent the rendered table. This is just a hint and may be ignored depending on the output format.
-
setLineWrapHint
- Specified by:
setLineWrapHintin interfaceDataTable- Parameters:
wrap- whether overflow should be cut off or wrapped into an additional line in the table. This is just a hint and may be ignored depending on the output format.
-
setWordBreakHint
- Specified by:
setWordBreakHintin interfaceDataTable- Parameters:
allowBreak- iftruebreaking words apart is allowed. Iffalse(default) breaking words is only allowed if a single word cannot fit within a column.
-
setHideHeadersHint
- Specified by:
setHideHeadersHintin interfaceDataTable- Parameters:
hide- whether to hide column headers. This is just a hint and may be ignored depending on the output format.
-
addHorizontalRuler
Description copied from interface:DataTableAdd a horizontal ruler row at the current position.- Specified by:
addHorizontalRulerin interfaceDataTable
-
column
Description copied from interface:DataTableAdds a column to the table. All columns must be added before adding actual data. -
column
Description copied from interface:DataTableAdds a column to the table. All columns must be added before adding actual data. -
getColumns
- Specified by:
getColumnsin interfaceDataTable- Returns:
- all previously registered columns.
-
row
-
row
Description copied from interface:DataTableCreates a builder which will insert a row into the table when its build() method is called. -
setExitCode
- Specified by:
setExitCodein interfaceDataTable- Parameters:
exitCode- indicates whether operation was successful or had any errors.
-
getExitCode
- Specified by:
getExitCodein interfaceRenderableResult
-