Package snap.text
Class SubText
java.lang.Object
snap.props.PropObject
snap.text.TextDoc
snap.text.SubText
- All Implemented Interfaces:
CharSequence
,Cloneable
,PropChange.DoChange
,CharSequenceX
This TextDoc subclass wraps a TextDoc for a character range.
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
protected int
Fields inherited from class snap.text.TextDoc
_defaultLineStyle, _defaultTextStyle, _length, _lines, _parentTextStyle, _propChangeEnabled, _width, Chars_Prop, DefaultTextStyle_Prop, LineStyle_Prop, ParentTextStyle_Prop, Style_Prop, TextModified_Prop
Fields inherited from class snap.props.PropObject
_pcs, EMPTY_OBJECT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addChars
(CharSequence theChars, TextStyle theStyle, int charIndex) Adds characters with attributes to this text at given index.protected TextToken[]
createTokensForTextLine
(TextLine aTextLine) Override to use TextDoc tokenizer.void
dispose()
Called when SubText is no longer needed to remove TextDoc prop listener.int
Returns the end char index.Returns the source URL.int
Returns the start char index.Returns the TextDoc that this SubText references.boolean
Whether this text supports multiple styles (font, color, etc.).void
removeChars
(int startCharIndex, int endCharIndex) Removes characters in given range.void
setDefaultLineStyle
(TextLineStyle aLineStyle) Sets the default line style.void
setDefaultStyle
(TextStyle aStyle) Sets the default style.void
setLineStyle
(TextLineStyle aStyle, int startCharIndex, int endCharIndex) Sets a given style to a given range.void
setLineStyleValue
(String aKey, Object aValue, int startCharIndex, int endCharIndex) Sets a given style to a given range.void
Sets a given style to a given range.void
setStyleValue
(String aKey, Object aValue, int startCharIndex, int endCharIndex) Sets a given attribute to a given value for a given range.void
Save TextDoc text to Source file.Methods inherited from class snap.text.TextDoc
addChars, addDefaultLine, addLine, addTextDoc, charAt, clear, clone, createLine, getAlignX, getDefaultLineStyle, getDefaultStyle, getFontForCharIndex, getLine, getLineCount, getLineForCharIndex, getLineLast, getLineLongest, getLines, getLineStyleForCharIndex, getParentTextStyle, getPrefWidth, getPrefWidth, getRunForCharIndex, getRunForCharRange, getRunLast, getSourceFile, getString, getStyleForCharIndex, getStyleForCharRange, indexOf, isDefaultTextStyleSet, isPropChangeEnabled, isTextModified, isUnderlined, length, newFromSource, readFromSourceURL, removeLine, replaceChars, replaceChars, scaleFonts, setAlignX, setParentTextStyle, setPropChangeEnabled, setSourceURL, setString, setStyleValue, setStyleValue, setStyleValue, setTextModified, setUnderlined, subSequence, toStringProps, updateLines
Methods inherited from class snap.props.PropObject
addDeepChangeListener, addPropChangeListener, addPropChangeListener, firePropChange, firePropChange, firePropChange, getPropDefault, getPropForName, getPropParent, getPropSet, getPropsForArchival, getPropsForArchivalExtra, getPropValue, initProps, isPropDefault, processPropChange, removeDeepChangeListener, removePropChangeListener, removePropChangeListener, setPropValue, toString
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.CharSequence
chars, codePoints, isEmpty, toString
Methods inherited from interface snap.util.CharSequenceX
getIndentLength, getIndentString, getLastChar, indexAfterNewline, indexOfNewline, isAfterLineEnd, isLastCharNewline, isLineEnd, isLineEndChar, isWhiteSpace, lastIndexAfterNewline, lastIndexOfNewline, startsWith
-
Field Details
-
_startCharIndexInDoc
protected int _startCharIndexInDoc -
_endCharIndexInDoc
protected int _endCharIndexInDoc
-
-
Constructor Details
-
SubText
Constructor.
-
-
Method Details
-
getTextDoc
Returns the TextDoc that this SubText references. -
getStartCharIndex
public int getStartCharIndex()Returns the start char index.- Overrides:
getStartCharIndex
in classTextDoc
-
getEndCharIndex
public int getEndCharIndex()Returns the end char index. -
isRichText
public boolean isRichText()Whether this text supports multiple styles (font, color, etc.).- Overrides:
isRichText
in classTextDoc
-
getSourceURL
Returns the source URL.- Overrides:
getSourceURL
in classTextDoc
-
setDefaultStyle
Sets the default style.- Overrides:
setDefaultStyle
in classTextDoc
-
setDefaultLineStyle
Sets the default line style.- Overrides:
setDefaultLineStyle
in classTextDoc
-
addChars
Adds characters with attributes to this text at given index. -
removeChars
public void removeChars(int startCharIndex, int endCharIndex) Removes characters in given range.- Overrides:
removeChars
in classTextDoc
-
setStyle
Sets a given style to a given range. -
setStyleValue
Sets a given attribute to a given value for a given range.- Overrides:
setStyleValue
in classTextDoc
-
setLineStyle
Sets a given style to a given range.- Overrides:
setLineStyle
in classTextDoc
-
setLineStyleValue
Sets a given style to a given range.- Overrides:
setLineStyleValue
in classTextDoc
-
writeToSourceFile
Save TextDoc text to Source file.- Overrides:
writeToSourceFile
in classTextDoc
- Throws:
Exception
-
createTokensForTextLine
Override to use TextDoc tokenizer.- Overrides:
createTokensForTextLine
in classTextDoc
-
dispose
public void dispose()Called when SubText is no longer needed to remove TextDoc prop listener.
-