public interface RichTextWriter extends AutoCloseable
Modifier and Type | Interface and Description |
---|---|
static class |
RichTextWriter.CaptionPosition
Enum of available positions to place the caption of a file hotspot
|
Modifier and Type | Method and Description |
---|---|
RichTextWriter |
addAttachmentIcon(Attachment att,
String captionTxt) |
RichTextWriter |
addAttachmentIcon(Attachment att,
String filenameToDisplay,
String captionText,
FontStyle captionStyle,
RichTextWriter.CaptionPosition captionPos,
int captionColorRed,
int captionColorGreen,
int captionColorBlue,
int resizeToWidth,
int resizeToHeight,
Path imagePath) |
RichTextWriter |
addAttachmentIcon(String attachmentProgrammaticName,
String captionTxt) |
RichTextWriter |
addAttachmentIcon(String attachmentProgrammaticName,
String filenameToDisplay,
String captionText,
FontStyle captionStyle,
RichTextWriter.CaptionPosition captionPos,
int captionColorRed,
int captionColorGreen,
int captionColorBlue,
int resizeToWidth,
int resizeToHeight,
InputStream imageData) |
RichTextWriter |
addCollectionLink(DominoCollection collection,
String comment)
This function inserts a DocLink for the specified
DominoCollection . |
RichTextWriter |
addDatabaseLink(Database db,
String comment)
This function inserts a DocLink for the specified
Database . |
RichTextWriter |
addDocLink(Document doc,
String comment)
This function inserts a DocLink for the specified
Document . |
RichTextWriter |
addDocLink(String dbReplicaId,
String viewUnid,
String docUNID,
String comment)
This function inserts a DocLink using manual values.
|
RichTextWriter |
addFileResource(InputStream is,
long length)
Adds the provided stream as a file resource into this rich text writer.
|
default RichTextWriter |
addFileResource(Path file)
Adds the provided file as a file resource into this rich text writer.
|
RichTextWriter |
addImage(InputStream imageStream)
Adds an image from an input stream.
|
RichTextWriter |
addImage(InputStream imageStream,
int resizeToWidth,
int resizeToHeight)
Adds an image from an input stream.
|
RichTextWriter |
addImage(Path imagePath)
Adds an image from disk.
|
RichTextWriter |
addImage(Path imagePath,
int resizeToWidth,
int resizeToHeight)
Adds an image from disk.
|
RichTextWriter |
addImageResource(InputStream is,
long length)
Adds the provided stream as an image resource into this rich text writer.
|
default RichTextWriter |
addImageResource(Path file)
Adds the provided stream as an image resource into this rich text writer.
|
RichTextWriter |
addJavaScriptLibraryData(String script)
Adds the provided script as a JavaScript library block into this rich text writer.
|
RichTextWriter |
addRichText(Document doc,
String itemName)
Appends a rich text item from another document
|
RichTextWriter |
addRichText(RichTextWriter rt)
Appends rich text created in another writer
|
<T extends RichTextRecord<?>> |
addRichTextRecord(Class<T> recordClass,
Consumer<T> processor)
Creates a new rich-text record of the given type and processes it through
the provided function before appending it to the record stream.
|
<T extends RichTextRecord<?>> |
addRichTextRecord(Class<T> recordClass,
int variableDataLength,
Consumer<T> processor)
Creates a new rich-text record of the given type and processes it through
the provided function before appending it to the record stream.
|
<T extends RichTextRecord<?>> |
addRichTextRecord(RecordType recordType,
Consumer<T> processor)
Creates a new rich-text record of the given type and processes it through
the provided function before appending it to the record stream.
|
<T extends RichTextRecord<?>> |
addRichTextRecord(RecordType recordType,
int variableDataLength,
Consumer<T> processor)
Creates a new rich-text record of the given type and processes it through
the provided function before appending it to the record stream.
|
RichTextWriter |
addRichTextRecord(RichTextRecord<?> record)
Adds a raw rich text record from an existing instance.
|
RichTextWriter |
addText(String txt)
Adds a text element
|
RichTextWriter |
addText(String txt,
TextStyle textStyle,
FontStyle fontStyle)
Adds a text element with the specified font style
|
RichTextWriter |
addText(String txt,
TextStyle textStyle,
FontStyle fontStyle,
boolean createParagraphOnLinebreak)
Adds a text element with the specified font style
|
void |
close()
Closes this resource, relinquishing any underlying resources.
|
FontStyle |
createFontStyle()
Creates a new font style
|
<T extends MemoryStructure> |
createStructure(Class<T> structureClass,
int variableDataLength)
Creates a new
MemoryStructure of the given class in memory, without appending it to the
destination rich-text entity. |
TextStyle |
createTextStyle(String styleName)
Creates a new text style
|
void |
discard()
Discard any changes in this writer and free all resources
|
String |
getItemName()
Returns the name of the rich text item
|
Document |
getParentDocument()
Returns the document that will contain the
rich text data
|
boolean |
isEmpty()
Method to check if anything has been written into the writer
|
void close()
try
-with-resources statement.close
in interface AutoCloseable
Document getParentDocument()
String getItemName()
boolean isEmpty()
RichTextWriter addText(String txt)
txt
- textRichTextWriter addText(String txt, TextStyle textStyle, FontStyle fontStyle)
txt
- texttextStyle
- text stylefontStyle
- font styleRichTextWriter addText(String txt, TextStyle textStyle, FontStyle fontStyle, boolean createParagraphOnLinebreak)
txt
- texttextStyle
- text stylefontStyle
- font stylecreateParagraphOnLinebreak
- true to create a paragraph for each linebreak found in the textRichTextWriter addImage(Path imagePath)
imagePath
- image filepathRichTextWriter addImage(Path imagePath, int resizeToWidth, int resizeToHeight)
imagePath
- image filepathresizeToWidth
- if not -1, resize the image to this widthresizeToHeight
- if not -1, resize the image to this widthRichTextWriter addImage(InputStream imageStream)
imageStream
- stream with image dataRichTextWriter addImage(InputStream imageStream, int resizeToWidth, int resizeToHeight)
imageStream
- stream with image dataresizeToWidth
- if not -1, resize the image to this widthresizeToHeight
- if not -1, resize the image to this widthdefault RichTextWriter addImageResource(Path file) throws IOException
Note: this uses the structure of image-resource design elements and differs significantly
from how inline images are handled. Use addImage(Path)
and the
related methods to add images to a UI rich-text field.
file
- the file to write to the rich text bufferIOException
- if there is a problem reading the file dataRichTextWriter addImageResource(InputStream is, long length) throws IOException
If the length of the content is unknown, pass -1
for the length
parameter.
This is inefficient, however, as it will cause the underlying implementation to read the
entire stream at the start instead of as needed.
Note: this uses the structure of image-resource design elements and differs significantly
from how inline images are handled. Use addImage(InputStream)
and the
related methods to add images to a UI rich-text field.
is
- the InputStream
to write to the rich text bufferlength
- the length of the file, if known; -1
otherwiseIOException
- if there is a problem reading the file dataRichTextWriter addDocLink(Document doc, String comment)
Document
.doc
- document to create the linkcomment
- This string appears when the DocLink is selected (clicked on).RichTextWriter addDocLink(String dbReplicaId, String viewUnid, String docUNID, String comment)
dbReplicaId
- Replica ID of the database that contains the document pointed to by the DocLink.viewUnid
- UNID of the DominoCollection
that contains the document pointed to by the DocLink or null/empty string to create a database linkdocUNID
- UNID of the document pointed to by the DocLink or null/empty string to create a view/collection linkcomment
- This string appears when the DocLink is selected (clicked on).RichTextWriter addDatabaseLink(Database db, String comment)
Database
.db
- database to create the linkcomment
- This string appears when the DocLink is selected (clicked on).RichTextWriter addCollectionLink(DominoCollection collection, String comment)
DominoCollection
.collection
- collection to create the linkcomment
- This string appears when the DocLink is selected (clicked on).RichTextWriter addAttachmentIcon(Attachment att, String captionTxt)
RichTextWriter addAttachmentIcon(String attachmentProgrammaticName, String captionTxt)
RichTextWriter addAttachmentIcon(Attachment att, String filenameToDisplay, String captionText, FontStyle captionStyle, RichTextWriter.CaptionPosition captionPos, int captionColorRed, int captionColorGreen, int captionColorBlue, int resizeToWidth, int resizeToHeight, Path imagePath)
RichTextWriter addAttachmentIcon(String attachmentProgrammaticName, String filenameToDisplay, String captionText, FontStyle captionStyle, RichTextWriter.CaptionPosition captionPos, int captionColorRed, int captionColorGreen, int captionColorBlue, int resizeToWidth, int resizeToHeight, InputStream imageData) throws IOException
IOException
default RichTextWriter addFileResource(Path file) throws IOException
Note: this uses the structure of file-resource design elements and differs significantly
from how attachments are handled. Use addAttachmentIcon(Attachment, String)
and the
related methods to add attachments.
file
- the file to write to the rich text bufferIOException
- if there is a problem reading the file dataRichTextWriter addFileResource(InputStream is, long length) throws IOException
If the length of the content is unknown, pass -1
for the length
parameter.
This is inefficient, however, as it will cause the underlying implementation to read the
entire stream at the start instead of as needed.
Note: this uses the structure of file-resource design elements and differs significantly
from how attachments are handled. Use addAttachmentIcon(Attachment, String)
and the
related methods to add attachments to a rich-text field.
is
- the InputStream
to write to the rich text bufferlength
- the length of the file, if known; -1
otherwiseIOException
- if there is a problem reading the file dataRichTextWriter addJavaScriptLibraryData(String script)
Note: this users the structure of script-library design elements and is not likely to be useful in UI rich text.
script
- the content of the script to writeRichTextWriter addRichText(Document doc, String itemName)
doc
- documentitemName
- rich text item nameRichTextWriter addRichText(RichTextWriter rt)
rt
- writerRichTextWriter addRichTextRecord(RichTextRecord<?> record)
record
- raw record<T extends RichTextRecord<?>> RichTextWriter addRichTextRecord(Class<T> recordClass, Consumer<T> processor)
<T extends RichTextRecord<?>> RichTextWriter addRichTextRecord(RecordType recordType, Consumer<T> processor)
T
- the type of record that corresponds to recordType
recordType
- a RecordType
record type representing the record to createprocessor
- a Consumer
to configure the record<T extends RichTextRecord<?>> RichTextWriter addRichTextRecord(Class<T> recordClass, int variableDataLength, Consumer<T> processor)
This method allows you to specify an additional amount of space to allocate for the structure's variable data, which will be accessible just after the final part of the structure.
<T extends RichTextRecord<?>> RichTextWriter addRichTextRecord(RecordType recordType, int variableDataLength, Consumer<T> processor)
This method allows you to specify an additional amount of space to allocate for the structure's variable data, which will be accessible just after the final part of the structure.
T
- the type of record that corresponds to recordType
recordType
- a RecordType
record type representing the record to createvariableDataLength
- the amount of additional space, in bytes, to allocate after the structureprocessor
- a Consumer
to configure the record<T extends MemoryStructure> T createStructure(Class<T> structureClass, int variableDataLength)
MemoryStructure
of the given class in memory, without appending it to the
destination rich-text entity. This is useful in specific situations where variable data consists
of structured values.T
- the type of structure to createstructureClass
- a Class
representing <T>
variableDataLength
- the amount of additional space, in bytes, to allocate after the structureFontStyle createFontStyle()
TextStyle createTextStyle(String styleName)
styleName
- style namevoid discard()
Copyright © 2019–2021 HCL. All rights reserved.