Spec-Zone.ru › OpenJavaFX 24

Interface BasicTextModel.Content

All Known Implementing Classes:
BasicTextModel.InMemoryContent
Enclosing class:
BasicTextModel
public static interface BasicTextModel.Content
This interface describes the underlying storage mechanism for the BasicTextModel.
Since:
24

Method Summary

Modifier and Type Method Description
String getText(int index)
Returns the text string for the specified paragraph index.
void insertLineBreak(int index, int offset)
Inserts a line break.
int insertTextSegment(int index, int offset, String text, StyleAttributeMap attrs)
This method is called to insert a single text segment at the given position.
boolean isWritable()
Determines whether this content is writable (i.e.
void removeRange(TextPos start, TextPos end)
Removes the specified range.
int size()
Returns the number of paragraphs in this content.

Method Details

size

int size()
Returns the number of paragraphs in this content.
Returns:
the number paragraphs

getText

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.
Parameters:
index - the paragraph index in the range (0...size())
Returns:
the text string or null

insertTextSegment

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 BasicTextModel guarantees that this method is only called when the content is writable.
Parameters:
index - the paragraph index
offset - the insertion offset within the paragraph
text - the text to insert
attrs - the style attributes
Returns:
the number of characters inserted

insertLineBreak

void insertLineBreak(int index, int offset)
Inserts a line break. The BasicTextModel guarantees that this method is only called when the content is writable.
Parameters:
index - the model index
offset - the text offset

removeRange

void removeRange(TextPos start, TextPos end)
Removes the specified range. The BasicTextModel guarantees that this method is only called when the content is writable, and that start precedes end.
Parameters:
start - the start of the region to be removed
end - the end of the region to be removed, expected to be greater than the start position

isWritable

boolean isWritable()
Determines whether this content is writable (i.e. supports modification).
Returns:
true if writable

Report a bug or suggest an enhancement
Copyright © 2008, 2025, Oracle and/or its affiliates. All rights reserved.

© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API