Class RtfFormatHandler
java.lang.Object
jfx.incubator.scene.control.richtext.model.DataFormatHandler
jfx.incubator.scene.control.richtext.model.RtfFormatHandler
public class RtfFormatHandler extends DataFormatHandler
This
DataFormatHandler provides export/import support for RTF format.- Since:
- 24
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
Object |
copy |
Creates an object to be put into the Clipboard for the given text range. |
StyledInput |
createStyledInput |
Creates a StyledInput for the given input string. |
static final RtfFormatHandler |
getInstance() |
Returns the singleton instance of RtfFormatHandler. |
void |
save |
Save the text range in the handler's format to the output stream (e.g. |
Methods declared in class jfx.incubator.scene.control.richtext.model.DataFormatHandler
getDataFormat
Method Details
getInstance
public static final RtfFormatHandler getInstance()
Returns the singleton instance of
RtfFormatHandler.- Returns:
- the singleton instance of
RtfFormatHandler
createStyledInput
public StyledInput createStyledInput(String text, StyleAttributeMap attr) throws IOException
Description copied from class:
DataFormatHandlerCreates a StyledInput for the given input string. When pasting, the caller may pass the style attributes
attr at the insertion point. This argument may be used by the implementation if the format contains no styles on its own (for example, in the plain text format case).- Specified by:
-
createStyledInputin classDataFormatHandler - Parameters:
-
text- the input string -
attr- the style attributes (can be null) - Returns:
- the StyledInput
- Throws:
-
IOException- when operation is not supported or an I/O error occurs
copy
public Object copy(StyledTextModel model, StyleResolver resolver, TextPos start, TextPos end) throws IOException
Description copied from class:
DataFormatHandlerCreates an object to be put into the Clipboard for the given text range. The caller must guarantee that the
start precedes the end position. Typically, the implementation creates an instance of StyledOutput and calls StyledTextModel.export(TextPos, TextPos, StyledOutput) method.
- Specified by:
-
copyin classDataFormatHandler - Parameters:
-
model- source model -
resolver- view-specific style resolver -
start- start text position -
end- end text position - Returns:
- an object to be placed to the Clipboard
- Throws:
-
IOException- when an I/O error occurs
save
public void save(StyledTextModel model, StyleResolver resolver, TextPos start, TextPos end, OutputStream out) throws IOException
Description copied from class:
DataFormatHandlerSave the text range in the handler's format to the output stream (e.g. save to file). The caller must guarantee that the
start precedes the end position. It is the responsibility of the caller to close the OutputStream. Typically, the implementation creates an instance of StyledOutput and calls StyledTextModel.export(TextPos, TextPos, StyledOutput) method.
- Specified by:
-
savein classDataFormatHandler - Parameters:
-
model- source model -
resolver- view-specific style resolver -
start- start text position -
end- end text position -
out- targetOutputStream - Throws:
-
IOException- when an I/O error occurs
© 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.