Class HTMLTable<T>

java.lang.Object
com.amalgamasimulation.desktop.html.HTMLTag
com.amalgamasimulation.desktop.html.tables.HTMLTable<T>
Type Parameters:
T - the type of data in the table
All Implemented Interfaces:
HTMLConvertable
Direct Known Subclasses:
HTMLTableFromUITable

public class HTMLTable<T> extends HTMLTag
The HTMLTable class represents an HTML table that is generated from a list of data values. It extends HTMLTag and provides methods for configuring and rendering tables with custom styles and columns.
Author:
Alexey Glazyrin
  • Field Details

  • Constructor Details

    • HTMLTable

      public HTMLTable(List<T> dataValues)
      Constructs a new HTMLTable instance from a list of data values.
      Parameters:
      dataValues - the list of data values to display in the table
  • Method Details

    • column

      public HTMLTableColumn<T> column(Function<T,String> extractor, String title)
      Adds a column to the table with the specified value extractor and title.
      Parameters:
      extractor - a function to extract the cell value from the data
      title - the title of the column
      Returns:
      the created HTMLTableColumn instance
    • toHTML

      public String toHTML(Set<String> outStrings)
      Converts the table to an HTML string.
      Specified by:
      toHTML in interface HTMLConvertable
      Overrides:
      toHTML in class HTMLTag
      Parameters:
      outStrings - set of unique strings of text content
      Returns:
      the HTML string representation of the table
    • addBody

      protected void addBody()
      Adds table body (rows with data).