Top Description Fields Constructors Methods
org.eclipse.swt.custom

pack-priv Class HTMLWriter

extends StyledTextWriterBase
Class Inheritance
Imports
org.eclipse.swt.*, org.eclipse.swt.graphics.*

The 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:

Field Summary

Modifier and TypeField and Description
private boolean
private String
Inherited from org.eclipse.swt.custom.StyledTextWriterBase:
styledText

Constructor Summary

AccessConstructor and Description
public
HTMLWriter(StyledText styledText, int start, int length, StyledTextContent content)

Method Summary

Modifier and TypeMethod and Description
private static void
appendAlignAndJustify(StringBuilder buffer, int alignment, boolean justify)

private static String
appendFont(StringBuilder buffer, Font font, int fontStyle)

private static void
private static void
appendStyle(StringBuilder buffer, String prefix, String value, String postfix)

private static void
appendStyle(StringBuilder buffer, String prefix, int value, String postfix)

private static void
appendStyle(StringBuilder buffer, String prefix, Color value, String postfix)

public void
close()

Overrides org.eclipse.swt.custom.TextWriter.close.

Closes the writer.
private static String
pack-priv String
escapeText(String
the text to escape
string
)

Implements abstract org.eclipse.swt.custom.StyledTextWriterBase.escapeText.

Takes plain text and returns the same text escaped using the rules of the output format.
pack-priv void
writeEmptyLine()

Implements abstract org.eclipse.swt.custom.StyledTextWriterBase.writeEmptyLine.

Invoked at the end of each line, writeLineEnd, if there was no text output.
pack-priv void
writeHeader()

Implements abstract org.eclipse.swt.custom.StyledTextWriterBase.writeHeader.

Writes the part that only shows once, at the beginning of the output data.
public void
writeLineDelimiter(String
line delimiter to write
lineDelimiter
)

Overrides org.eclipse.swt.custom.TextWriter.writeLineDelimiter.

Appends the specified line delimiter to the data.
pack-priv String
writeLineStart(Color lineBackground, int indent, int verticalIndent, int alignment, boolean justify)

Implements abstract org.eclipse.swt.custom.StyledTextWriterBase.writeLineStart.

Invoked at the beginning of each line in the original widget.
pack-priv String
writeSpanStart(StyleRange style)

Implements abstract org.eclipse.swt.custom.StyledTextWriterBase.writeSpanStart.

Invoked at the beginning of each styled span fragment in the original widget.
Inherited from org.eclipse.swt.custom.StyledTextWriterBase:
writeEscapedwriteLinewriteLineEndwriteSpanEndwriteStyledLine

Field Detail

multilineback to summary
private boolean multiline
tagback to summary
private String tag

Constructor Detail

HTMLWriterback to summary
public HTMLWriter(StyledText styledText, int start, int length, StyledTextContent content)

Method Detail

appendAlignAndJustifyback to summary
private static void appendAlignAndJustify(StringBuilder buffer, int alignment, boolean justify)
appendFontback to summary
private static String appendFont(StringBuilder buffer, Font font, int fontStyle)
appendStyleback to summary
private static void appendStyle(StringBuilder buffer, String value)
appendStyleback to summary
private static void appendStyle(StringBuilder buffer, String prefix, String value, String postfix)
appendStyleback to summary
private static void appendStyle(StringBuilder buffer, String prefix, int value, String postfix)
appendStyleback to summary
private static void appendStyle(StringBuilder buffer, String prefix, Color value, String postfix)
closeback to summary
public void close()

Overrides org.eclipse.swt.custom.TextWriter.close.

Doc from org.eclipse.swt.custom.TextWriter.close.

Closes the writer. Once closed no more content can be written

Note

toString() is not guaranteed to return a valid string unless the writer is closed.

Annotations
@Override
colorToHexback to summary
private static String colorToHex(Color color)
escapeTextback to summary
pack-priv String escapeText(String string)

Implements abstract org.eclipse.swt.custom.StyledTextWriterBase.escapeText.

Doc from org.eclipse.swt.custom.StyledTextWriterBase.escapeText.

Takes plain text and returns the same text escaped using the rules of the output format.

Parameters
string:String

the text to escape

Returns:String

the escaped text

Annotations
@Override
writeEmptyLineback to summary
pack-priv void writeEmptyLine()

Implements abstract org.eclipse.swt.custom.StyledTextWriterBase.writeEmptyLine.

Doc from org.eclipse.swt.custom.StyledTextWriterBase.writeEmptyLine.

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.

Annotations
@Override
writeHeaderback to summary
pack-priv void writeHeader()

Implements abstract org.eclipse.swt.custom.StyledTextWriterBase.writeHeader.

Doc from org.eclipse.swt.custom.StyledTextWriterBase.writeHeader.

Writes the part that only shows once, at the beginning of the output data.

Annotations
@Override
writeLineDelimiterback to summary
public void writeLineDelimiter(String lineDelimiter)

Overrides org.eclipse.swt.custom.TextWriter.writeLineDelimiter.

Doc from org.eclipse.swt.custom.TextWriter.writeLineDelimiter.

Appends the specified line delimiter to the data.

Parameters
lineDelimiter:String

line delimiter to write

Annotations
@Override
writeLineStartback to summary
pack-priv String writeLineStart(Color lineBackground, int indent, int verticalIndent, int alignment, boolean justify)

Implements abstract org.eclipse.swt.custom.StyledTextWriterBase.writeLineStart.

Doc from org.eclipse.swt.custom.StyledTextWriterBase.writeLineStart.

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.
It will return the text that has to be output at the end of the line.

Returns:String

the text to append at the end of the line

Annotations
@Override
writeSpanStartback to summary
pack-priv String writeSpanStart(StyleRange style)

Implements abstract org.eclipse.swt.custom.StyledTextWriterBase.writeSpanStart.

Doc from org.eclipse.swt.custom.StyledTextWriterBase.writeSpanStart.

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.
It will return the text that has to be output at the end of the span (to close it).

Returns:String

the text to append at the end of the styled span

Annotations
@Override