Interface TextDepictContext

All Superinterfaces:
DepictContext, com.globalmentor.beans.PropertyBindable
All Known Subinterfaces:
WebDepictContext, XHTMLDepictContext, XMLDepictContext
All Known Implementing Classes:
AbstractTextDepictContext, AbstractWebDepictContext, AbstractXHTMLDepictContext, AbstractXMLDepictContext, HTTPServletWebDepictContext

public interface TextDepictContext extends DepictContext
Encapsulation of text information related to the current depiction. Text is collected in a StringBuilder until it is ready to be depicted. The text writing methods are preferred over retrieving the string builder, as these methods encode information as necessary.
Author:
Garret Wilson
  • Method Details

    • getDepictStringBuilder

      StringBuilder getDepictStringBuilder()
      The string builder that holds the current content being collected, though not necessarily all the content collected. The string builder returned is appropriate for adding content, but may not be a complete representation of all the text collected.
      Returns:
      The string builder that holds the current content being collected for depiction.
    • clearDepictText

      void clearDepictText()
      Clears all data collected for depiction.
    • getDepictText

      String getDepictText()
      Returns:
      The string that holds the current content being collected for depiction.
    • isFormatted

      boolean isFormatted()
      Returns:
      Whether output should be formatted. This version returns true.
    • getIndentLevel

      int getIndentLevel()
      Returns:
      The zero-based level of text indentation.
    • setIndentLevel

      void setIndentLevel(int newIndentLevel)
      Sets the level of text indentation.
      Parameters:
      newIndentLevel - The new zero-based level of text indention.
    • indent

      void indent(int indentDelta)
      Changes the indent level by the given amount.
      Parameters:
      indentDelta - The amount by which to increase or decrease the indent level.
      See Also:
    • indent

      void indent()
      Increments the indent level.
      See Also:
    • unindent

      void unindent()
      Decrements the indent level.
      See Also:
    • getOutputCharset

      Charset getOutputCharset()
      Returns:
      The charset currently used for the text output.
    • getOutputContentType

      com.globalmentor.net.MediaType getOutputContentType()
      Returns:
      The current content type of the text output.
    • setOutputContentType

      void setOutputContentType(com.globalmentor.net.MediaType contentType)
      Sets the content type of the text output.
      Parameters:
      contentType - The content type of the text output.
    • writeLiteral

      void writeLiteral(String text) throws IOException
      Writes literal text with no encoding. All writing by the controller should use this method.
      Parameters:
      text - The literal text to write.
      Throws:
      IOException - if there is an error writing the information.
    • write

      void write(char character) throws IOException
      Writes a character, encoding it as necessary. This method calls writeLiteral(String).
      Parameters:
      character - The character to write.
      Throws:
      IOException - if there is an error writing the information.
    • write

      void write(String text) throws IOException
      Writes text, encoding it as necessary. This method calls writeLiteral(String).
      Parameters:
      text - The text to write.
      Throws:
      IOException - if there is an error writing the information.
    • writeIndent

      void writeIndent() throws IOException
      Writes an indention at the current indention level. If the context is not formatted, no action occurs.
      Throws:
      IOException - if there is an error writing the information.
      See Also: