Class Sequence

All Implemented Interfaces:
ContentLogger, Serializable
Direct Known Subclasses:
List, Paragraph

public class Sequence extends AbstractSequenceContent implements ContentLogger

A sequence is a list of items. Every contained item is rendered one after the other. Usually the contained items are paragraphs or more complex contents.

See Also:
  • Constructor Details

    • Sequence

      public Sequence(String idPrefix, WhiteSpace whiteSpace, Content... initialItems)
      Initialize as a collection with a few starting items added.
      Parameters:
      idPrefix - an optional id prefix
      whiteSpace - the white space specification
      initialItems - initial items that are added to the end of the collection.
    • Sequence

      public Sequence(String idPrefix, Content... initialItems)
      Initialize as a collection with a few starting items added.
      Parameters:
      idPrefix - an optional id prefix
      initialItems - initial items that are added to the end of the collection.
    • Sequence

      public Sequence(Content... initialItems)
      Initialize as a collection with a few starting items added.
      Parameters:
      initialItems - initial items that are added to the end of the collection.
    • Sequence

      public Sequence(WhiteSpace whiteSpace, Content... initialItems)
      Initialize as a collection with a few starting items added.
      Parameters:
      whiteSpace - the white space specification
      initialItems - initial items that are added to the end of the collection.
  • Method Details

    • addItem

      public void addItem(Content item)
      Adds an item to the collection. If the item is excluded by AbstractSequenceContent#excludeGlobally(Content), then the item is not added and ignored.
      Specified by:
      addItem in interface ContentLogger
      Parameters:
      item - to be added
    • clear

      public void clear()
      Discards all items from the collection.
    • size

      public int size()
      Returns:
      number of items in the collection. If the items are complex items by itself, the number of subitems is not counted. The return value simply is the number of direct children of this content node.
    • addItems

      public void addItems(Collection<? extends Content> items)
      Adds several items to the collection by calling addItem(Content) method.
      Parameters:
      items - to be added
    • getNestedContents

      public List<Content> getNestedContents()
      Specified by:
      getNestedContents in class Content
      Returns:
      returns an unmodifiable view of the collection
    • hashCode

      public int hashCode()
      implements the contract of Object.hashCode().
      Overrides:
      hashCode in class Content
      See Also:
    • equals

      public boolean equals(Object obj)
      implements the contract of Object.equals(Object).
      Overrides:
      equals in class Content
    • renderHtmlImpl

      public void renderHtmlImpl(StringBuilder sb, IncludeInfo includeInfo, RenderContext ctx, boolean useJavascript)
      appends all comments in the sequence one after the other without any visual marks between the individual items.
      Specified by:
      renderHtmlImpl in class Content
      Parameters:
      sb - HTML code result
      includeInfo - controls, which content to be rendered.
      ctx - render context
      useJavascript - if true, the generated HTML code will contain Javascript
      See Also:
      • Content#renderHtmlImpl(StringBuilder, IncludeInfo, RenderContext)
    • renderPlainImpl

      public void renderPlainImpl(StringBuilder sb, IncludeInfo includeInfo, RenderContext ctx)
      appends all comments in the sequence one after the other without any visual marks between the individual items.
      Specified by:
      renderPlainImpl in class Content
      Parameters:
      sb - plain text result
      includeInfo - controls, which content to be rendered.
      ctx - render context (unused).
      See Also:
    • formatAsInlineNewlineSeq

      public static Sequence formatAsInlineNewlineSeq(IncludeSpec includeSpec, String msg)