Class ListItem<T extends ListItem<T>>


public class ListItem<T extends ListItem<T>> extends Li<T>
Represents an HTML list item, extending the <li> element.

The ListItem class is a convenience wrapper around the Li element, providing a more descriptive class name for creating list items. It inherits all functionality from the Li class while offering semantic clarity in code that uses explicit naming conventions.

Features:

  • Alternative, more descriptive name for the Li element
  • Creates items for ordered and unordered lists
  • Supports text content, HTML elements, or both
  • Inherits all list item attributes and methods

Usage:


 // Create a simple list item
 ListItem item = new ListItem("Item text");

 // Create list item with an element
 ListItem linkItem = new ListItem(new Hyperlink("/page", "Click here"));

 // Add to a list
 Ul list = new Ul();
 list.addListItem(new ListItem("First item"));
 list.addListItem(new ListItem("Second item"));
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • ListItem

      public ListItem()
      Constructs an empty <li> element.

      Creates a list item without initial content. Content can be added later using inherited methods from the Li class.

    • ListItem

      public ListItem(Element element)
      Constructs a <li> element containing the specified HTML element.
      Parameters:
      element - the HTML element to place inside the list item
    • ListItem

      public ListItem(String text)
      Constructs a <li> element with the specified text content.
      Parameters:
      text - the text content for the list item; may be null or empty