Class HTMLStyledTextParser
- java.lang.Object
-
- org.eclipse.nebula.widgets.opal.commons.HTMLStyledTextParser
-
public class HTMLStyledTextParser extends java.lang.Object
Instances of this class are used to convert pseudo-HTML content of a styled text into style ranges
-
-
Field Summary
Fields Modifier and Type Field Description private int
currentPosition
private java.lang.StringBuilder
currentTag
private int
defaultHeight
private static java.util.Map<java.lang.String,java.lang.Integer[]>
HTML_CODES
private java.util.List<org.eclipse.swt.custom.StyleRange>
listOfStyles
private java.lang.StringBuilder
output
private java.util.LinkedList<org.eclipse.swt.custom.StyleRange>
stack
private org.eclipse.swt.custom.StyledText
styledText
-
Constructor Summary
Constructors Constructor Description HTMLStyledTextParser(org.eclipse.swt.custom.StyledText styledText)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private org.eclipse.swt.graphics.Color
computeColor()
private org.eclipse.swt.graphics.Font
computeFont()
private void
handleTag()
private void
initBeforeParsing()
private static java.util.Map<java.lang.String,java.lang.Integer[]>
initHTMLCode()
void
parse()
Parse the content, build the list of style ranges and apply them to the styled text widgetprivate void
processBeginBackgroundColor()
private void
processBeginBold()
private void
processBeginColor()
private void
processBeginItalic()
private void
processBeginSize()
private void
processBeginUnderline()
private void
processEndTag(java.lang.String expectedTag)
private org.eclipse.swt.custom.StyleRange[]
removeDoublons()
-
-
-
Field Detail
-
styledText
private final org.eclipse.swt.custom.StyledText styledText
-
output
private java.lang.StringBuilder output
-
currentTag
private java.lang.StringBuilder currentTag
-
listOfStyles
private final java.util.List<org.eclipse.swt.custom.StyleRange> listOfStyles
-
stack
private final java.util.LinkedList<org.eclipse.swt.custom.StyleRange> stack
-
currentPosition
private int currentPosition
-
defaultHeight
private final int defaultHeight
-
HTML_CODES
private static final java.util.Map<java.lang.String,java.lang.Integer[]> HTML_CODES
-
-
Method Detail
-
initHTMLCode
private static java.util.Map<java.lang.String,java.lang.Integer[]> initHTMLCode()
-
parse
public void parse() throws java.io.IOException
Parse the content, build the list of style ranges and apply them to the styled text widget- Throws:
java.io.IOException
-
removeDoublons
private org.eclipse.swt.custom.StyleRange[] removeDoublons()
-
initBeforeParsing
private void initBeforeParsing()
-
handleTag
private void handleTag()
-
processBeginBold
private void processBeginBold()
-
processEndTag
private void processEndTag(java.lang.String expectedTag)
-
processBeginItalic
private void processBeginItalic()
-
processBeginUnderline
private void processBeginUnderline()
-
processBeginSize
private void processBeginSize()
-
computeFont
private org.eclipse.swt.graphics.Font computeFont()
-
processBeginColor
private void processBeginColor()
-
computeColor
private org.eclipse.swt.graphics.Color computeColor()
-
processBeginBackgroundColor
private void processBeginBackgroundColor()
-
-