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
-
Field Summary
Fields inherited from class com.globalmentor.beans.BoundPropertyObject
NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS
-
Constructor Summary
ConstructorDescriptionAbstractTextDepictContext
(GuiseSession session, Destination destination) Guise session constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears all data collected for depiction.protected String
Encodes text information for writing.The string builder that holds the current content being collected, though not necessarily all the content collected.int
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
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 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 Details
-
AbstractTextDepictContext
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:
NullPointerException
- if the given session and/or destination is null.IOException
- If there was an I/O error loading a needed resource.
-
-
Method Details
-
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
- 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:
-
indent
public void indent()Description copied from interface:TextDepictContext
Increments the indent level.- Specified by:
indent
in interfaceTextDepictContext
- See Also:
-
unindent
public void unindent()Description copied from interface:TextDepictContext
Decrements the indent level.- Specified by:
unindent
in interfaceTextDepictContext
- See Also:
-
writeLiteral
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:
IOException
- if there is an error writing the information.
-
write
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:
IOException
- if there is an error writing the information.
-
write
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:
IOException
- if there is an error writing the information.
-
encode
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
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:
IOException
- if there is an error writing the information.- See Also:
-