Package org.cloudsimplus.builders.tables
Class AbstractTableColumn
java.lang.Object
org.cloudsimplus.builders.tables.AbstractTableColumn
- All Implemented Interfaces:
TableColumn
- Direct Known Subclasses:
CsvTableColumn
,HtmlTableColumn
public abstract class AbstractTableColumn extends Object implements TableColumn
A column of a table to be generated using a
Table
class.- Author:
- Manoel Campos da Silva Filho
-
Constructor Summary
Constructors Constructor Description AbstractTableColumn(String title, String subTitle)
Creates a column with a specific title and sub-title.AbstractTableColumn(Table table, String title)
Creates a column with a specific title.AbstractTableColumn(Table table, String title, String subTitle)
Creates a column with a specific title and sub-title for a given table. -
Method Summary
Modifier and Type Method Description String
generateData(Object data)
Generates the string that represents the data of the column, formatted according to theformat
.protected abstract String
generateHeader(String str)
Generates a header for the column, either for the title or subtitle header.String
generateSubtitleHeader()
Generates the string that represents the sub-header of the column (if any), containing the column subtitle.String
generateTitleHeader()
Generates the string that represents the header of the column, containing the column title.String
getFormat()
protected int
getIndex()
String
getSubTitle()
Table
getTable()
String
getTitle()
protected boolean
isLastColumn()
Indicates if the current column is the last one in the column list of theTable
.AbstractTableColumn
setFormat(String format)
AbstractTableColumn
setSubTitle(String subTitle)
AbstractTableColumn
setTable(Table table)
AbstractTableColumn
setTitle(String title)
String
toString()
-
Constructor Details
-
AbstractTableColumn
Creates a column with a specific title.- Parameters:
table
- The table that the column belongs to.title
- The column title.
-
AbstractTableColumn
Creates a column with a specific title and sub-title.- Parameters:
title
- The column title.subTitle
- The column sub-title.
-
AbstractTableColumn
Creates a column with a specific title and sub-title for a given table.- Parameters:
title
- The column title.subTitle
- The column sub-title.
-
-
Method Details
-
getTitle
- Specified by:
getTitle
in interfaceTableColumn
- Returns:
- The title to be displayed at the top of the column.
-
setTitle
- Specified by:
setTitle
in interfaceTableColumn
-
getSubTitle
- Specified by:
getSubTitle
in interfaceTableColumn
- Returns:
- The subtitle to be displayed below the title of the column (optional).
-
setSubTitle
- Specified by:
setSubTitle
in interfaceTableColumn
-
getFormat
- Specified by:
getFormat
in interfaceTableColumn
- Returns:
- The format to be used to display the content of the column,
according to the
String.format(java.lang.String, java.lang.Object...)
(optional).
-
setFormat
- Specified by:
setFormat
in interfaceTableColumn
-
toString
-
getTable
- Specified by:
getTable
in interfaceTableColumn
- Returns:
- The table that the column belongs to.
-
setTable
- Specified by:
setTable
in interfaceTableColumn
-
generateData
Generates the string that represents the data of the column, formatted according to theformat
.- Specified by:
generateData
in interfaceTableColumn
- Parameters:
data
- The data of the column to be formatted- Returns:
- a string containing the formatted column data
-
generateHeader
Generates a header for the column, either for the title or subtitle header.- Parameters:
str
- header title or subtitle- Returns:
- the generated header string
-
generateTitleHeader
Description copied from interface:TableColumn
Generates the string that represents the header of the column, containing the column title.- Specified by:
generateTitleHeader
in interfaceTableColumn
- Returns:
- the generated header string
-
generateSubtitleHeader
Description copied from interface:TableColumn
Generates the string that represents the sub-header of the column (if any), containing the column subtitle.- Specified by:
generateSubtitleHeader
in interfaceTableColumn
- Returns:
- the generated sub-header string
-
getIndex
protected int getIndex()- Returns:
- The index of the current column into the
column list of the
Table
.
-
isLastColumn
protected boolean isLastColumn()Indicates if the current column is the last one in the column list of theTable
.- Returns:
- true if it is the last column, false otherwise.
-