Class Table

java.lang.Object
io.mindspice.simplypages.core.HtmlTag
io.mindspice.simplypages.components.display.Table
All Implemented Interfaces:
Component

public class Table extends HtmlTag
Stateful table builder with explicit header/body sections.

Mutable and not thread-safe. Header/cell rows are appended to this instance and rendered in insertion order. For reuse, stop mutating shared instances and render stable structures with per-request context data.

  • Constructor Details

    • Table

      public Table()
      Creates a table with preattached thead > tr and tbody.
  • Method Details

    • create

      public static Table create()
      Creates a new table.
      Returns:
      new table
    • withHeaders

      public Table withHeaders(String... headerLabels)
      Appends header cells to the existing header row.

      This method appends and does not clear prior headers.

      Parameters:
      headerLabels - header text values
      Returns:
      this table
    • addRow

      public Table addRow(String... cellValues)
      Appends a row with text cells.
      Parameters:
      cellValues - text cell values
      Returns:
      this table
    • addRow

      public Table addRow(Component... cellComponents)
      Appends a row with component cells.
      Parameters:
      cellComponents - cell components
      Returns:
      this table
    • addRow

      public Table addRow(Table.Row row)
      Appends a prebuilt row.
      Parameters:
      row - row instance
      Returns:
      this table
    • striped

      public Table striped()
      Appends table-striped class.
      Returns:
      this table
    • bordered

      public Table bordered()
      Appends table-bordered class.
      Returns:
      this table
    • hoverable

      public Table hoverable()
      Appends table-hover class.
      Returns:
      this table
    • withClass

      public Table withClass(String className)
      Appends class token(s).
      Overrides:
      withClass in class HtmlTag
      Parameters:
      className - class token(s)
      Returns:
      this table