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 Details

    • AbstractTableColumn

      public AbstractTableColumn​(Table table, String title)
      Creates a column with a specific title.
      Parameters:
      table - The table that the column belongs to.
      title - The column title.
    • AbstractTableColumn

      public AbstractTableColumn​(String title, String subTitle)
      Creates a column with a specific title and sub-title.
      Parameters:
      title - The column title.
      subTitle - The column sub-title.
    • AbstractTableColumn

      public AbstractTableColumn​(Table table, String title, String subTitle)
      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

      public String getTitle()
      Specified by:
      getTitle in interface TableColumn
      Returns:
      The title to be displayed at the top of the column.
    • setTitle

      public AbstractTableColumn setTitle​(String title)
      Specified by:
      setTitle in interface TableColumn
    • getSubTitle

      public String getSubTitle()
      Specified by:
      getSubTitle in interface TableColumn
      Returns:
      The subtitle to be displayed below the title of the column (optional).
    • setSubTitle

      public AbstractTableColumn setSubTitle​(String subTitle)
      Specified by:
      setSubTitle in interface TableColumn
    • getFormat

      public String getFormat()
      Specified by:
      getFormat in interface TableColumn
      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

      public final AbstractTableColumn setFormat​(String format)
      Specified by:
      setFormat in interface TableColumn
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getTable

      public Table getTable()
      Specified by:
      getTable in interface TableColumn
      Returns:
      The table that the column belongs to.
    • setTable

      public AbstractTableColumn setTable​(Table table)
      Specified by:
      setTable in interface TableColumn
    • generateData

      public String generateData​(Object data)
      Generates the string that represents the data of the column, formatted according to the format.
      Specified by:
      generateData in interface TableColumn
      Parameters:
      data - The data of the column to be formatted
      Returns:
      a string containing the formatted column data
    • generateHeader

      protected abstract String generateHeader​(String str)
      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

      public 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 interface TableColumn
      Returns:
      the generated header string
    • generateSubtitleHeader

      public 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 interface TableColumn
      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 the Table.
      Returns:
      true if it is the last column, false otherwise.