Class TableRows

All Implemented Interfaces:
Serializable, Cloneable, Iterable<Tr>, Collection<Tr>, List<Tr>, RandomAccess, SequencedCollection<Tr>

public class TableRows extends ArrayList<Tr>
A specialized collection for managing HTML table row elements.

This class extends ArrayList to provide type-safe storage and manipulation of Tr (table row) objects. It serves as a convenient container for managing collections of table rows, offering all the functionality of an ArrayList while ensuring type safety for table row operations. This is particularly useful when programmatically generating table content or managing dynamic table structures.

Features:

  • Type-safe collection specifically for Tr objects
  • Inherits all ArrayList functionality (add, remove, iterate, etc.)
  • Provides convenient storage for groups of table rows
  • Useful for programmatic table generation and manipulation
  • Simplifies batch operations on multiple rows
  • Facilitates table structure management in complex scenarios

Usage:


 // Create a collection of table rows
 TableRows rows = new TableRows();

 // Add rows to the collection
 Tr row1 = new Tr();
 row1.addElement(new Td("Row 1, Cell 1"));
 row1.addElement(new Td("Row 1, Cell 2"));
 rows.add(row1);

 Tr row2 = new Tr();
 row2.addElement(new Td("Row 2, Cell 1"));
 row2.addElement(new Td("Row 2, Cell 2"));
 rows.add(row2);

 // Iterate over rows
 for (Tr row : rows) {
     row.setBackgroundColor("#f9f9f9");
 }

 // Use in table body construction
 Tbody tbody = new Tbody();
 for (Tr row : rows) {
     tbody.addElement(row);
 }
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • TableRows

      public TableRows()