Class Tfoot<T extends Tfoot<T>>


public class Tfoot<T extends Tfoot<T>> extends StyledElement<T>
Represents an HTML <tfoot> element for grouping table footer rows.

This class provides functionality to create and manage table footer sections within HTML tables. The tfoot element groups one or more <tr> elements that contain summary, totals, or footer information for a table. This semantic grouping improves table structure, accessibility, and enables independent styling of footer rows. Footer sections can remain visible when scrolling through long tables and are printed at the bottom of each page when tables span multiple pages.

Features:

  • Groups table rows containing footer content
  • Provides semantic structure to HTML tables
  • Enables independent styling of table footer rows
  • Remains visible during scrolling in some browsers
  • Prints at bottom of each page for multi-page tables
  • Extends TableElement for table-specific functionality

Usage:


 // Create a table with footer totals
 Table table = new Table();

 // Add header
 Thead thead = new Thead();
 Tr headerRow = new Tr();
 headerRow.addElement(new Th("Item"));
 headerRow.addElement(new Th("Price"));
 thead.addElement(headerRow);
 table.addElement(thead);

 // Add body
 Tbody tbody = new Tbody();
 Tr row1 = new Tr();
 row1.addElement(new Td("Product A"));
 row1.addElement(new Td("$10"));
 tbody.addElement(row1);
 table.addElement(tbody);

 // Add footer with totals
 Tfoot tfoot = new Tfoot();
 Tr footerRow = new Tr();
 footerRow.addElement(new Td("Total"));
 footerRow.addElement(new Td("$10"));
 tfoot.addElement(footerRow);
 table.addElement(tfoot);
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • Tfoot

      public Tfoot()
      Constructs a Tfoot element.

      Creates a new <tfoot> element that can contain table rows representing footer content for an HTML table.

  • Method Details

    • addRow

      public Tr addRow()
      Creates and adds a new row to this table section.
      Returns:
      The newly created Tr element.
    • addRow

      public void addRow(Tr row)
      Adds an existing row to this table section.
      Parameters:
      row - The Tr element to add.
    • getRow

      public Tr getRow(int index)
      Returns the row at the specified index.
      Parameters:
      index - The zero-based index of the row to retrieve.
      Returns:
      The Tr element at the specified index, or null if the index is out of bounds.
    • getRows

      public TableRows getRows()
      Returns all rows contained in this table section.
      Returns:
      A TableRows collection containing all Tr elements in this section.
    • removeAllRows

      public void removeAllRows()
      Removes all rows from this table section.
    • removeRow

      public void removeRow(int index)
      Removes the row at the specified index.
      Parameters:
      index - The zero-based index of the row to remove.
    • removeRows

      public void removeRows(int start, int end)
      Removes rows in the specified range (inclusive).
      Parameters:
      start - The zero-based index of the first row to remove.
      end - The zero-based index of the last row to remove.
    • registerAddition

      public final void registerAddition()
      Registers an addition to this element by notifying the parent.

      Table sections delegate update registration to their parent table element to ensure proper synchronization of table structure changes.

      Overrides:
      registerAddition in class Element<T extends com.oorian.html.elements.TableElement<T>>
    • registerSubtraction

      public final void registerSubtraction()
      Registers a subtraction from this element by notifying the parent.

      Table sections delegate update registration to their parent table element to ensure proper synchronization of table structure changes.

      Overrides:
      registerSubtraction in class Element<T extends com.oorian.html.elements.TableElement<T>>
    • registerUpdate

      public final void registerUpdate()
      Registers an update to this element by notifying the parent.

      Table sections delegate update registration to their parent table element to ensure proper synchronization of table structure changes.

      Overrides:
      registerUpdate in class Element<T extends com.oorian.html.elements.TableElement<T>>