Package io.guise.framework.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
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
Modifier and TypeMethodDescriptionvoid
Clears all data collected for depiction.The string builder that holds the current content being collected, though not necessarily all the content collected.int
com.globalmentor.net.MediaType
void
indent()
Increments the indent level.void
indent
(int indentDelta) Changes the indent level by the given amount.boolean
void
setIndentLevel
(int newIndentLevel) Sets the level of text indentation.void
setOutputContentType
(com.globalmentor.net.MediaType 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
Writes text, encoding it as necessary.void
Writes an indention at the current indention level.void
writeLiteral
(String text) Writes literal text with no encoding.Methods inherited from interface io.guise.framework.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 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
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
Writes a character, encoding it as necessary. This method callswriteLiteral(String)
.- Parameters:
character
- The character to write.- Throws:
IOException
- if there is an error writing the information.
-
write
Writes text, encoding it as necessary. This method callswriteLiteral(String)
.- Parameters:
text
- The text to write.- Throws:
IOException
- if there is an error writing the information.
-
writeIndent
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:
-