Class TextItem

java.lang.Object
com.aquima.interactions.composer.model.Element
com.aquima.interactions.composer.model.TextItem
All Implemented Interfaces:
IElement, ITextItem, ICompositeTextNode, Serializable

public class TextItem extends Element implements ITextItem, ICompositeTextNode
The multilingual text model represents a text node that needs to be displayed in the document or page.
Since:
6.0
Author:
O. Kerpershoek
See Also:
  • Constructor Details

    • TextItem

      public TextItem(String name)
      Construct a text model. this constructor is public to allow test case access.
      Parameters:
      name - The name of the text model, mandatory.
    • TextItem

      public TextItem(TextItem other, boolean duplicateContents)
      Copy constructor.
      Parameters:
      other - The text item that should be used to copy the data from.
      duplicateContents - Boolean indicating if the contents should be duplicated.
  • Method Details

    • 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.
    • addNode

      public void addNode(TextElement element, String languageCode)
      Description copied from interface: ICompositeTextNode
      This method will add the text element to the composite node for a specific language.
      Specified by:
      addNode in interface ICompositeTextNode
      Parameters:
      element - The text element that needs to be added.
      languageCode - The language code for which the element is added.
    • getNodes

      public TextElement[] getNodes(String languageCode)
      This method returns all the text elements from this text model for a specific language.
      Specified by:
      getNodes in interface ITextItem
      Parameters:
      languageCode - The language code to get the nodes for.
      Returns:
      Array containing all the text elements from this text model.
    • equals

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

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

      public String toString()
      Overrides:
      toString in class Object
    • getLanguageCodes

      public String[] getLanguageCodes()
      Description copied from interface: ITextItem
      Returns the set language codes.
      Specified by:
      getLanguageCodes in interface ITextItem
      Returns:
      The language codes, not null.
    • getPlainText

      public String getPlainText(String languageCode, String defaultLanguageCode, IValueFormatter formatter)
      Description copied from interface: ITextItem
      Returns the plain text content of this text item in the given language.
      Specified by:
      getPlainText in interface ITextItem
      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 text item.
    • getPlainText

      public IMultilingualText getPlainText(String defaultLanguageCode, IValueFormatter formatter)
      Description copied from interface: ITextItem
      Returns the plain text content of this text item in all available languages.
      Specified by:
      getPlainText in interface ITextItem
      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 text item