This class provides no styling. Subclasses might override getParagraph(int) to provide
syntax highlighting based on the model content.
This model supports custom content storage mechanism via BasicTextModel.. By default,
the model provides an in-memory storage via its BasicTextModel. implementation.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | BasicTextModel.
This interface describes the underlying storage mechanism for the BasicTextModel. |
| public static class | BasicTextModel.
This content provides in-memory storage in an |
| Modifier and Type | Field and Description |
|---|---|
| private final BasicTextModel. |
| Access | Constructor and Description |
|---|---|
| public | BasicTextModel(BasicTextModel.
the content to use cConstructs an empty model with the specified |
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected final void | applyStyle(int index, int start, int end, StyleAttributeMap a, boolean merge)
Implements abstract jfx. Applies style to the specified text range within a single paragraph. |
| public RichParagraph | getParagraph(int index)
Implements abstract jfx. Returns a |
| public String | getPlainText(int index)
Implements abstract jfx. Returns the plain text string for the specified paragraph. |
| public StyleAttributeMap | getStyleAttributeMap(StyleResolver resolver, TextPos pos)
Implements abstract jfx. Returns the |
| protected void | insertLineBreak(int index, int offset)
Implements abstract jfx. Inserts a line break at the specified position. |
| protected void | insertParagraph(int index, Supplier<Region> generator)
Implements abstract jfx. Inserts a paragraph that contains a single |
| public void | insertText(TextPos
the insertion position p, String the text to insert text)Inserts text at the specified position. |
| protected int | insertTextSegment(int index, int offset, String text, StyleAttributeMap attrs)
Implements abstract jfx. This method is called to insert a single styled text segment at the given position. |
| public final boolean | Returns: true if the model is writableImplements abstract jfx. Determines whether the model is writable. |
| protected void | removeRange(TextPos start, TextPos end)
Implements abstract jfx. Removes the specified text range. |
| protected final void | setParagraphStyle(int index, StyleAttributeMap a)
Implements abstract jfx. Replaces the paragraph styles in the specified paragraph. |
| public int | size()
Implements abstract jfx. Returns the number of paragraphs in the model. |
| content | back to summary |
|---|---|
| private final BasicTextModel. | |
| BasicTextModel | back to summary |
|---|---|
| public BasicTextModel(BasicTextModel. Constructs an empty model with the specified
| |
| BasicTextModel | back to summary |
|---|---|
| public BasicTextModel() Constructs an empty model with the in-memory | |
| applyStyle | back to summary |
|---|---|
| protected final void applyStyle(int index, int start, int end, StyleAttributeMap a, boolean merge) Implements abstract jfx. Doc from jfx. Applies style to the specified text range within a single paragraph.
The new attributes override any existing attributes.
The
| |
| getParagraph | back to summary |
|---|---|
| public RichParagraph getParagraph(int index) Implements abstract jfx. Doc from jfx. Returns a This method makes no guarantees that the same paragraph instance will be returned for the same model index.
| |
| getPlainText | back to summary |
|---|---|
| public String getPlainText(int index) Implements abstract jfx. Doc from jfx. Returns the plain text string for the specified paragraph. The returned text string cannot be null
and must not contain any control characters other than TAB.
The callers must ensure that the value of
| |
| getStyleAttributeMap | back to summary |
|---|---|
| public StyleAttributeMap getStyleAttributeMap(StyleResolver resolver, TextPos pos) Implements abstract jfx. Doc from jfx. Returns the
| |
| insertLineBreak | back to summary |
|---|---|
| protected void insertLineBreak(int index, int offset) Implements abstract jfx. Doc from jfx. Inserts a line break at the specified position.
| |
| insertParagraph | back to summary |
|---|---|
| protected void insertParagraph(int index, Supplier<Region> generator) Implements abstract jfx. Doc from jfx. Inserts a paragraph that contains a single
The model should not cache or otherwise retain references to the created
This method allows for embedding
| |
| insertText | back to summary |
|---|---|
| public void insertText(TextPos p, String text) Inserts text at the specified position.
This is a convenience shortcut for
| |
| insertTextSegment | back to summary |
|---|---|
| protected int insertTextSegment(int index, int offset, String text, StyleAttributeMap attrs) Implements abstract jfx. Doc from jfx. This method is called to insert a single styled text segment at the given position.
| |
| isWritable | back to summary |
|---|---|
| public final boolean isWritable() Implements abstract jfx. Determines whether the model is writable.
This method calls
| |
| removeRange | back to summary |
|---|---|
| protected void removeRange(TextPos start, TextPos end) Implements abstract jfx. Doc from jfx. Removes the specified text range.
This method gets called only if the model is editable.
The caller guarantees that
| |
| setParagraphStyle | back to summary |
|---|---|
| protected final void setParagraphStyle(int index, StyleAttributeMap a) Implements abstract jfx. Doc from jfx. Replaces the paragraph styles in the specified paragraph.
| |
| size | back to summary |
|---|---|
| public int size() Implements abstract jfx. Doc from jfx. Returns the number of paragraphs in the model.
| |
| Modifier and Type | Method and Description |
|---|---|
| public String | |
| public void | |
| public int | Returns: the number of characters insertedthe paragraph index index, int the insertion offset within the paragraph offset, String the text to insert text, StyleAttributeMap the style attributes attrs)This method is called to insert a single text segment at the given position. |
| public boolean | Returns: true if writableDetermines whether this content is writable (i.e. supports modification). |
| public void | removeRange(TextPos
the start of the region to be removed start, TextPos the end of the region to be removed, expected to be greater than the start position end)Removes the specified range. |
| public int |
| getText | back to summary |
|---|---|
| public String getText(int index) Returns the text string for the specified paragraph index. The returned text string cannot be null and must not contain any control characters other than TAB. The caller should never attempt to ask for a paragraph outside of the valid range. | |
| insertLineBreak | back to summary |
|---|---|
| public void insertLineBreak(int index, int offset) Inserts a line break.
The
| |
| insertTextSegment | back to summary |
|---|---|
| public int insertTextSegment(int index, int offset, String text, StyleAttributeMap attrs) This method is called to insert a single text segment at the given position.
The
| |
| isWritable | back to summary |
|---|---|
| public boolean isWritable() Determines whether this content is writable (i.e. supports modification).
| |
| removeRange | back to summary |
|---|---|
| public void removeRange(TextPos start, TextPos end) Removes the specified range.
The | |
| size | back to summary |
|---|---|
| public int size() Returns the number of paragraphs in this content.
| |
ArrayList of Strings.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public String | getText(int index)
Implements jfx. Returns the text string for the specified paragraph index. |
| public void | insertLineBreak(int index, int offset)
Implements jfx. Inserts a line break. |
| private static String | |
| public int | insertTextSegment(int index, int offset, String text, StyleAttributeMap attrs)
Implements jfx. This method is called to insert a single text segment at the given position. |
| public boolean | isWritable()
Implements jfx. Determines whether this content is writable (i.e. supports modification). |
| public void | removeRange(TextPos start, TextPos end)
Implements jfx. Removes the specified range. |
| private void | |
| public int | size()
Implements jfx. Returns the number of paragraphs in this content. |
| paragraphs | back to summary |
|---|---|
| private final ArrayList<String> paragraphs | |
| InMemoryContent | back to summary |
|---|---|
| public InMemoryContent() The constructor. | |
| getText | back to summary |
|---|---|
| public String getText(int index) Implements jfx. Doc from jfx. Returns the text string for the specified paragraph index. The returned text string cannot be null and must not contain any control characters other than TAB. The caller should never attempt to ask for a paragraph outside of the valid range.
| |
| insertLineBreak | back to summary |
|---|---|
| public void insertLineBreak(int index, int offset) Implements jfx. Doc from jfx. Inserts a line break.
The
| |
| insertText | back to summary |
|---|---|
| private static String insertText(String text, int offset, String toInsert) | |
| insertTextSegment | back to summary |
|---|---|
| public int insertTextSegment(int index, int offset, String text, StyleAttributeMap attrs) Implements jfx. Doc from jfx. This method is called to insert a single text segment at the given position.
The
| |
| isWritable | back to summary |
|---|---|
| public boolean isWritable() Implements jfx. Doc from jfx. Determines whether this content is writable (i.e. supports modification).
| |
| removeRange | back to summary |
|---|---|
| public void removeRange(TextPos start, TextPos end) Implements jfx. Doc from jfx. Removes the specified range.
The
| |
| setText | back to summary |
|---|---|
| private void setText(int index, String text) | |
| size | back to summary |
|---|---|
| public int size() Implements jfx. Doc from jfx. Returns the number of paragraphs in this content.
| |