Class Summary<T extends Summary<T>>


public class Summary<T extends Summary<T>> extends PhrasingContentElement<T>
Represents an HTML <summary> element used as a visible heading for a details disclosure widget.

This class provides functionality to create summary elements that serve as clickable headings for <details> elements. The summary acts as a label or caption that users can click to show or hide the additional content contained within the details element. This creates an interactive disclosure widget commonly used for collapsible content sections, FAQs, and expandable information panels.

Features:

  • Creates clickable disclosure headings for details elements
  • Automatically displays a disclosure triangle/arrow icon
  • Supports text content initialization
  • Enables creation of collapsible content sections
  • Works in conjunction with the <details> element

Usage:


 // Create a collapsible details section
 Details details = new Details();
 Summary summary = new Summary("Click to expand");
 details.addElement(summary);
 details.addElement(new P("This content is hidden by default."));

 // Create FAQ item
 Details faq = new Details();
 faq.addElement(new Summary("What is HTML?"));
 faq.addElement(new P("HTML stands for HyperText Markup Language..."));

 // Empty summary for dynamic content
 Summary heading = new Summary();
 heading.setText("Show more information");
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • Summary

      public Summary()
      Constructs an empty Summary element.

      Creates a new <summary> element with no initial text content. Text can be added later using methods inherited from

      invalid reference
      TextElement
      . This summary should be used as the first child of a <details> element.

    • Summary

      public Summary(String text)
      Constructs a Summary element with the specified text content.

      Creates a new <summary> element containing the provided text, which will serve as the clickable heading for a details disclosure widget.

      Parameters:
      text - the text content to display as the summary heading