Class ContentItem

All Implemented Interfaces:
ICompositeElement, IContentItem, IElement, Serializable

public class ContentItem extends CompositeElement implements IContentItem
The content model represents a content node that needs to be displayed in the document.
Since:
6.0
Author:
O. Kerpershoek
See Also:
  • Constructor Details

    • ContentItem

      public ContentItem(String name, String description, ContentStyle contentStyle, PresentationStyle[] presentationStyles)
      Constructs a content item with a name, contentStyle and presentation style. this constructor is public to allow test case access.
      Parameters:
      name - The name of the content item.
      description - The optional description of the content item.
      contentStyle - The content style of the content item (may be null)
      presentationStyles - The presentation styles of the content item.
    • ContentItem

      public ContentItem(String name, String description, ContentStyle contentStyle, Element[] elements)
      Constructs a content item with a name, contentStyle and content. this constructor is public to allow test case access.
      Parameters:
      name - The name of the content item.
      description - The optional display name of the content item.
      contentStyle - The content style of the content item.
      elements - The content of the content item (may be null)
    • ContentItem

      protected ContentItem(ContentItem other, boolean duplicateContents)
  • Method Details

    • getDescription

      public String getDescription()
      Description copied from interface: IContentItem
      This method returns the description of the content item.
      Specified by:
      getDescription in interface IContentItem
      Returns:
      the description of the content item, may be null.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class CompositeElement
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class CompositeElement
    • toString

      public String toString()
      Overrides:
      toString in class CompositeElement
    • duplicate

      public Element duplicate()
      Description copied from interface: IElement
      This method should clone the element and return the cloned element. The duplicate method should usually make a deep copy of the element, with the exception of members that are not mutable (and thus can safely be shared between multiple copies). The properties of an element are considered to be non-mutable, and will thus by default be copied.
      Specified by:
      duplicate in interface IElement
      Returns:
      The cloned (duplicate) element.
    • getLanguageCodes

      public String[] getLanguageCodes()
      Description copied from interface: IContentItem
      Returns the language codes used in this content item.
      Specified by:
      getLanguageCodes in interface IContentItem
      Returns:
      array with unique language codes, may be empty but never null.
    • getPlainText

      public String getPlainText(String languageCode, String defaultLanguageCode, IValueFormatter formatter)
      Description copied from interface: IContentItem
      Returns the plain text content of this content item in the given language.
      Specified by:
      getPlainText in interface IContentItem
      Parameters:
      languageCode - the language in which the plain text should be returned (not null)
      defaultLanguageCode - the default language to use (not null)
      formatter - the formatter used to format value nodes (not null)
      Returns:
      the plain text of this content item.
    • getPlainText

      public IMultilingualText getPlainText(String defaultLanguageCode, IValueFormatter formatter)
      Description copied from interface: IContentItem
      Returns the plain text content of this content item in all available languages.
      Specified by:
      getPlainText in interface IContentItem
      Parameters:
      defaultLanguageCode - the default language to use (not null)
      formatter - the formatter used to format value nodes (not null)
      Returns:
      the plain text of this content item