Package snap.text
Class TextModelUtils
java.lang.Object
snap.text.TextModelUtils
Utility methods to support TextModel.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A property change event for addChars/removeChars.static class
A property change event for TextModel.Style change.static class
A property change event for TextModel.Style change.protected static class
This class synchronizes a TextModel with its source file. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TextToken[]
createTokensForTextLine
(TextLine aTextLine) Returns the tokens.static void
fromXML
(TextModel textModel, XMLArchiver anArchiver, XMLElement anElement) XML unarchival.static Shape
getPathForCharRange
(TextModel textModel, int aStartCharIndex, int aEndCharIndex) Returns a path for two char indexes - it will be a simple box with extensions for first/last lines.static TextRun[]
getUnderlineRuns
(TextModel textModel, Rect aRect) Returns underlined runs for text.static void
paintTextModelUnderlines
(Painter aPntr, TextModel textModel, Rect clipRect) Paints text underlines with given painter.static void
Sets the Mouse Y for given text model to assist in caret placement (can be ambiguous for start/end of line).static TextSel
smartFindFormatRange
(TextModel textModel, int selStart, int selEnd) This method returns the range of the @-sign delinated key closest to the current selection (or null if not found).static XMLElement
toXML
(TextModel textModel, XMLArchiver anArchiver) XML archival.
-
Constructor Details
-
TextModelUtils
public TextModelUtils()
-
-
Method Details
-
getPathForCharRange
public static Shape getPathForCharRange(TextModel textModel, int aStartCharIndex, int aEndCharIndex) Returns a path for two char indexes - it will be a simple box with extensions for first/last lines. -
getUnderlineRuns
Returns underlined runs for text. -
paintTextModelUnderlines
Paints text underlines with given painter. -
createTokensForTextLine
Returns the tokens. -
setMouseY
Sets the Mouse Y for given text model to assist in caret placement (can be ambiguous for start/end of line). -
smartFindFormatRange
This method returns the range of the @-sign delinated key closest to the current selection (or null if not found). -
toXML
XML archival. -
fromXML
XML unarchival.
-