Class 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 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
    • Constructor Detail

      • HTMLStyledTextParser

        HTMLStyledTextParser​(org.eclipse.swt.custom.StyledText styledText)
        Constructor
        Parameters:
        styledText - styled text to analyze
    • 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()