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

public Class HtmlExportFormatHandler

extends DataFormatHandler
Class Inheritance
Imports
java.io.IOException, .OutputStream, .OutputStreamWriter, .StringWriter, .Writer, java.nio.charset.Charset, javafx.scene.input.DataFormat, com.sun.jfx.incubator.scene.control.richtext.HtmlStyledOutput, jfx.incubator.scene.control.richtext.StyleResolver, .TextPos

This partial DataFormatHandler supports export of styled text in a simple HTML format.
Since
24

Field Summary

Modifier and TypeField and Description
private static final boolean
INLINE_STYLES

when true, style attributes are inlined, this seems to work better in Thunderbird

private static final HtmlExportFormatHandler

Constructor Summary

AccessConstructor and Description
private
HtmlExportFormatHandler()

The constructor

Method Summary

Modifier and TypeMethod and Description
public Object
copy(StyledTextModel
source model
model
,
StyleResolver
view-specific style resolver
resolver
,
TextPos
start text position
start
,
TextPos
end text position
end
)

Implements abstract jfx.incubator.scene.control.richtext.model.DataFormatHandler.copy.

Creates an object to be put into the Clipboard for the given text range.

public StyledInput
createStyledInput(String
the input string
input
,
StyleAttributeMap
the style attributes (can be null)
attr
)

Implements abstract jfx.incubator.scene.control.richtext.model.DataFormatHandler.createStyledInput.

Creates a StyledInput for the given input string.

private void
export(StyledTextModel model, StyleResolver resolver, TextPos start, TextPos end, Writer wr)

public static final HtmlExportFormatHandler

Returns:

the singleton instance of HtmlExportFormatHandler
getInstance
()

Returns the singleton instance of HtmlExportFormatHandler.

public void
save(StyledTextModel
source model
model
,
StyleResolver
view-specific style resolver
resolver
,
TextPos
start text position
start
,
TextPos
end text position
end
,
OutputStream
target OutputStream
out
)

Implements abstract jfx.incubator.scene.control.richtext.model.DataFormatHandler.save.

Save the text range in the handler's format to the output stream (e.g. save to file).

Inherited from jfx.incubator.scene.control.richtext.model.DataFormatHandler:
getDataFormat

Field Detail

INLINE_STYLESback to summary
private static final boolean INLINE_STYLES

when true, style attributes are inlined, this seems to work better in Thunderbird

instanceback to summary
private static final HtmlExportFormatHandler instance

Constructor Detail

HtmlExportFormatHandlerback to summary
private HtmlExportFormatHandler()

The constructor

Method Detail

copyback to summary
public Object copy(StyledTextModel model, StyleResolver resolver, TextPos start, TextPos end) throws IOException

Implements abstract jfx.incubator.scene.control.richtext.model.DataFormatHandler.copy.

Doc from jfx.incubator.scene.control.richtext.model.DataFormatHandler.copy.

Creates 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.

Parameters
model:StyledTextModel

source model

resolver:StyleResolver

view-specific style resolver

start:TextPos

start text position

end:TextPos

end text position

Returns:Object

an object to be placed to the Clipboard

Annotations
@Override
Exceptions
IOException:
when an I/O error occurs
createStyledInputback to summary
public StyledInput createStyledInput(String input, StyleAttributeMap attr)

Implements abstract jfx.incubator.scene.control.richtext.model.DataFormatHandler.createStyledInput.

Doc from jfx.incubator.scene.control.richtext.model.DataFormatHandler.createStyledInput.

Creates 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).

Parameters
input:String

the input string

attr:StyleAttributeMap

the style attributes (can be null)

Returns:StyledInput

the StyledInput

Annotations
@Override
exportback to summary
private void export(StyledTextModel model, StyleResolver resolver, TextPos start, TextPos end, Writer wr) throws IOException
getInstanceback to summary
public static final HtmlExportFormatHandler getInstance()

Returns the singleton instance of HtmlExportFormatHandler.

Returns:HtmlExportFormatHandler

the singleton instance of HtmlExportFormatHandler

saveback to summary
public void save(StyledTextModel model, StyleResolver resolver, TextPos start, TextPos end, OutputStream out) throws IOException

Implements abstract jfx.incubator.scene.control.richtext.model.DataFormatHandler.save.

Doc from jfx.incubator.scene.control.richtext.model.DataFormatHandler.save.

Save 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.

Parameters
model:StyledTextModel

source model

resolver:StyleResolver

view-specific style resolver

start:TextPos

start text position

end:TextPos

end text position

out:OutputStream

target OutputStream

Annotations
@Override
Exceptions
IOException:
when an I/O error occurs