com.guiseframework.platform
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 Summary
 void clearDepictText()
          Clears all data collected for depiction.
 java.lang.StringBuilder getDepictStringBuilder()
          The string builder that holds the current content being collected, though not necessarily all the content collected.
 java.lang.String getDepictText()
           
 int getIndentLevel()
           
 com.globalmentor.text.CharacterEncoding getOutputCharacterEncoding()
           
 com.globalmentor.net.ContentType getOutputContentType()
           
 void indent()
          Increments the indent level.
 void indent(int indentDelta)
          Changes the indent level by the given amount.
 boolean isFormatted()
           
 void setIndentLevel(int newIndentLevel)
          Sets the level of text indentation.
 void setOutputContentType(com.globalmentor.net.ContentType contentType)
          Sets the content type of the text output.
 void unindent()
          Decrements the indent level.
 void write(char character)
          Writes a character, encoding it as necessary.
 void write(java.lang.String text)
          Writes text, encoding it as necessary.
 void writeIndent()
          Writes an indention at the current indention level.
 void writeLiteral(java.lang.String text)
          Writes literal text with no encoding.
 
Methods inherited from interface com.guiseframework.platform.DepictContext
getDepictionURI, getDepictionURI, getDepictionURI, getDestination, getPlatform, getSession, getStyles
 
Methods inherited from interface com.globalmentor.beans.PropertyBindable
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
 

Method Detail

getDepictStringBuilder

java.lang.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

java.lang.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:
getIndentLevel(), setIndentLevel(int)

indent

void indent()
Increments the indent level.

See Also:
indent(int)

unindent

void unindent()
Decrements the indent level.

See Also:
indent(int)

getOutputCharacterEncoding

com.globalmentor.text.CharacterEncoding getOutputCharacterEncoding()
Returns:
The character encoding currently used for the text output.

getOutputContentType

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

setOutputContentType

void setOutputContentType(com.globalmentor.net.ContentType contentType)
Sets the content type of the text output.

Parameters:
contentType - The content type of the text output.

writeLiteral

void writeLiteral(java.lang.String text)
                  throws java.io.IOException
Writes literal text with no encoding. All writing by the controller should use this method.

Parameters:
text - The literal text to write.
Throws:
java.io.IOException - if there is an error writing the information.

write

void write(char character)
           throws java.io.IOException
Writes a character, encoding it as necessary. This method calls writeLiteral(String).

Parameters:
character - The character to write.
Throws:
java.io.IOException - if there is an error writing the information.

write

void write(java.lang.String text)
           throws java.io.IOException
Writes text, encoding it as necessary. This method calls writeLiteral(String).

Parameters:
text - The text to write.
Throws:
java.io.IOException - if there is an error writing the information.

writeIndent

void writeIndent()
                 throws java.io.IOException
Writes an indention at the current indention level. If the context is not formatted, no action occurs.

Throws:
java.io.IOException - if there is an error writing the information.
See Also:
isFormatted(), getIndentLevel()


Copyright © 2005-2010 GlobalMentor, Inc. All Rights Reserved.