HTMLWriter class is used to write styled content as HTML.
The implementation creates a very-very simple HTML, as compatible
as possible: simple styles, no JavaScript.
How the concepts are mapped to HTML:
StyledText properties (for example StyledText#getBackground()
are written in a wrapping <div> or <span> (for line fragments).
StyledText#getLineBackground(int)
are written the <p> elements - if the copied range contains more then a line fragment.StyleRange properties inside the line are written the <span> elements.| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| private static String | |
| private static void | |
| private static void | |
| private static void | |
| private static void | |
| public void | |
| private static String | |
| pack-priv String | escapeText(String
the text to escape string)Implements abstract org. |
| pack-priv void | writeEmptyLine()
Implements abstract org. |
| pack-priv void | writeHeader()
Implements abstract org. |
| public void | writeLineDelimiter(String
line delimiter to write lineDelimiter)Overrides org. |
| pack-priv String | writeLineStart(Color lineBackground, int indent, int verticalIndent, int alignment, boolean justify)
Implements abstract org. |
| pack-priv String | writeSpanStart(StyleRange style)
Implements abstract org. |
| multiline | back to summary |
|---|---|
| private boolean multiline | |
| tag | back to summary |
|---|---|
| private String tag | |
| HTMLWriter | back to summary |
|---|---|
| public HTMLWriter(StyledText styledText, int start, int length, StyledTextContent content) | |
| appendAlignAndJustify | back to summary |
|---|---|
| private static void appendAlignAndJustify(StringBuilder buffer, int alignment, boolean justify) | |
| appendFont | back to summary |
|---|---|
| private static String appendFont(StringBuilder buffer, Font font, int fontStyle) | |
| appendStyle | back to summary |
|---|---|
| private static void appendStyle(StringBuilder buffer, String value) | |
| appendStyle | back to summary |
|---|---|
| private static void appendStyle(StringBuilder buffer, String prefix, String value, String postfix) | |
| appendStyle | back to summary |
|---|---|
| private static void appendStyle(StringBuilder buffer, String prefix, int value, String postfix) | |
| appendStyle | back to summary |
|---|---|
| private static void appendStyle(StringBuilder buffer, String prefix, Color value, String postfix) | |
| close | back to summary |
|---|---|
| public void close() Overrides org. Doc from org. Closes the writer. Once closed no more content can be written Note
| |
| colorToHex | back to summary |
|---|---|
| private static String colorToHex(Color color) | |
| escapeText | back to summary |
|---|---|
| pack-priv String escapeText(String string) Implements abstract org. Doc from org. Takes plain text and returns the same text escaped using the rules of the output format. | |
| writeEmptyLine | back to summary |
|---|---|
| pack-priv void writeEmptyLine() Implements abstract org. Doc from org. Invoked at the end of each line, writeLineEnd, if there was no text output. This is needed for HTML, which does not render empty paragraphs.
| |
| writeHeader | back to summary |
|---|---|
| pack-priv void writeHeader() Implements abstract org. Doc from org. Writes the part that only shows once, at the beginning of the output data.
| |
| writeLineDelimiter | back to summary |
|---|---|
| public void writeLineDelimiter(String lineDelimiter) Overrides org. Doc from org. Appends the specified line delimiter to the data. | |
| writeLineStart | back to summary |
|---|---|
| pack-priv String writeLineStart(Color lineBackground, int indent, int verticalIndent, int alignment, boolean justify) Implements abstract org. Doc from org. Invoked at the beginning of each line in the original widget. It should output whatever tags are appropriate to start a new line in the output format. | |
| writeSpanStart | back to summary |
|---|---|
| pack-priv String writeSpanStart(StyleRange style) Implements abstract org. Doc from org. Invoked at the beginning of each styled span fragment in the original widget. It should output whatever tags are appropriate to start a formatted span in the output format. | |