abstract class fwt::RichTextModel

sys::Obj
  fwt::RichTextModel

@Js

Source

RichTextModel models the document and styling of a RichText document.

charCount

abstract Int charCount()

Source

Return the number of characters in the content.

line

abstract Str line(Int lineIndex)

Source

Return the line at the given zero based line index without delimiters.

lineAtOffset

abstract Int lineAtOffset(Int offset)

Source

Return the zero based line index at the given character offset.

lineBackground

virtual Color? lineBackground(Int lineIndex)

Source

Return the color to use for the specified line's background. Normal lineStyling backgrounds only cover the width of the text. However, the lineBackground covers the width of the entire edit area. Return null for no special background.

lineCount

abstract Int lineCount()

Source

Return the number of lines.

lineDelimiter

virtual Str lineDelimiter()

Source

Return the line delimiter that should be used when inserting new lines. The default is "\n".

lineStyling

virtual Obj[]? lineStyling(Int lineIndex)

Source

Return the styled segments for the given zero based line index. The result is a list of Int/RichTextStyle pairs where the Int specifies a zero based char offset of the line using a pattern such as:

[Int, RichTextStyle, Int, RichTextStyle, ...]
modify

abstract Void modify(Int start, Int replaceLen, Str newText)

Source

Replace the text with newText starting at position start for a length of replaceLen. The model implementation must fire the onModify event.

offsetAtLine

abstract Int offsetAtLine(Int lineIndex)

Source

Return the character offset of the first character of the given zero based line index.

onModify

EventListeners onModify()

Source

Callback model generated when the text is modified.

Event id fired:

Event fields:

text

abstract Str text

Source

Get or set the entire text document.

textRange

virtual Str textRange(Int start, Int len)

Source

Returns a string representing the content at the given range. The default implementation of textRange is optimized to assume the backing store is based on lines.