Top Description Constructors Methods
jfx.incubator.scene.control.richtext.model

public abstract Class StyledTextModelViewOnlyBase

extends StyledTextModel
Class Inheritance
Known Direct Subclasses
jfx.incubator.scene.control.richtext.model.SimpleViewOnlyStyledModel
Imports
java.util.function.Supplier, javafx.scene.layout.Region, jfx.incubator.scene.control.richtext.TextPos

The base class for view-only StyledTextModels.

Models extending this class will not be user editable.

Since
24

Constructor Summary

AccessConstructor and Description
public
StyledTextModelViewOnlyBase()

The constructor.

Method Summary

Modifier and TypeMethod and Description
protected final void
applyStyle(int
the paragraph index
ix
,
int
the start offset
start
,
int
the end offset
end
,
StyleAttributeMap
the character attributes
a
,
boolean
determines whether to merge with or overwrite the existing attributes
merge
)

Implements abstract jfx.incubator.scene.control.richtext.model.StyledTextModel.applyStyle.

Applies style to the specified text range within a single paragraph.

protected void
insertLineBreak(int
the model index
index
,
int
the text offset
offset
)

Implements abstract jfx.incubator.scene.control.richtext.model.StyledTextModel.insertLineBreak.

Inserts a line break at the specified position.

protected void
insertParagraph(int
model index
index
,
Supplier<Region>
code that will be used to create a Node instance
generator
)

Implements abstract jfx.incubator.scene.control.richtext.model.StyledTextModel.insertParagraph.

Inserts a paragraph that contains a single Region.

protected int
insertTextSegment(int
the paragraph index
index
,
int
the insertion offset within the paragraph
offset
,
String
the text to insert
text
,
StyleAttributeMap
the style attributes
attrs
)

Implements abstract jfx.incubator.scene.control.richtext.model.StyledTextModel.insertTextSegment.

This method is called to insert a single styled text segment at the given position.

public final boolean

Returns:

always returns false
isWritable
()

Implements abstract jfx.incubator.scene.control.richtext.model.StyledTextModel.isWritable.

Indicates whether the model supports content modifications made via applyStyle(), replace(), undo(), redo() methods.

protected void
removeRange(TextPos
the start of the range to be removed
start
,
TextPos
the end of the range to be removed, expected to be greater than the start position
end
)

Implements abstract jfx.incubator.scene.control.richtext.model.StyledTextModel.removeRange.

Removes the specified text range.

protected final void
setParagraphStyle(int
the paragraph index
ix
,
StyleAttributeMap
the paragraph attributes
a
)

Implements abstract jfx.incubator.scene.control.richtext.model.StyledTextModel.setParagraphStyle.

Replaces the paragraph styles in the specified paragraph.

Inherited from jfx.incubator.scene.control.richtext.model.StyledTextModel:
addListenerapplyStyleclampclearUndoRedoexportexportParagraphfireChangeEventfireStyleChangeEventgetDataFormatHandlergetDocumentEndgetEndOfParagraphTextPosgetMarkergetParagraphgetParagraphLengthgetPlainTextgetStyleAttributeMapgetSupportedAttributesgetSupportedDataFormatsisRedoableisUndoablereadredoredoablePropertyregisterDataFormatHandlerremoveDataFormatHandlerremoveListenerreplacereplacesizeundoundoablePropertywrite

Constructor Detail

StyledTextModelViewOnlyBaseback to summary
public StyledTextModelViewOnlyBase()

The constructor.

Method Detail

applyStyleback to summary
protected final void applyStyle(int ix, int start, int end, StyleAttributeMap a, boolean merge)

Implements abstract jfx.incubator.scene.control.richtext.model.StyledTextModel.applyStyle.

Doc from jfx.incubator.scene.control.richtext.model.StyledTextModel.applyStyle.

Applies style to the specified text range within a single paragraph. The new attributes override any existing attributes. The end argument may exceed the paragraph length, in which case the outcome should be the same as supplying the paragraph length value.

Parameters
ix:int

the paragraph index

start:int

the start offset

end:int

the end offset

a:StyleAttributeMap

the character attributes

merge:boolean

determines whether to merge with or overwrite the existing attributes

Annotations
@Override
insertLineBreakback to summary
protected void insertLineBreak(int index, int offset)

Implements abstract jfx.incubator.scene.control.richtext.model.StyledTextModel.insertLineBreak.

Doc from jfx.incubator.scene.control.richtext.model.StyledTextModel.insertLineBreak.

Inserts a line break at the specified position.

Parameters
index:int

the model index

offset:int

the text offset

Annotations
@Override
insertParagraphback to summary
protected void insertParagraph(int index, Supplier<Region> generator)

Implements abstract jfx.incubator.scene.control.richtext.model.StyledTextModel.insertParagraph.

Doc from jfx.incubator.scene.control.richtext.model.StyledTextModel.insertParagraph.

Inserts a paragraph that contains a single Region.

The model should not cache or otherwise retain references to the created Regions, as they might be requested multiple times during the lifetime of the model, or by different views.

This method allows for embedding Controls that handle user input. In this case, the model should declare necessary properties and provide bidirectional bindings between the properties in the model and the corresponding properties in the control, as well as handle copy, paste, writing to and reading from I/O streams.

Parameters
index:int

model index

generator:Supplier<Region>

code that will be used to create a Node instance

Annotations
@Override
insertTextSegmentback to summary
protected int insertTextSegment(int index, int offset, String text, StyleAttributeMap attrs)

Implements abstract jfx.incubator.scene.control.richtext.model.StyledTextModel.insertTextSegment.

Doc from jfx.incubator.scene.control.richtext.model.StyledTextModel.insertTextSegment.

This method is called to insert a single styled text segment at the given position.

Parameters
index:int

the paragraph index

offset:int

the insertion offset within the paragraph

text:String

the text to insert

attrs:StyleAttributeMap

the style attributes

Returns:int

the number of characters inserted

Annotations
@Override
isWritableback to summary
public final boolean isWritable()

Implements abstract jfx.incubator.scene.control.richtext.model.StyledTextModel.isWritable.

Doc from jfx.incubator.scene.control.richtext.model.StyledTextModel.isWritable.

Indicates whether the model supports content modifications made via applyStyle(), replace(), undo(), redo() methods.

Note that even when this method returns false, the model itself may still update its content and fire the change events as a response, for example, to changes in its backing data storage.

Returns:boolean

always returns false

Annotations
@Override
removeRangeback to summary
protected void removeRange(TextPos start, TextPos end)

Implements abstract jfx.incubator.scene.control.richtext.model.StyledTextModel.removeRange.

Doc from jfx.incubator.scene.control.richtext.model.StyledTextModel.removeRange.

Removes the specified text range. This method gets called only if the model is editable. The caller guarantees that start precedes end.

Parameters
start:TextPos

the start of the range to be removed

end:TextPos

the end of the range to be removed, expected to be greater than the start position

Annotations
@Override
setParagraphStyleback to summary
protected final void setParagraphStyle(int ix, StyleAttributeMap a)

Implements abstract jfx.incubator.scene.control.richtext.model.StyledTextModel.setParagraphStyle.

Doc from jfx.incubator.scene.control.richtext.model.StyledTextModel.setParagraphStyle.

Replaces the paragraph styles in the specified paragraph.

Parameters
ix:int

the paragraph index

a:StyleAttributeMap

the paragraph attributes

Annotations
@Override