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

public abstract Class DataFormatHandler

extends Object
Class Inheritance
Known Direct Subclasses
jfx.incubator.scene.control.richtext.model.FileListFormatHandler, jfx.incubator.scene.control.richtext.model.HtmlExportFormatHandler, jfx.incubator.scene.control.richtext.model.PlainTextFormatHandler, jfx.incubator.scene.control.richtext.model.RichTextFormatHandler, jfx.incubator.scene.control.richtext.model.RtfFormatHandler
Imports
java.io.IOException, .OutputStream, javafx.scene.input.DataFormat, jfx.incubator.scene.control.richtext.StyleResolver, .TextPos

Facilitates import/export of styled text into/from a StyledTextModel.
Since
24

Field Summary

Modifier and TypeField and Description
private final DataFormat

Constructor Summary

AccessConstructor and Description
public
DataFormatHandler(DataFormat
data format
f
)

Creates a DataHandler instance for the specified format.

Method Summary

Modifier and TypeMethod and Description
public abstract Object

Returns:

an object to be placed to the Clipboard
copy
(StyledTextModel
source model
model
,
StyleResolver
view-specific style resolver
resolver
,
TextPos
start text position
start
,
TextPos
end text position
end
)

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

public abstract StyledInput

Returns:

the StyledInput
createStyledInput
(Object
the input data, never null
input
,
StyleAttributeMap
the style attributes (can be null)
attr
)

Creates a StyledInput for the given input data.

public final DataFormat

Returns:

the data format
getDataFormat
()

Returns the DataFormat associated with this handler.

public abstract 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
)

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

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

formatback to summary
private final DataFormat format

Constructor Detail

DataFormatHandlerback to summary
public DataFormatHandler(DataFormat f)

Creates a DataHandler instance for the specified format.

Parameters
f:DataFormat

data format

Method Detail

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

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

Exceptions
IOException:
when an I/O error occurs
UnsupportedOperationException:
if the copy operation is not supported
createStyledInputback to summary
public abstract StyledInput createStyledInput(Object input, StyleAttributeMap attr) throws IOException

Creates a StyledInput for the given input data. 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:Object

the input data, never null

attr:StyleAttributeMap

the style attributes (can be null)

Returns:StyledInput

the StyledInput

Exceptions
IOException:
when operation is not supported or an I/O error occurs
UnsupportedOperationException:
if the copy operation is not supported
ClassCastException:
if the input data type is not supported by the handler
Since
27
getDataFormatback to summary
public final DataFormat getDataFormat()

Returns the DataFormat associated with this handler.

Returns:DataFormat

the data format

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

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

Exceptions
IOException:
when an I/O error occurs
UnsupportedOperationException:
if the copy operation is not supported