Package org.eclipse.text.html
Class HTMLBuilder
java.lang.Object
org.eclipse.text.html.HTMLBuilder
Provides a set of convenience methods for creating HTML pages.
 
 Moved into this package from org.eclipse.jface.internal.text.revisions.
- Since:
- 3.14
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddBullet(StringBuilder buffer, String bullet) Adds bulletpointvoidaddPageEpilog(StringBuilder buffer) voidaddPageProlog(StringBuilder buffer) voidaddParagraph(StringBuilder buffer, Reader paragraphReader) voidaddParagraph(StringBuilder buffer, String paragraph) voidaddPreFormatted(StringBuilder buffer, String preFormatted) Appends a string and keeps its whitespace and newlines.voidaddSmallHeader(StringBuilder buffer, String header) Adds h5 headlinestatic StringconvertToHTMLContent(String content) Escapes reserved HTML characters in the given string.static StringconvertToHTMLContentWithWhitespace(String content) Escapes reserved HTML characters in the given string and returns them in a way that preserves whitespace in a browser.static StringconvertTopLevelFont(String styles, boolean bold, boolean italic, int height, String fontName) Replaces the following style attributes of the font definition of thehtmlelement: font-size font-weight font-style font-family The font's name is used as font family, asans-serifdefault font family is appended for the case that the given font name is not available.voidendBulletList(StringBuilder buffer) ends the bulletpointlistvoidinsertPageProlog(StringBuilder buffer, int position) voidinsertPageProlog(StringBuilder buffer, int position, String styleSheet) voidinsertPageProlog(StringBuilder buffer, int position, URL styleSheetURL) voidinsertPageProlog(StringBuilder buffer, int position, RGB fgRGB, RGB bgRGB, String styleSheet) voidinsertStyles(StringBuilder buffer, String[] styles) static StringvoidvoidstartBulletList(StringBuilder buffer) 
- 
Constructor Details- 
HTMLBuilderpublic HTMLBuilder()
- 
HTMLBuilder
 
- 
- 
Method Details- 
setColors
- 
convertToHTMLContentEscapes reserved HTML characters in the given string.Warning: Does not preserve whitespace. - Parameters:
- content- the input string
- Returns:
- the string with escaped characters
- See Also:
 
- 
convertToHTMLContentWithWhitespaceEscapes reserved HTML characters in the given string and returns them in a way that preserves whitespace in a browser.- Parameters:
- content- the input string
- Returns:
- the processed string
- Since:
- 3.7
- See Also:
 
- 
read
- 
insertPagePrologpublic void insertPageProlog(StringBuilder buffer, int position, RGB fgRGB, RGB bgRGB, String styleSheet) - Parameters:
- buffer- the output StringBuilder
- position- offset where the prolog is placed
- fgRGB- Foreground-Color
- bgRGB- Background-Color
- styleSheet- Stylesheet
 
- 
insertStyles- Parameters:
- buffer- the output buffer
- styles- array with styles to be appended
 
- 
insertPageProlog- Parameters:
- buffer- the output buffer
- position- the offset
 
- 
insertPageProlog- Parameters:
- buffer- the output buffer
- position- the offset
- styleSheetURL- URL to the Stylesheet
 
- 
insertPageProlog- Parameters:
- buffer- the output buffer
- position- the offset
- styleSheet- Stylesheet
 
- 
addPageProlog- Parameters:
- buffer- the output buffer
 
- 
addPageEpilog
- 
startBulletList- Parameters:
- buffer- the output buffer
 
- 
endBulletListends the bulletpointlist- Parameters:
- buffer- the output buffer
 
- 
addBulletAdds bulletpoint- Parameters:
- buffer- the output buffer
- bullet- the bulletpoint
 
- 
addSmallHeaderAdds h5 headline- Parameters:
- buffer- the output buffer
- header- of h5 headline
 
- 
addParagraph- Parameters:
- buffer- the output buffer
- paragraph- the content of the paragraph
 
- 
addPreFormattedAppends a string and keeps its whitespace and newlines.- Parameters:
- buffer- the output StringBuilder
- preFormatted- the string that should be rendered with whitespace preserved
- Since:
- 3.7
- See Also:
 
- 
addParagraph- Parameters:
- buffer- the output buffer
- paragraphReader- The content of the Read will be added to output buffer
 
- 
convertTopLevelFontpublic static String convertTopLevelFont(String styles, boolean bold, boolean italic, int height, String fontName) Replaces the following style attributes of the font definition of thehtmlelement:- font-size
- font-weight
- font-style
- font-family
 sans-serifdefault font family is appended for the case that the given font name is not available.If the listed font attributes are not contained in the passed style list, nothing happens. - Parameters:
- styles- CSS style definitions
- bold- Should the text be bold
- italic- Should the text be italic
- height- Height of the text
- fontName- font name
- Returns:
- the modified style definitions
- Since:
- 3.3
 
 
-