Package io.guise.framework.platform
Class AbstractTextDepictContext
- java.lang.Object
-
- com.globalmentor.beans.BoundPropertyObject
-
- io.guise.framework.platform.AbstractDepictContext
-
- io.guise.framework.platform.AbstractTextDepictContext
-
- All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable
,com.globalmentor.beans.PropertyConstrainable
,DepictContext
,TextDepictContext
- Direct Known Subclasses:
AbstractXMLDepictContext
public abstract class AbstractTextDepictContext extends AbstractDepictContext implements TextDepictContext
Abstract encapsulation of text information related to the current depiction.- Author:
- Garret Wilson
-
-
Constructor Summary
Constructors Constructor Description AbstractTextDepictContext(GuiseSession session, Destination destination)
Guise session constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearDepictText()
Clears all data collected for depiction.protected java.lang.String
encode(java.lang.String string)
Encodes text information for writing.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()
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
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 class io.guise.framework.platform.AbstractDepictContext
getDepictionURI, getDepictionURI, getDestination, getPlatform, getSession, getStyles
-
Methods inherited from class com.globalmentor.beans.BoundPropertyObject
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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
-
Methods inherited from interface io.guise.framework.platform.TextDepictContext
getOutputCharset, getOutputContentType, setOutputContentType
-
-
-
-
Constructor Detail
-
AbstractTextDepictContext
public AbstractTextDepictContext(GuiseSession session, Destination destination) throws java.io.IOException
Guise session constructor.- Parameters:
session
- The Guise user session of which this context is a part.destination
- The destination with which this context is associated.- Throws:
java.lang.NullPointerException
- if the given session and/or destination is null.java.io.IOException
- If there was an I/O error loading a needed resource.
-
-
Method Detail
-
getDepictStringBuilder
public java.lang.StringBuilder getDepictStringBuilder()
Description copied from interface:TextDepictContext
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.- Specified by:
getDepictStringBuilder
in interfaceTextDepictContext
- Returns:
- The string builder that holds the current content being collected for depiction.
-
clearDepictText
public void clearDepictText()
Description copied from interface:TextDepictContext
Clears all data collected for depiction.- Specified by:
clearDepictText
in interfaceTextDepictContext
-
getDepictText
public java.lang.String getDepictText()
- Specified by:
getDepictText
in interfaceTextDepictContext
- Returns:
- The string that holds the current content being collected for depiction.
-
isFormatted
public boolean isFormatted()
This version returns
true
.- Specified by:
isFormatted
in interfaceTextDepictContext
- Returns:
- Whether output should be formatted. This version returns
true
.
-
getIndentLevel
public int getIndentLevel()
- Specified by:
getIndentLevel
in interfaceTextDepictContext
- Returns:
- The zero-based level of text indentation.
-
setIndentLevel
public void setIndentLevel(int newIndentLevel)
Description copied from interface:TextDepictContext
Sets the level of text indentation.- Specified by:
setIndentLevel
in interfaceTextDepictContext
- Parameters:
newIndentLevel
- The new zero-based level of text indention.
-
indent
public void indent(int indentDelta)
Description copied from interface:TextDepictContext
Changes the indent level by the given amount.- Specified by:
indent
in interfaceTextDepictContext
- Parameters:
indentDelta
- The amount by which to increase or decrease the indent level.- See Also:
TextDepictContext.getIndentLevel()
,TextDepictContext.setIndentLevel(int)
-
indent
public void indent()
Description copied from interface:TextDepictContext
Increments the indent level.- Specified by:
indent
in interfaceTextDepictContext
- See Also:
TextDepictContext.indent(int)
-
unindent
public void unindent()
Description copied from interface:TextDepictContext
Decrements the indent level.- Specified by:
unindent
in interfaceTextDepictContext
- See Also:
TextDepictContext.indent(int)
-
writeLiteral
public void writeLiteral(java.lang.String text) throws java.io.IOException
Description copied from interface:TextDepictContext
Writes literal text with no encoding. All writing by the controller should use this method.- Specified by:
writeLiteral
in interfaceTextDepictContext
- Parameters:
text
- The literal text to write.- Throws:
java.io.IOException
- if there is an error writing the information.
-
write
public void write(char character) throws java.io.IOException
Description copied from interface:TextDepictContext
Writes a character, encoding it as necessary. This method callsTextDepictContext.writeLiteral(String)
.- Specified by:
write
in interfaceTextDepictContext
- Parameters:
character
- The character to write.- Throws:
java.io.IOException
- if there is an error writing the information.
-
write
public void write(java.lang.String text) throws java.io.IOException
Description copied from interface:TextDepictContext
Writes text, encoding it as necessary. This method callsTextDepictContext.writeLiteral(String)
.- Specified by:
write
in interfaceTextDepictContext
- Parameters:
text
- The text to write.- Throws:
java.io.IOException
- if there is an error writing the information.
-
encode
protected java.lang.String encode(java.lang.String string)
Encodes text information for writing. This method uses a string parameter so that no processing need occur if no characters need encoded. This version does no processing of the text.- Parameters:
string
- The text information to encode.- Returns:
- The encoded text.
-
writeIndent
public void writeIndent() throws java.io.IOException
Description copied from interface:TextDepictContext
Writes an indention at the current indention level. If the context is not formatted, no action occurs.- Specified by:
writeIndent
in interfaceTextDepictContext
- Throws:
java.io.IOException
- if there is an error writing the information.- See Also:
TextDepictContext.isFormatted()
,TextDepictContext.getIndentLevel()
-
-