Class HTMLStyledTextParser
- java.lang.Object
-
- org.eclipse.nebula.widgets.opal.commons.HTMLStyledTextParser
-
public class HTMLStyledTextParser extends java.lang.ObjectInstances 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 intcurrentPositionprivate java.lang.StringBuildercurrentTagprivate intdefaultHeightprivate static java.util.Map<java.lang.String,java.lang.Integer[]>HTML_CODESprivate java.util.List<org.eclipse.swt.custom.StyleRange>listOfStylesprivate java.lang.StringBuilderoutputprivate java.util.LinkedList<org.eclipse.swt.custom.StyleRange>stackprivate org.eclipse.swt.custom.StyledTextstyledText
-
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.ColorcomputeColor()private org.eclipse.swt.graphics.FontcomputeFont()private voidhandleTag()private voidinitBeforeParsing()private static java.util.Map<java.lang.String,java.lang.Integer[]>initHTMLCode()voidparse()Parse the content, build the list of style ranges and apply them to the styled text widgetprivate voidprocessBeginBackgroundColor()private voidprocessBeginBold()private voidprocessBeginColor()private voidprocessBeginItalic()private voidprocessBeginSize()private voidprocessBeginUnderline()private voidprocessEndTag(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.IOExceptionParse 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()
-
-