Class ImageFormatHandler
java.lang.Object
jfx.incubator.scene.control.richtext.model.DataFormatHandler
jfx.incubator.scene.control.richtext.model.ImageFormatHandler
Facilitates importing of images into the RichTextModel.
The image is imported via lossless compression (PNG).
- Since:
- 28
-
Method Summary
Modifier and TypeMethodDescriptioncopy(StyledTextModel m, StyleResolver r, TextPos start, TextPos end) Creates an object to be put into the Clipboard for the given text range.createStyledInput(Object input, StyleAttributeMap attr) Creates a StyledInput for the given input data.static final ImageFormatHandlerReturns the singleton instance ofImageFormatHandler.voidsave(StyledTextModel m, StyleResolver r, TextPos start, TextPos end, OutputStream out) Save the text range in the handler's format to the output stream (e.g.Methods declared in class DataFormatHandler
getDataFormat
-
Method Details
-
getInstance
Returns the singleton instance ofImageFormatHandler.- Returns:
- the singleton instance of
ImageFormatHandler
-
createStyledInput
Creates a StyledInput for the given input data. When pasting, the caller may pass the style attributesattrat 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).The type of
inputmust beImage.- Specified by:
createStyledInputin classDataFormatHandler- Parameters:
input- the input data, never nullattr- 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 m, StyleResolver r, 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 thestartprecedes theendposition.Typically, the implementation creates an instance of
StyledOutputand callsStyledTextModel.export(TextPos, TextPos, StyledOutput)method.- Specified by:
copyin classDataFormatHandler- Parameters:
m- source modelr- view-specific style resolverstart- start text positionend- 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 m, StyleResolver r, 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 thestartprecedes theendposition. It is the responsibility of the caller to close theOutputStream.Typically, the implementation creates an instance of
StyledOutputand callsStyledTextModel.export(TextPos, TextPos, StyledOutput)method.- Specified by:
savein classDataFormatHandler- Parameters:
m- source modelr- view-specific style resolverstart- start text positionend- end text positionout- targetOutputStream- Throws:
IOException- when an I/O error occurs
-